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

Accessing GridButtonColumn From Codebehind

2 Answers 659 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Deepak
Top achievements
Rank 1
Deepak asked on 02 Aug 2011, 11:54 AM
Hi,

I am new to Telerik and have some requirements where I need to change ConfirmText Property of GridButtonColumn from ItemDataBound event of radGrid.

Below is the event I am using where I need to change the ConfirmText property:

 

 

protected void RgDictionary_ItemDataBound(object sender, GridItemEventArgs e)

 

{

 

 

if (e.Item is GridDataItem && !e.Item.IsInEditMode && e.Item.NamingContainer.NamingContainer is RadGrid)

 

{

 

 

GridDataItem dataBoundItem = e.Item as GridDataItem;

 

bool

 

 

IsChildDictionary = (dataBoundItem["IsChildDictionary"].Controls[0] as CheckBox).Checked;

 

 

 

    if (IsChildDictionary)

 

    {

    dataBoundItem[

 

"RawString"].Style.Add("color", "green");

 

    (dataBoundItem[

 

"DeleteColumn"].Controls[0] as LinkButton).Text = "Make Local";

 

 

 

    //Here I want to change ConfirmText Property Value

 

 

 

 

 

    (dataBoundItem[

 

"EditCanonicalForm"].Controls[0] as LinkButton).Style.Add("display", "none");

 

}

}

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Aug 2011, 12:42 PM
Hello Deepak,

Try the following code snippet to show ConfirmText from Codebehind.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
   if(e.Item is GridDataItem)
     {
       GridDataItem item = (GridDataItem)e.Item;
       (RadGrid1.MasterTableView.GetColumn("DeleteColumn") as GridButtonColumn).ConfirmText = "Delete";
     }
}

Thanks,
Princy.
0
Deepak
Top achievements
Rank 1
answered on 03 Aug 2011, 08:47 AM
Hi Princy,

Thanks a lot. the code that you suggested is working fine.
Thank you so much again.
Tags
Grid
Asked by
Deepak
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Deepak
Top achievements
Rank 1
Share this question
or