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

OnUpdateCommand Event is not firing when using telerik:GridButtonColumn

1 Answer 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jane
Top achievements
Rank 1
Jane asked on 22 Jun 2018, 08:47 PM

It was working for me at one point and then it stopped.  no matter what I have tried the event just did not fire and I couldn't figure out why  I have posted my both code behind and aspx.  Any help would be much appreciated.

Code behind:

protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["CompanyID"] != null)
            CompanyId = (Guid)Session["CompanyID"];
        if (Session["UserID"] != null)
            UserId = (Guid)Session["UserID"];
        if (!Page.IsPostBack)
        {
            loadBatchFileLog();
            rgBatchLog.DataSource = loadBatchFileLog();
            rgBatchLog.DataBind();
        }
    }

 private ICollection loadBatchFileLog()
    {
        DataView dv = new DataView();
        List<BatchOrderingTransform> info = new List<BatchOrderingTransform>();
        info = bll.GetBatchFileLog(CompanyId);
        if (info.Count > 0)
        {
            DataTable dt = new DataTable();
            dt = Common.ToDataTable<BatchOrderingTransform>(info);
            dv = new DataView(dt);
        }
        return dv;
}

protected void rgBatchLog_UpdateCommand(object sender, GridCommandEventArgs e)
    {
        long id = Convert.ToInt64(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"].ToString());
        var name = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Username"].ToString();
        var fileName = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["FileName"].ToString();
        bll.DeactivateBatchFile(id, name);
        loadBatchFileLog();
    }

aspx:

<telerik:RadGrid ID="rgBatchLog" runat="server" AutoGenerateColumns="false" GridLines="None" OnItemDataBound="rgBatchLog_ItemDataBound"
        allowPaging="true" AllowSorting="true" Width="100%" OnUpdateCommand="rgBatchLog_UpdateCommand">
        <PagerStyle Mode="Slider" />
        <MasterTableView AllowAutomaticDeletes="True" DataKeyNames="ID, CompanyId, Username, FileName,IsProcessed">
            <RowIndicatorColumn>
                    <HeaderStyle Width="20px" />
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px" />
                </ExpandCollapseColumn>
            <Columns>
                <telerik:GridHyperLinkColumn DataTextField="Details" ItemStyle-ForeColor="Blue" SortedBackColor="Blue" UniqueName="ID" DataNavigateUrlFields="ID" DataNavigateUrlFormatString="BatchReportDetails.aspx?BatchID={0}"
                    HeaderText="" Text="Details" SortExpression="ID"> <ItemStyle CssClass="hyperlink" /> </telerik:GridHyperLinkColumn>             
                <telerik:GridBoundColumn DataField="ServiceName" HeaderText="Package" UniqueName="ServiceName" />
                <telerik:GridBoundColumn DataField="OriginalFileName" HeaderText="File Name" UniqueName="OriginalFileName" />
                <telerik:GridBoundColumn DataField="ProcessRequestedDate" HeaderText="Scheduled Run Date" UniqueName="ProcessRequestedDate" />
                <telerik:GridBoundColumn DataField="IsProcessed" HeaderText="Is File Processed" UniqueName="IsProcessed" />
                <telerik:GridBoundColumn DataField="Name" HeaderText="User Name" UniqueName="Name"/>
                <telerik:GridBoundColumn DataField="UserEmail" HeaderText="User Email" UniqueName="UserEmail"/>
                <telerik:GridBoundColumn DataField="InputEmail" HeaderText="Input Email" UniqueName="InputEmail"/>
                <telerik:GridBoundColumn DataField="Created" HeaderText="Created" UniqueName="Created"/>
                <telerik:GridButtonColumn CommandName="Deactivate" ItemStyle-ForeColor="Blue" ButtonType="LinkButton" Text="Deactivate" UniqueName="Deactivate" CommandArgument="" ConfirmDialogType="Classic" ConfirmText="Are you sure you want to deactivate this record?"></telerik:GridButtonColumn>
            </Columns>
        </MasterTableView>
        <FilterMenu Skin="Vista" EnableTheming="True">
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
        </FilterMenu>
    </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 27 Jun 2018, 04:39 AM
Hi Jane,

Please make sure that you are not using DataBind method to bind the grid:
https://www.telerik.com/support/kb/aspnet-ajax/grid/details/how-to-bind-radgrid-properly-on-server-side

Also, there could be some hidden script error if you have AJAX on the page:
https://www.telerik.com/support/kb/aspnet-ajax/ajaxmanager/details/get-more-descriptive-errors-by-disabling-ajax

I hope this will prove helpful in resolving the issue.

Regards,
Eyup
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Jane
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or