P
pbd22
Hi.
I am trying to add an "onclick" 'event to an
anchor tag and this is proving harder than
I imagined.
The anchor HAS NO ID. And, there will be tons of them on the page. So,
I cannot access it via FindControl.
the tag is nested as such:
<td></td><td><a href='#'>clicky</a></td><td></td>
My approach has been to muddle with RowDataBound but it isn't clear to
me how to do this.
Please help.
Thanks.
protected void vGridView_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//
e.Row.Cells[1].Controls[0].Attributes.Add("onclick",
"alert(getRowText(this));return false;");
}
}
I am trying to add an "onclick" 'event to an
anchor tag and this is proving harder than
I imagined.
The anchor HAS NO ID. And, there will be tons of them on the page. So,
I cannot access it via FindControl.
the tag is nested as such:
<td></td><td><a href='#'>clicky</a></td><td></td>
My approach has been to muddle with RowDataBound but it isn't clear to
me how to do this.
Please help.
Thanks.
protected void vGridView_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//
e.Row.Cells[1].Controls[0].Attributes.Add("onclick",
"alert(getRowText(this));return false;");
}
}