Hi
I am using DataGrid with two columns, one column is read only having label inside and second column having text box inside. ( am using Template column ).
Both columns are bind to data columns ( see the code below ).
But the problem am facing is when am updating values in second column i.e. Text boxes and trying to retrieve it and getting old values .
am trying to use
TextBox txtVal = (TextBox)this.DataGrid1.Items.FindControl("txtValue");
But txtVal.Text is giving me old values ...
Any Idea ?
<asp:TemplateColumn HeaderText="Field">
<ItemStyle BackColor="LightGray"></ItemStyle>
<ItemTemplate><asp:Label id="lblField" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Field") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Value">
<ItemStyle BackColor="LightGray"></ItemStyle>
<ItemTemplate><asp:TextBox id=txtValue runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Value") %>' EnableViewState="False"></asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
I am using DataGrid with two columns, one column is read only having label inside and second column having text box inside. ( am using Template column ).
Both columns are bind to data columns ( see the code below ).
But the problem am facing is when am updating values in second column i.e. Text boxes and trying to retrieve it and getting old values .
am trying to use
TextBox txtVal = (TextBox)this.DataGrid1.Items.FindControl("txtValue");
But txtVal.Text is giving me old values ...
Any Idea ?
<asp:TemplateColumn HeaderText="Field">
<ItemStyle BackColor="LightGray"></ItemStyle>
<ItemTemplate><asp:Label id="lblField" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Field") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Value">
<ItemStyle BackColor="LightGray"></ItemStyle>
<ItemTemplate><asp:TextBox id=txtValue runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Value") %>' EnableViewState="False"></asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>