G
Guest
I am dynamically adding a checkbox in a gridview and I find there are several
things that I cannot figure out how to address.
1. The width of the checkbox column is very wide. I've tried adding
properties and Item Style to the column but it has no effect. Is there
someway to size this column to be smaller? I removed the CssClass property
and it had no effect on the size as well.
2. The gridview is sortable using javascript. Is there any way to keep
checkboxes selected after the sort?
<asp:GridView ID="GridViewResults" runat="server"
AutoGenerateColumns="False"
CssClass="sortable" >
<Columns>
<asp:TemplateField HeaderText="Select" >
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
<ItemStyle width="20px" />
</asp:TemplateField>
<asp:HyperLinkField DataNavigateUrlFields="QuoteID"
DataNavigateUrlFormatString="SetupSummary.aspx?QuoteID={0}"
DataTextField="UserFriendlyQuoteID" HeaderText="Quote ID"
NavigateUrl="~/SetupSummary.aspx"
SortExpression="UserFriendlyQuoteID" />
<asp:BoundField DataField="QuoteStatusDescription"
HeaderText="Status" />
<asp:BoundField DataField="AcceptedDate" HeaderText="Accept
Date" />
<asp:BoundField DataField="Notes" HeaderText="Notes" />
</Columns>
</asp:GridView>
Any thoughts would be appreciated.
Bill
things that I cannot figure out how to address.
1. The width of the checkbox column is very wide. I've tried adding
properties and Item Style to the column but it has no effect. Is there
someway to size this column to be smaller? I removed the CssClass property
and it had no effect on the size as well.
2. The gridview is sortable using javascript. Is there any way to keep
checkboxes selected after the sort?
<asp:GridView ID="GridViewResults" runat="server"
AutoGenerateColumns="False"
CssClass="sortable" >
<Columns>
<asp:TemplateField HeaderText="Select" >
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
<ItemStyle width="20px" />
</asp:TemplateField>
<asp:HyperLinkField DataNavigateUrlFields="QuoteID"
DataNavigateUrlFormatString="SetupSummary.aspx?QuoteID={0}"
DataTextField="UserFriendlyQuoteID" HeaderText="Quote ID"
NavigateUrl="~/SetupSummary.aspx"
SortExpression="UserFriendlyQuoteID" />
<asp:BoundField DataField="QuoteStatusDescription"
HeaderText="Status" />
<asp:BoundField DataField="AcceptedDate" HeaderText="Accept
Date" />
<asp:BoundField DataField="Notes" HeaderText="Notes" />
</Columns>
</asp:GridView>
Any thoughts would be appreciated.
Bill