我使用CKEditor输入详细信息(详细信息包含html元素)。之后,细节将绑定到网格中。在这里我想在工具提示中显示没有html标签的细节。
protected void grdStepMain_RowDataBound(object sender, GridViewRowEventArgs e)
{
int i = 0;
if (e.Row.RowType == DataControlRowType.DataRow)
{
foreach (TableCell cell in e.Row.Cells)
{
i++;
string description = cell.Text;
if (cell.Text.Length > 8 && (i == 2))
cell.Text = cell.Text.Substring(0, 8) + "....";
string newdescription = Regex.Replace(description, @"<[^>]+>| ", "").Trim();
cell.ToolTip = newdescription;
}
}
}
但它不起作用请帮助我。 示例:
string str= " <h1><span style="font-family:courier new,courier,monospace"><strong>457457</strong> 544444444444457457457</span>";
The result in tooltip should be 457457544444444444457457457
此致 Jithesh A