Hi while binding grid getting html tags : for "&" getting & and space nbsp; please help
Protected Sub OnRowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Cells(1).Text = Regex.Replace(e.Row.Cells(1).Text, txtSearch.Text.Trim(), _
Function(match As Match) String.Format("<span style = 'background-color:#FFFF00'>{0}</span>", match.Value), _
RegexOptions.IgnoreCase)
End If
End Sub
Private Sub fillGrid()
Dim strSQL As String
strSQL = "select * from CUSTOMERMST"
FillDataGrid(gridData, strSQL)
End If
End Sub
Public Sub FillDataGrid(ByVal d As Object, ByVal qry As String)
Dim myadp As New SqlDataAdapter(qry, con)
Dim myds As New DataSet
myadp.Fill(myds)
d.DataSource = myds
d.DataBind()
End Sub
<asp:TextBox ID="txtSearch" runat="server" ></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" Text="Search" CausesValidation="false" />
<asp:GridView ID="gridData" OnRowDataBound="OnRowDataBound" runat="server" AutoGenerateColumns="False" DataKeyNames="CUSTID">
<Columns>
<asp:BoundField DataField="CUSTNAME" HeaderText="Customer Name">
<HeaderStyle HorizontalAlign="Left" Wrap="false " />
</asp:BoundField>
</Columns> </asp:GridView>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Call fillGrid()
End If
End Sub