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

How to pass the Fieldvalue to the ConfirmText in delete column

1 Answer 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Krishna
Top achievements
Rank 1
Krishna asked on 15 Jul 2008, 11:44 PM
Hi
I have a delete column in the grid and i want give custom confirmText to that.
i want specify something like below

ConfirmText

="Are you sure you want to delete details of" + "<EmployeeName>"


EmployeeName is the one of the field in the grid

Thanks
-Krishna

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Jul 2008, 04:33 AM
Hi Krishna,

Try the following code snippet to achieve the desired scenario.


ASPX:
<telerik:GridClientDeleteColumn UniqueName="DeleteCol"  ></telerik:GridClientDeleteColumn> 

CS:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            string  strKey = item.GetDataKeyValue("EmployeeName").ToString(); 
            (item["DeleteCol"].Controls[0] as LinkButton).Attributes.Add("onclick", "return confirm('You want to delete " + strKey + "?');");  
              
        } 
  } 


Thanks
Shinu.


Tags
Grid
Asked by
Krishna
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or