Hi,
I am trying to update a datagrid row inline.
I got my ASPX page like this ...
<asp:TemplateColumn HeaderText="Title">
<ItemTemplate>
<asp:Label id="Label5" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Title") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox id="add_Title" runat="server" BackColor="blue"></asp:TextBox> </FooterTemplate>
<EditItemTemplate>
<asp:TextBox id="edit_Title1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Title") %>'>
</asp:TextBox></EditItemTemplate>
</asp:TemplateColumn>
As you can see i got 3-4 colums in this way..I get into editable mode where the textboxes appear with data.
But when i change the data using the following code..
TextBox txtTitle=(TextBox)e.Item.FindControl("edit_Title1");
string strTitle=txtTitle.Text;
The string returns is always the Old data..just doesnt pick up the changed data..this is the problem:i cannot get the changed data ..
Same issue with Add..Is the datagrid not able to get the changed data from the control..
Using ASP.NET c#
The new contents are in the *first cell* of e.Item:
e.Item.Cells[0]
To get the text directly, use:
e.Item.Cells[0].Text
I hope that helps.
Dave
| Forum legend: | |
| Locked thread | |
| Moderator | |
![]() | CNET staff |
![]() | Samsung staff |
| Norton Authorized Support team | |
| AVG staff | |
| Windows Outreach team | |
![]() | Dell staff |
| Intel staff | |