I have a column that contains an email address. If I want this to be a hyperlink to start an email, would I convert the field into a template field and add a hyperlink control to the template?
Or is there another way to do this with the infragistics ASP.NET controls?
Thanks,
Brian.
Thanks for the reply and links.
I've decided to use the second option and it works well.
To do this I went to the 'Edit WebHierarchicalFataGrids Bands' dialog and found the column I wanted to have a hyper link in. I set the HtmlEncode property to false.
Then in the server side code I needed to wrap up the raw email address into a mailto link.
So, during the initializeRow event I added this code...
protected void WebHierarchicalDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)
{
GridRecordItem emailAddress = e.Row.Items.FindItemByKey("EmailAddress");
if (emailAddress != null)
string emailHtml = string.Format("<a href='mailto:{0}'>{0}</a>", emailAddress.Value);
emailAddress.Text = emailHtml;
}
Hello Brian,
As you mentioned in your initial post first option is to use hyperlink in template column of the grid. You can see how to do this here - http://help.infragistics.com/Help/NetAdvantage/ASPNET/2011.2/CLR4.0/html/WebDataGrid_Using_Item_Template.html
A second option is to save the email address in the Database/Data Source as a plain text and then enable “HtmlEncode” property (by set it to “false”) for the needed column. This will inform the grid that the text in this column should be treated as HTML and the link will be available for the end user - http://help.infragistics.com/Help/NetAdvantage/ASPNET/2011.2/CLR4.0/html/Infragistics4.Web.v11.2~Infragistics.Web.UI.GridControls.FormattedGridField~HtmlEncode.html
Let me know if you have additional questions.