telerik itemcommand event not firing after clicks a GridButtonColumn

5 posts, 0 answers
  1. Rk.MooRthy(DLL Version : 2008.3.1314.35)
    Rk.MooRthy(DLL Version : 2008.3.1314.35) avatar
    21 posts
    Member since:
    Jun 2013

    Posted 24 Jul 2013 Link to this post

    Hi,
    I have created one column as "GridButtonColumn" in one dynamic radgrid, When i click a button in any of the row that "GridButtonColumn" column will be hided soon... Can you anyone help me to solve the problem ..?


    Thanks
    -Rk.MooRthy
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Jul 2013 Link to this post

    Hi Rk,

    I'm not sure what is causing such an issue.Below is a simple code snippet that i have tried ,the ItemCommand Event is firing on the button click.
    If this doesn't help,please provide your full code.

    C#:
    protected void Page_Init(object sender, System.EventArgs e)
       {
           GridBoundColumn boundColumn = new GridBoundColumn();
           RadGrid1.MasterTableView.Columns.Add(boundColumn);
           boundColumn.DataField = "CustomerID";
           boundColumn.HeaderText = "Customer ID";
     
           boundColumn = new GridBoundColumn();
           RadGrid1.MasterTableView.Columns.Add(boundColumn);
           boundColumn.DataField = "ContactName";
           boundColumn.HeaderText = "Contact Name";
     
           GridButtonColumn select = new GridButtonColumn();
           RadGrid1.MasterTableView.Columns.Add(select);
           select.CommandName = "UserButton";
           select.Text = "UserButton";
           select.UniqueName = "UserButton";       
       }
       
       protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
       {
           if (e.CommandName == "UserButton")
           {
               //Your Code
           }
       }

    Thanks,
    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rk.MooRthy(DLL Version : 2008.3.1314.35)
    Rk.MooRthy(DLL Version : 2008.3.1314.35) avatar
    21 posts
    Member since:
    Jun 2013

    Posted 24 Jul 2013 Link to this post

    Hi Princy,
      public void LoadGrid()
          {
       //  some code
        GridButtonColumn btnReachCurve = new GridButtonColumn();
                btnReachCurve.HeaderText = "View ReachCurve";
                btnReachCurve.UniqueName = "ReachCurve";
                btnReachCurve.DataType = typeof(string);
                btnReachCurve.CommandName = "ReachCurve";
                btnReachCurve.ButtonType = GridButtonColumnType.LinkButton;
                btnReachCurve.HeaderStyle.Wrap = true;
                btnReachCurve.Text = "View";
                btnReachCurve.Display = true;
                RadGrid2.MasterTableView.Columns.Add(btnReachCurve);
         }
    I have added one column like LinkButton with GridButtonColumn in one grid.

    protected void RadGrid2_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
      //  some code
    }

    If i clicks a button in the grid first time, the itemcommand is firing. After that "View Reach Curve" column will be hided which one i created in LoadGrid function..
    If you couldn't able to understand this issue I will give you a full code..
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Jul 2013 Link to this post

    Hi Rk,

    The GridButton is being hidden because you have added the button to the Radgrid at the end,please add it soon after the creation.Try the below code snippet.Let me know if any concern

    C#:
    GridButtonColumn btnReachCurve = new GridButtonColumn();
     RadGrid2.MasterTableView.Columns.Add(btnReachCurve); //Add Here
     btnReachCurve.HeaderText = "View ReachCurve";
     btnReachCurve.UniqueName = "ReachCurve";
     btnReachCurve.DataType = typeof(string);
     btnReachCurve.CommandName = "ReachCurve";
     btnReachCurve.ButtonType = GridButtonColumnType.LinkButton;
     btnReachCurve.HeaderStyle.Wrap = true;
     btnReachCurve.Text = "View";
     btnReachCurve.Display = true;

    Thanks,
    Princy
  6. Rk.MooRthy(DLL Version : 2008.3.1314.35)
    Rk.MooRthy(DLL Version : 2008.3.1314.35) avatar
    21 posts
    Member since:
    Jun 2013

    Posted 25 Jul 2013 Link to this post

    Hi Princy,
    Its working superb now, Thanks a lot princy..

    -Rk.MooRthy
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017