i have a datagrid and one Columns of them is an email and i want to make the mail open like in <mailto > tag in html

Recommended Answers

All 2 Replies

use this for your datagrids ItemDataBound event handler
assuming that the email is in the fourth column:

private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
		{
			if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
			{
				string sLnk = "<a href='mailto:"+ e.Item.Cells[3].Text+
					"'>"+ e.Item.Cells[3].Text +"</a>";
				e.Item.Cells[3].Text = sLnk;
			}
		
		}

thanks
i'ave tried this code and it works well

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.