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

telerik itemcommand event not firing after clicks a GridButtonColumn

4 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rk.MooRthy(DLL Version : 2008.3.1314.35) asked on 24 Jul 2013, 09:39 AM
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

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 24 Jul 2013, 09:52 AM
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
0
answered on 24 Jul 2013, 10:40 AM
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..
0
Princy
Top achievements
Rank 1
answered on 25 Jul 2013, 03:09 AM
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
0
answered on 25 Jul 2013, 06:53 AM
Hi Princy,
Its working superb now, Thanks a lot princy..

-Rk.MooRthy
Tags
Grid
Asked by
Answers by
Princy
Top achievements
Rank 1
Share this question
or