This is a migrated thread and some comments may be shown as answers.

[Solved] Value of numeric textbox in Template column zoroed on sort

2 Answers 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
idwaikat
Top achievements
Rank 2
idwaikat asked on 11 Aug 2009, 03:04 PM
Hello all.

I have a template column inside a grid, this column contains numeric text box as follows:

<telerik:GridTemplateColumn DataField="Cost" HeaderText="Cost" UniqueName="Cost"
   <ItemTemplate> 
      <telerik:RadNumericTextBox runat="server" ID="numtxtCost" Width="80px"></telerik:RadNumericTextBox> 
   </ItemTemplate> 
</telerik:GridTemplateColumn> 

when trying to sort the grid (by clicking the header column of any other column) the entered (not saved yet) values of the template column vanish; the numeric textboxes re-initialized to zeros...


do you have any idea of how to fix it

Thanks



2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Aug 2009, 09:56 AM
Hi,

The Numeric Textbox control text will not be persisted on postbacks, so you need to persist the text state on TextChanged event of the textbox. A similar scenario wherein the checked state of a checkbox placed inside a TemplateColumn, is persisted is illustrtated in the following help document. Probably this should help you get started:
Persisting CheckBox control state in GridTemplateColumn on rebind

Thanks
Princy.
0
idwaikat
Top achievements
Rank 2
answered on 12 Aug 2009, 12:05 PM
Thanks Princy, but the link you provided gives me: The system cannot find the path specified.

I think this is the correct link .

It seems that the solution depends on manuall coding and using viewstate to store/read values for each control.

I'll try it.

Thank you.
Tags
Grid
Asked by
idwaikat
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
idwaikat
Top achievements
Rank 2
Share this question
or