Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <asp:TemplateField HeaderText="Include In Food Bag" ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
  2. <ItemTemplate>
  3. <asp:CheckBox runat="server" ID="ChkBxIncludeInFoodBag" Checked='<%# Bind("IncludeInFoodBag") %>' ></asp:CheckBox>
  4. </ItemTemplate>
  5. <FooterTemplate>
  6. <asp:CheckBox runat="server" ID="ChkBxIncludeInFoodBag"></asp:CheckBox>
  7. </FooterTemplate>
  8. </asp:TemplateField>
  9.  
  10. protected void BindFoodBagItemsGridView()
  11. {
  12. DataTable FoodBagItems = BLFoodBagItem.GetAllFoodBagItems();
  13.  
  14. if (FoodBagItems.Rows.Count > 0)
  15. {
  16. FoodBagItemsGridView.DataSource = BLFoodBagItem.GetAllFoodBagItems();
  17. }
  18. else
  19. {
  20. tempFoodItems = new DataTable();
  21. tempFoodItems.Columns.Add("FoodBagItemId");
  22. tempFoodItems.Columns.Add("ItemName");
  23. tempFoodItems.Columns.Add("ItemQuantity");
  24. tempFoodItems.Columns.Add("IncludeInFoodBag");
  25. DataRow dr = tempFoodItems.NewRow();
  26. dr["IncludeInFoodBag"] = bool.Parse("false");
  27. -- I also tried dr["IncludeInFoodBag"] = false;
  28. -- I also tried dr["IncludeInFoodBag"] = 0;
  29. tempFoodItems.Rows.Add(dr);
  30. FoodBagItemsGridView.DataSource = tempFoodItems;
  31.  
  32. }
  33.  
  34. FoodBagItemsGridView.DataBind();
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement