Datagrid help

  • Thread starter Thread starter Sulafa Malik
  • Start date Start date
S

Sulafa Malik

Hi all,

How can I use the OnItemCommand in the codebehind section of the webform i.e
in a function or a procedure , not in the html generated code.

Many Thanks
Sulafa Malik
 
Hi!

You need to add a listener in your codebehind file

private void Page_Load(object sender, System.EventArgs e)
{
//Add this code to listen for a ItemCommand from 'myDataGrid'
myDataGrid.OnItemCommand += new
DataGridCommandEventHandler(myDataGrid_ItemCommand);
}

private void myDataGrid_ItemCommand(object sender, DataGridCommandEventArgs
e)
{
//Handle the command here.
}

I hope this helps you out

//Mikael
 
Back
Top