Thanks Kenobewan,
I've managed to add the JS to my gridview cells, but making them editable is tricky must have read hundreds of posts and tuts but no luck?
here my code so far;
- protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
-
{
-
if (e.Row.RowType == DataControlRowType.DataRow)
-
{
-
for (int columnIndex = 1; columnIndex < e.Row.Cells.Count; columnIndex++)
-
{
-
string name = e.Row.UniqueID.Replace("_", "$");
-
// Add this javascript to the onclick Attribute of the cell
-
e.Row.Cells[columnIndex].Attributes.Add("onclick", "javascript:__doPostBack('" + name + "','Select$" + e.Row.DataItem.ToString() + "')");
-
// Add a cursor style to the cells
-
e.Row.Cells[columnIndex].Attributes["style"] += "cursor:pointer;cursor:hand;";
-
}
-
}
-
}
-
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
-
{
-
-
}
I want to invoke the edit mode in SelectedIndexChange but can't work it out. I can't use GridRowEventArgs, so no luck with NewEditIndex.
I've also tried this post http://www.codeproject.com/aspnet/EditGridviewCells.asp.
But I need to use BoundFields so this isn't working. Any ideas to point me in the right direction?