The error comes to this line in the javascript;
if (div.style.display == "none")
Here is the whole javascript plus the ondatabound code behind.
<script language="javascript" type = "text/javascript">
var currentlyOpenedDiv = "";
function CollapseExpand(object)
{
var div = document.getElementById(object);
if (currentlyOpenedDiv != "" && currentlyOpenedDiv != div)
{
currentlyOpenedDiv.style.display = "none";
}
if (div.style.display == "none")
{
div.style.display = "inline";
currentlyOpenedDiv = div;
}
else
{
div.style.display = "none";
}
}
</script>
protected void gvwChangeRequestList_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover",
"this.style.backgoundcolor='#4A4A4A'; this.style.cursor='pointer';
this.style.color='blue'");
e.Row.Attributes.Add("onmouseout",
"this.style.backgroundcolor='#FFFFFF'; this.style.color='black'");
e.Row.ToolTip = "Click on the row to view any children to " +
e.Row.Cells[2].Text;
GridView child = (GridView)e.Row.FindControl("gvwChild");
if (child != null)
{
SqlDataSource dbChild = new SqlDataSource();
dbChild.ConnectionString =
ConfigurationManager.ConnectionStrings["ProteusConnectionString"].ConnectionString;
dbChild.SelectCommand = "SELECT * " +
"FROM tblChangeRequest " +
"WHERE IsChildOf = '" +
((DataRowView)e.Row.DataItem)["ChangeRequestID"].ToString() + "' " +
"ORDER BY DevTargetEndDate";
child.DataSource = dbChild;
child.DataBind();
}
e.Row.Attributes.Add("onclick", "javascript:CollapseExpand('" +
e.Row.Cells[3].Text + "')");
}
}
I found the basic row click info when googling. Can anyone see what is
wrong here as to why the error and how to keep the 'Edit' from being involved
in the row click?
Thanks for your time.
... John
e.Row.Attributes.Add("onclick", "javascript:CollapseExpand('" +
e.Row.Cells[0].Text + "')");
When this line is commented out no error. When ('" + e.Row.Cells[0].Text +
"') this part is removed, no error. This is the object part of the
javascript function. So this is what should be looked at. And also a way to
avoid the first column with 'Edit' in it for editing the row.
Thanks...John