User-893317190 posted
Hi JagjitSingh,
What headings do you want? You could change head through asp:BoundField’s property HeaderText ,jquery or through gridview’s headerow property.
Below is my code.
<form id="form1" runat="server">
<div class="table-responsive">
<asp:GridView ID="gvw1" runat="server"
CssClass="table table-bordered table-striped "
ClientIDMode="Static" >
<Columns>
<asp:BoundField DataField="CustomerId" HeaderText="myCustomizedCustomerId" />
</Columns>
</asp:GridView></div>
</form>
</body>
<script type="text/javascript" charset="utf-8">
$(document).ready(function () {
// change the sixth column's header
$("#gvw1 tr:eq(0) th:eq(5)").replaceWith("<th >myHeadThroughJquery</th>")
$("#gvw1").prepend($("<thead></thead>").append($(this).find("tr:first"))).dataTable();
});
</script>
Code behind.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetData();
gvw1.HeaderRow.Cells[3].Text = "myHeaderThroughtHeaderRow";
}
}
void GetData()
{
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString))
{
SqlCommand cmd = new SqlCommand("Select * from [customers]", con);
cmd.CommandType = CommandType.Text;
con.Open();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows.Count > 0)
{
gvw1.DataSource = dt;
gvw1.DataBind();
}
dt.Clear();
}
}
The result.

As to search option , I have used code above , but it’s search option works well . Could you please post more code that may cause the problem so that we could reproduce your problem?
Best regards ,
Ackerly Xu