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

[Solved] RadGrid Events are not working

1 Answer 115 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mubashir
Top achievements
Rank 1
Mubashir asked on 05 Apr 2013, 11:27 AM
I have download the Telerik Trail version and tried to use RadGrid. I can able to bind datatable from codebehind but able to execute code on any other grid event like onItemUpdate, onItemDelete and etc. Please check code below 

CodeBehind

 public void gwList_Delete(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        
        if (!(new BusinessLogic.LogicClasses.clsUser()).validatePage(Convert.ToInt64(Session["UserID"].ToString()), Page.GetType().Name.Replace("_", "."), BusinessLogic.clsGeneral.RecActionDelete))
        {
            Response.Redirect("Default.aspx?msg=" + BusinessLogic.clsGeneral.strUnAutherise, true);
        }
        else
        {
            BusinessLogic.EntityClasses.clsCity objEDel = new BusinessLogic.EntityClasses.clsCity();
            //objEDel.RecID = Convert.ToInt64(gwList.data[e.Item].Values[0].ToString());
            objEDel.RUserID = Convert.ToInt64(Session["UserID"].ToString());
            long lrt = (new BusinessLogic.LogicClasses.clsCity()).Delete(objEDel);
            if (lrt > 0)
                (new clsFunctions()).SetMessage(BusinessLogic.clsGeneral.strSuccess, Master);
            else
                (new clsFunctions()).SetMessage(BusinessLogic.clsGeneral.strUnSuccess, Master);

            LoadGrid();
        }



ASPX:
 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="gwList">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="gwList" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" />
   

    <telerik:RadGrid ID="gwList" EnableViewState="true" runat="server" AllowPaging="true"
        AllowSorting="True" AllowFilteringByColumn="false" GridLines="None"
         AutoGenerateColumns="false" AllowAutomaticDeletes="true"
            OnItemDeleted="gwList_delete">
        
        <MasterTableView AllowMultiColumnSorting="true" TableLayout="Fixed" EditMode="EditForms"
         AllowFilteringByColumn="true" DataSourceID="" AllowPaging="true">
            <Columns>
                <telerik:GridBoundColumn DataField="City" HeaderText="City" HeaderStyle-Width="100px"
                    FilterControlWidth="50px" AllowFiltering="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Country" HeaderText="Country" AllowFiltering="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Miki" HeaderText="Miki" AllowFiltering="true">
                </telerik:GridBoundColumn>
      
        <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                    UniqueName="Miki"  >

                    <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                </telerik:GridButtonColumn>



        <telerik:GridEditCommandColumn >
        </telerik:GridEditCommandColumn>
    


            </Columns>
        </MasterTableView>
        
    </telerik:RadGrid>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 10 Apr 2013, 07:12 AM
Hi Mubashir,

I would suggest you to review the following forum post where could be found descriptions when those event should be used.

Regards,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Mubashir
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or