Advertisement
96fauj

Untitled

Mar 19th, 2013
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using MyClassLibrary;
  8.  
  9. public partial class MyOrder : System.Web.UI.Page
  10. {
  11.  
  12. protected void Page_Load(object sender, EventArgs e)
  13. {
  14. DataCall();
  15. }
  16.  
  17. private void DataCall()
  18. {
  19. //Object gets created for use from the class(clsDataConduit)
  20. clsDataDictionary AnOrder = new clsDataDictionary();
  21. //Declaring a new SqlDataSource from the inbuilt class library
  22. SqlDataSource sqlDS_ItemTable = new SqlDataSource();
  23. //Using our datasource object being cast onto our objects connectionstring
  24. sqlDS_ItemTable.ConnectionString = AnOrder.ConnectionString;
  25. //Our sql statement being passed through to our .SelectCommand method
  26. sqlDS_ItemTable.SelectCommand = "Select * from tblOrders";
  27. //Adding controls to our SqlDataSource object
  28. this.Controls.Add(sqlDS_ItemTable);
  29. //Declares the DataSource for our gridview !
  30. grdOrder.DataSource = sqlDS_ItemTable;
  31. //Binds the data to refresh every time it's used
  32. grdOrder.DataBind();
  33.  
  34.  
  35.  
  36. }
  37.  
  38.  
  39. protected void grdOrder_SelectedIndexChanged(object sender, EventArgs e)
  40. {
  41. Label bigStore = (Label)grdOrder.SelectedRow.Cells[2].FindControl("OrderId");
  42.  
  43. clsStockCollection AnId = new clsStockCollection();
  44.  
  45. clsStock TheOrder = new clsStock();
  46. TheOrder.OrderId = Convert.ToInt32(bigStore);
  47. AnId.DeleteOrder(TheOrder);
  48. DataCall();
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement