locked
Rad grid EditItemTemplate Update problem. RRS feed

  • Question

  • User-2104551191 posted

    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

    Note: The interesting thing is that when i amke a minor edit to the user_login and then clcik update It gets update. If there is textchange only then it gets updated

    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;
    
                }
    
    }

    Wednesday, July 16, 2014 3:53 PM

All replies

  • User-2104551191 posted

    Instead I used the entity data source  updating event directly.

    Friday, July 18, 2014 12:54 PM