manelandrce
Programmer
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?
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?