Here is the .aspx code:
<asp:GridView ID="gvLeads" runat="server" DataSourceID="sdsAdminLeads" AllowSorting="True"
EnableModelValidation="True" DataKeyNames="leadKey" AutoGenerateColumns="False"
OnSelectedIndexChanged="gvLeads_selected" OnRowCommand="gvLeads_RowCommand" OnDataBound="gvLeads_DataBound">
<Columns>
<asp:CommandField ShowSelectButton="true" SelectText="Edit" ButtonType="Link" />
<asp:ButtonField CommandName="Details" Text="Details" />
...(other BoundFields)
</Columns>
</asp:GridView>
This generates the following when the page renders:
<td><a href="javascript:__doPostBack('ucLeads$gvLeads','Select$0')">Edit</a></td>
<td><a href="javascript:__doPostBack('ucLeads$gvLeads','Details$0')">Details</a></td>
...
<td><a href="javascript:__doPostBack('ucLeads$gvLeads','Select$1')">Edit</a></td>
<td><a href="javascript:__doPostBack('ucLeads$gvLeads','Details$1')">Details</a></td>
...
The page designer would like me to put a div tag between the td and anchor tag so that the resulting html that gets generated will be:
<td><div class=editPanel id=edit0></div><a href="javascript:__doPostBack('ucLeads$gvLeads','Select$0')">Edit</a></td>
<td><div class=detailPanel id=detail0></div><a href="javascript:__doPostBack('ucLeads$gvLeads','Details$0')">Details</a></td>
...
<td><div class=editPanel id=edit1></div><a href="javascript:__doPostBack('ucLeads$gvLeads','Select$1')">Edit</a></td>
<td><div class=detailPanel id=detail1></div><a href="javascript:__doPostBack('ucLeads$gvLeads','Details$1')">Details</a></td>
...
I've tried putting this code in the gvLeads_DataBound function:
for (int i = 0; i < gvLeads.Rows.Count; i++)
{
((LinkButton)gvLeads.Rows[i].Cells[0].Controls[0]).Text = "<div class=editPanel id=edit" + i + "></div>" + ((LinkButton)gvLeads.Rows[i].Cells[0].Controls[0]).Text;
((LinkButton)gvLeads.Rows[i].Cells[1].Controls[0]).Text = "<div class=detailPanel id=detail" + i + "></div>" + ((LinkButton)gvLeads.Rows[i].Cells[1].Controls[0]).Text;
}
But this results in the tags being put inside the anchor tag as such:
<td><a href="javascript:__doPostBack('ucLeads$gvLeads','Select$0')"><div class=editPanel id=edit0></div>Edit</a></td>
<td><a href="javascript:__doPostBack('ucLeads$gvLeads','Details$0')"><div class=detailPanel id=detail0></div>Details</a></td>
...
<td><a href="javascript:__doPostBack('ucLeads$gvLeads','Select$1')"><div class=editPanel id=edit1></div>Edit</a></td>
<td><a href="javascript:__doPostBack('ucLeads$gvLeads','Details$1')"><div class=detailPanel id=detail1></div>Details</a></td>
So the .Text property of the LinkButton control is not what I need, but I don't know what property of what control in the cell to use to put the div text where I want it.