Edited Item in PopUp Window

4 posts, 0 answers
  1. Liam
    Liam avatar
    13 posts
    Member since:
    Sep 2008

    Posted 11 Feb 2009 Link to this post

    I'm moving to using a PopUp template for the updating of records within a RadGrid, but am unable to retrieve the updated value from my text box, it keeps returning the original value.

    Below I've included a very simple grid with just the one column and the same is happening.

    <telerik:RadGrid ID="rgTestData" runat="server" AutoGenerateColumns="False" GridLines="None" 
            Skin="WebBlue" Width="600px" OnInsertCommand="rgTestData_InsertCommand" OnCancelCommand="rgTestData_CancelCommand" 
            OnUpdateCommand="rgTestData_UpdateCommand" AllowPaging="True" AutoGenerateEditColumn="True" 
            OnItemCommand="rgTestData_ItemCommand">  
            <HeaderContextMenu> 
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
            </HeaderContextMenu> 
            <MasterTableView CommandItemDisplay="TopAndBottom" EditMode="PopUp">  
                <RowIndicatorColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </ExpandCollapseColumn> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="genericName" HeaderText="Generic Name" UniqueName="genericName">  
                    </telerik:GridBoundColumn> 
                </Columns> 
                <EditFormSettings EditFormType="Template">  
                    <EditColumn AutoPostBackOnFilter="True" UniqueName="EditCommandColumn1">  
                    </EditColumn> 
                    <FormTemplate> 
                        <telerik:RadTextBox ID="txtGenericName" runat="server" Skin="WebBlue" Width="125px" 
                            Text='<%# Bind("genericName") %>'>  
                        </telerik:RadTextBox> 
                        <br /> 
                        <asp:LinkButton ID="btnSave" runat="server" Text="Save" CommandName="Update" /> 
                        <asp:LinkButton ID="btnCancel" runat="server" Text="Cancel" CommandName="Cancel" /> 
                    </FormTemplate> 
                </EditFormSettings> 
            </MasterTableView> 
            <FilterMenu> 
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
            </FilterMenu> 
        </telerik:RadGrid> 

    I'm then very simply trying to pull back the new value I've entered in the textbox after the Update button is pressed.

    protected void rgTestData_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)  
            {  
                if (e.CommandName == RadGrid.UpdateCommandName)  
                {  
                    if (e.Item is GridEditFormItem && e.Item.IsInEditMode)  
                    {  
                        GridEditableItem item = e.Item as GridEditableItem;  
     
                        String GenericName = item["genericName"].Text.ToString();  
                    }  
                }
            } 

    Thanks in advance for any help provided in resolving my problem.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Feb 2009 Link to this post

    Hi,

    Try out the following code snippet.

    CS:
    protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) 
        { 
            GridEditFormItem editformItem = (GridEditFormItem)e.Item; 
            RadTextBox txtbx = (RadTextBox)editformItem.FindControl("txtGenericName"); 
            string strTxt = txtbx.Text; 
     
        } 


    Thanks
    Shinu




  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Liam
    Liam avatar
    13 posts
    Member since:
    Sep 2008

    Posted 12 Feb 2009 Link to this post

    Unfortunately that did not work either, the same is happening.

    I'm wondering if I've created the grid wrongly, but all has been developed through the builder (no hand coding), so I'd hope it is all as it should be.

    Thanks.
  5. Liam
    Liam avatar
    13 posts
    Member since:
    Sep 2008

    Posted 12 Feb 2009 Link to this post

    I have found a work around.

    Originally I had been pulling the data from a business object which was called from the page and manually binding this to the grid. I have now dropped an Object Scope Provider control on to the page and pulling the data from here.

    This solution isn't ideal for me, so if anyone could offer any tips they'd be greatly appreciated!

    Once again thanks.
Back to Top