code_junkie

Best way to custom edit records in ASP.NET?

Nov 10th, 2011
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <asp:DataGrid ID="GridView1" runat="server" AutoGenerateColumns="False">
  2. <Columns>
  3. <asp:BoundColumn DataField="RuleID" Visible="False" HeaderText="RuleID"></asp:BoundColumn>
  4. <asp:TemplateColumn HeaderText="Category">
  5. <ItemTemplate>
  6. <!-- in case we want to display an image -->
  7. <asp:Literal ID="litImage" runat="server">
  8. </asp:Literal>
  9. <asp:DropDownList ID="categoryListDropdown" runat="server"></asp:DropDownList>
  10. </ItemTemplate>
  11. </asp:TemplateColumn>
  12.  
  13. </Columns>
  14. </asp:DataGrid>
  15.  
  16. foreach (DataGridItem item in this.GridView1.Items)
  17. {
  18. DropDownList categoryListDropdown = ((DropDownList)item.FindControl("categoryListDropdown"));
  19. categoryListDropdown.Items.AddRange(listItems.ToArray());
  20. }
Add Comment
Please, Sign In to add comment