This is a migrated thread and some comments may be shown as answers.

RadGrid UpdateCommand not firing

1 Answer 135 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 24 Sep 2015, 02:54 PM

Hello,

The Update command does not work when I try to update values inside a RadGrid that resides inside a UserControl.  

The UserControl is loaded into a TabStrip tab when the tab is clicked by the user.  This is the code that loads the user control:

parent.Controls.Clear();
UserControl ctrl = (UserControl)LoadControl(controlName);
string userControlID = controlName.Split('.')[0];
userControlID = userControlID.Replace("/", "").Replace("~", "") + "_UC";
ctrl.ID = userControlID;
parent.Controls.Add(ctrl);

I'm using Advanced Databinding for the Radgrid like so:

protected void rgdHousingVersion_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    rgdHousingVersion.DataSource = BLL.GetAHUHousingVersions();
}

And here's the HTML for the UserControl:

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<telerik:RadAjaxManagerProxy ID="rampAdminHousingVersion" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rgdHousingVersion">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rgdHousingVersion" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
 
<telerik:RadGrid ID="rgdHousingVersion" runat="server"
    OnNeedDataSource="rgdHousingVersion_NeedDataSource"
    OnEditCommand="rgdHousingVersion_EditCommand" OnUpdateCommand="rgdHousingVersion_UpdateCommand"
    AutoGenerateColumns="false"
    AllowPaging="false">
    <MasterTableView DataKeyNames="HousingID" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage" EditMode="InPlace" EnableViewState="true">
        <Columns>
            <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="~/Images/Graphics/16/Change_16.png"></telerik:GridEditCommandColumn>
            <telerik:GridBoundColumn DataField="HousingID" HeaderText="Housing ID" UniqueName="HousingID"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Description" HeaderText="Description" UniqueName="Description"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Reference" HeaderText="Reference" UniqueName="Reference"></telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn ButtonType="ImageButton" />
        </EditFormSettings>
    </MasterTableView>
</telerik:RadGrid>

Here's the code-behind for the OnEditCommand and OnUpdateCommand:

protected void rgdHousingVersion_EditCommand(object sender, GridCommandEventArgs e)
{
    //Does fire
}
 
protected void rgdHousingVersion_UpdateCommand(object sender, GridCommandEventArgs e)
{
    //Does NOT fire
}

I'm really not sure what I'm doing wrong.  Why is the UpdateCommand not firing?  Any help is appreciated.  I have not been able to find an answer to this problem anywhere.  Thanks!

 

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 29 Sep 2015, 08:50 AM
Hi Shawn,

I examine the provided code but I am not sure on which event you add the user control dynamically. Keep in mind a suitable event is PageViewCreated as demonstrated in the following help article.

Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Shawn
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or