Sir,
I am displaying the Header text at the runtime with the help of RowCreated event.It is getting displayed properly.I have enabled sorting in the aspx page as stated below.
In the code behind I have written the coding to display the header text at the runtime as shown below.
My problem is that I am not able to get the link in the header text which could be clicked for sorting in the header section, what am i missing.
With this I have attached the jpg file which shows as how it should be displayed, but now as how it is being displayed
My second question is that I need to display the header text in the format that they are displayed in two lines for example "Author Name" need to be displayed in two lines like
I am displaying the Header text at the runtime with the help of RowCreated event.It is getting displayed properly.I have enabled sorting in the aspx page as stated below.
Code:
<asp:BoundField ReadOnly="true" DataField="id" SortExpression="id"/>
<asp:BoundField DataField="author" SortExpression="author"/>
<asp:BoundField DataField="title" SortExpression="title"/>
<%-- <asp:BoundField HeaderText="Genre" DataField="genre" SortExpression="genre"/>--%>
<asp:TemplateField >
<itemtemplate>
<asp:dropdownlist id="dropdownlist1" runat="server">
</asp:dropdownlist>
</itemtemplate>
</asp:TemplateField>
<asp:BoundField DataField="price" SortExpression="price"/>
<asp:BoundField DataField="publish_date" SortExpression="publish_date"/>
<asp:BoundField DataField="description" SortExpression="description"/>
Code:
protected void MyGridRowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
TableCellCollection TCC = e.Row.Cells;
TCC[0].Text = "For Modification Purpose";
TCC[1].Text = "Book ID";
TCC[2].Text = "Author Name";
TCC[3].Text = "Title";
TCC[4].Text = "Genere";
TCC[5].Text = "Price";
TCC[6].Text = "Publish Date";
TCC[7].Text = "Description";
}
}
With this I have attached the jpg file which shows as how it should be displayed, but now as how it is being displayed
My second question is that I need to display the header text in the format that they are displayed in two lines for example "Author Name" need to be displayed in two lines like
Author
Name
Name