Connecting Tech Pros Worldwide Help | Site Map

dropdown in child grid

Familiar Sight
 
Join Date: Feb 2007
Posts: 142
#1: Jun 12 '09
I added a dropdown control in the child grid and now the regular header with sort not working for the column i added ddl. hmm, any idea?? (without the added ddl the sort works).
Expand|Select|Wrap|Line Numbers
  1. <asp:TemplateField HeaderText="Quantity " SortExpression="Quantity">
  2. <ItemTemplate><%# Eval("Quantity")%></ItemTemplate>
  3. <EditItemTemplate>
  4. <asp:TextBox ID="txtQuantity" Text='<%# Eval("Quantity")%>' runat="server"></asp:TextBox>
  5. </EditItemTemplate>
  6. <HeaderTemplate>
  7. <asp:Label runat=server ID="lblQty" Text="Quantity"  ></asp:Label>
  8.  
  9.  
  10. <asp:DropDownList ID="ddlQuantity" runat="server" AutoPostBack=true >
  11. <asp:ListItem Text="30" Value="30" />
  12. <asp:ListItem Text="60" Value="60" />
  13. <asp:ListItem Text="90" Value="90" />
  14. </asp:DropDownList>
  15. </HeaderTemplate>                                                
  16. <FooterTemplate>
  17. <asp:TextBox ID="txtQuantity" Text='' runat="server"></asp:TextBox>
  18. </FooterTemplate>
  19.  
  20. </asp:TemplateField>
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#2: Jun 16 '09

re: dropdown in child grid


The GridView will automatically convert header text into LinkButtons that it uses for sorting purposes when you do not specify your own custom HeaderTemplate.

Since you require your own custom Header Template, then use the controls within this template to do your sorting instead of the GridView's Sort Event.
Familiar Sight
 
Join Date: Feb 2007
Posts: 142
#3: Jun 16 '09

re: dropdown in child grid


Thank you sir. I got it work now.
Reply