SolutionCottage.com
Posted  13 Nov 2008 - 16:25:37

Category: ASP.net


Alt texts on Header of HyperLinkField

Issue:
There is no way of directly setting an alt text on a header of a generated HyperLinkField.

Solution:
You can however, add this to the OnRowDataBound event on the GridView. An example code would be:

<asp:Gridview runat="server" OnRowDataBound="setAltTexts" [...] />

protected void setAltTextHyperLinkFields(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[0].Attributes.Add("title","alt text");
}
}








0 comments:








© SolutionCottage 2008-2011 7/21/2017 3:33:06 AM