Hi friends,In the radgrid i have a Tempalte coloumn Which has an EditTempalte as shown below.I want to the update new value for the field User_login: User.identity.name
<telerik:GridTemplateColumn SortExpression="User_Login" UniqueName="User_Login" HeaderText="User_Login" >
<ItemTemplate>
<asp:Label Text='<%# Eval("User_Login") %>' runat="server" ID="lblUserLoginItem" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID ="txtUserLoginEdit" runat="server" Text='<%# Bind("User_Login") %>'> </asp:TextBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
But when I try to do the following in the code behind: It retrieves the only the old value beacause of the bind and if i dont use the bind it does not update at all.Is there something I am missing..Please guide..thank You
protected void rgTransferDetails_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted)
{
GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item;
TextBox lblUserLogin = (TextBox)item.FindControl("txtUserLoginEdit");
lblUserLogin.Text = User.Identity.Name;
}
if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
GridEditFormItem editItem = (GridEditFormItem)e.Item;
TextBox lblUserLoginEdit = (TextBox)editItem.FindControl("txtUserLoginEdit");
lblUserLoginEdit.Text = User.Identity.Name;
}
}
<telerik:GridTemplateColumn SortExpression="User_Login" UniqueName="User_Login" HeaderText="User_Login" >
<ItemTemplate>
<asp:Label Text='<%# Eval("User_Login") %>' runat="server" ID="lblUserLoginItem" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID ="txtUserLoginEdit" runat="server" Text='<%# Bind("User_Login") %>'> </asp:TextBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
But when I try to do the following in the code behind: It retrieves the only the old value beacause of the bind and if i dont use the bind it does not update at all.Is there something I am missing..Please guide..thank You
protected void rgTransferDetails_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted)
{
GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item;
TextBox lblUserLogin = (TextBox)item.FindControl("txtUserLoginEdit");
lblUserLogin.Text = User.Identity.Name;
}
if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
GridEditFormItem editItem = (GridEditFormItem)e.Item;
TextBox lblUserLoginEdit = (TextBox)editItem.FindControl("txtUserLoginEdit");
lblUserLoginEdit.Text = User.Identity.Name;
}
}