Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User control inside gridview row

Status
Not open for further replies.

manelandrce

Programmer
Sep 25, 2008
4
ES
Hi,

An example of my problem:

<asp:GridView ID="gvList" runat="server" AutoGenerateColumns="false"
DataKeyNames="Id" OnSorting="Search_Sorting">
<Columns>

<asp:TemplateField>
<ItemTemplate>
<CustomControls:Order id="CustomOrderItem" runat="server"
CurrentOrder='<%# Eval("Order") %>'></CustomControls:Order>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

The Order user control contains :

<asp:TextBox ID="txtOrder" runat="server" Width="25"></asp:TextBox>

The Sorting event:

protected void Search_Sorting(object sender, GridViewSortEventArgs e)
{
SortExpression = e.SortExpression;
SortOrder = SortOrder == SortDirection.Ascending
? SortDirection.Descending
: SortDirection.Ascending;
SetDataSource();
gvList.DataBind();
}



But when I sort the list, I lost the TextBox value in the User Control (gvList.DataBind())

How can I solve it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top