G
Guest
What i'm trying to do is allow the user click on a row in the datagrid and it
highlights the row. I have the select button for my grid and its hidden.
I can do this in VB.NET successfully with this same code but when i put it
in C# it does not work.
what am i missing?
private void DataGrid1_ItemCreated(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item | e.Item.ItemType ==
ListItemType.AlternatingItem | e.Item.ItemType == ListItemType.SelectedItem)
{
e.Item.Attributes.Add("onmouseover",
"this.style.bacgroundcolor='#FFFFFF';this.style.cursor='hand'");
e.Item.Attributes.Add("onclick","javascript:__doPostBack('" + " DataGrid1:"
+ "_ctl" + (e.Item.ItemIndex + 7) + ":_ctl0','')");
}
}
highlights the row. I have the select button for my grid and its hidden.
I can do this in VB.NET successfully with this same code but when i put it
in C# it does not work.
what am i missing?
private void DataGrid1_ItemCreated(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item | e.Item.ItemType ==
ListItemType.AlternatingItem | e.Item.ItemType == ListItemType.SelectedItem)
{
e.Item.Attributes.Add("onmouseover",
"this.style.bacgroundcolor='#FFFFFF';this.style.cursor='hand'");
e.Item.Attributes.Add("onclick","javascript:__doPostBack('" + " DataGrid1:"
+ "_ctl" + (e.Item.ItemIndex + 7) + ":_ctl0','')");
}
}