c# - Fixed header column width in gridview? -
i want set header column width grid view. tried headerstyle-width="30px"
. depending on item columns. column width setting based on item value. want fixed width if has value or empty.
you can give header style-width , itemstyle width.it possible add span , set width .so item width remains value whether empty or contains value.i think little changes gridview makes achieve solution problem
<asp:templatefield headertext="category" headerstyle-horizontalalign="center" itemstyle-horizontalalign="center"> <headertemplate> <asp:linkbutton id="lnkcategory" runat="server" tooltip="click here sort category" commandname="sort" commandargument="category" text="category" /> </headertemplate> <itemtemplate> <span style="width:50px"> <%#eval("category")%> </span> </itemtemplate> <headerstyle horizontalalign="left" width="50px" ></headerstyle> <itemstyle horizontalalign="left" width="50px"></itemstyle> </asp:templatefield>
nottable changes are
<itemtemplate> <span style="width:50px"> <%#eval("category")%> </span> </itemtemplate> <headerstyle horizontalalign="left" width="50px" ></headerstyle> <itemstyle horizontalalign="left" width="50px"></itemstyle>
Comments
Post a Comment