regex - How to remove HTML tags from string using asp.net (Bold,strong,font names etc etc) -
i using ckeditor enter details (the details contains html elements ). after details bind grid. in want show details without html tags in tooltip.
protected void grdstepmain_rowdatabound(object sender, gridviewroweventargs e) { int = 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 = regex.replace(newdescription, @"<[^>]+>| ", "").trim(); } } }
but not working please me. example:
string str= " <h1><span style="font-family:courier new,courier,monospace"><strong>457457</strong> 544444444444457457457</span>"; result in tooltip should 457457544444444444457457457
please help. regards jithesh
int = 0; string newdescription = ""; 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)) { string = regex.replace(description, @"<.+?>| ", "").trim(); cell.text = a.substring(0, 8) + "...."; } if (i == 2) { newdescription = regex.replace(description, @"<.+?>| ", "").trim(); } cell.tooltip = regex.replace(newdescription, @"<.+?>| ", "").trim(); } }
Comments
Post a Comment