Here is the code.It is free like "free beer".If you have question send me email at johnstalley@live.com.Remember datagrid index it 0 based.
NB You could add another parameter to the function that will execute when click=ok
public static void AddConfirm(DataGrid theGrid, int columnNumber, string question)
{
//for each row in the DataGrid
foreach(DataGridItem item in theGrid.Items)
{
//for each webcontrol in the column
foreach(WebControl control in item.Cells[columnNumber].Controls)
//if it is a LinkButton or Button
{
if(control is LinkButton || control is Button)
//add the attribute
control.Attributes.Add("OnClick", " javascript:return confirm('" + question + "');");
}
}
}
No comments:
Post a Comment