Connecting Tech Pros Worldwide Help | Site Map

dropdown in child grid

  #1  
Old June 12th, 2009, 04:52 PM
Familiar Sight
 
Join Date: Feb 2007
Posts: 142
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>

Last edited by Frinavale; June 16th, 2009 at 04:44 PM. Reason: Added code tags. Please post code in [code] [/code] tags.
  #2  
Old June 16th, 2009, 04:47 PM
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North :)
Posts: 4,940
Provided Answers: 8

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.
  #3  
Old June 16th, 2009, 10:51 PM
Familiar Sight
 
Join Date: Feb 2007
Posts: 142

re: dropdown in child grid


Thank you sir. I got it work now.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
childgrid > Not sorting dorandoran answers 1 June 12th, 2009 05:17 PM
How do i handle the Selected Index Changed event of a dynamic DropDownList RK800 answers 1 February 26th, 2008 03:29 PM
Problem with dropdown lists in Form venhari answers 0 August 22nd, 2007 05:47 AM
Parent-Child Relation in DataGrid Ambica Jain answers 0 May 24th, 2006 12:05 AM