DataGrid中取HyperLinkColumn列的值.

 /// <summary>
/// 对datagrid中标签进行编码,处理特殊字符
/// </summary>
/// <param name="gvGrid">DataGrid</param>
public void EncodeCurrentDataGrid(DataGrid gvGrid)
{
foreach (DataGridItem dgi in gvGrid.Items)
{
for (int i = ; i < dgi.Cells.Count; i++)
{
if (gvGrid.Columns[i] is BoundColumn)
{
dgi.Cells[i].Text = StringLang.getEmptyString(dgi.Cells[i].Text);
}
if (gvGrid.Columns[i] is HyperLinkColumn)
{
((HyperLink)dgi.Cells[i].Controls[]).Text = StringLang.getEmptyString(((HyperLink)dgi.Cells[i].Controls[]).Text);
}
}
}
}

处理DataGrid中特殊字符

///处理特殊字符对object类型文本进行编码
public static string getEmptyString(object obj)
{
string str;
try
{
if (obj == null)
{
return "";
}
str = WebLang.dvHTMLEncode(obj.ToString());
}
catch (SystemException exception)
{
throw exception;
}
return str;
}
04-18 12:03