Answered by:
AutoSizeColumnsMode not appear in asp:Gridview Control

Question
-
User992700523 posted
I am using ASP .Net Grid view control and bind it on SelectedIndexChange with Datatable.
<asp:GridView ID="CRUDGrid" runat="server" CssClass="col-md-12" ItemStyle-width="100%"></asp:GridView>
CRUDGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
This shows error in code. How can i solve this problem.
Thank you,
Regards,
Muhammad Naveed HaroonSaturday, December 9, 2017 7:48 AM
Answers
-
User-1716253493 posted
Why not simply using bootstrap table
<asp:GridView ID="CRUDGrid" runat="server" CssClass="table" > </asp:GridView>
<asp:GridView ID="CRUDGrid" runat="server" CssClass="table table-striped" > </asp:GridView>
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, December 9, 2017 9:25 AM -
User-1838255255 posted
Hi MuhammadNaveedHaroon,
According to your description, as far as i know, property AutoSizeColumnsMode is belongs to winform datagridview control, but you want to add this property to asp.net control gridview, so occur this error. This property could set the width of the column dynamically through content.
You could use bootstrap(responsive table) to achieve this effect, please try:
Bootstrap CSS Tables Reference:
https://www.w3schools.com/bootstrap/bootstrap_ref_css_tables.asp
Best Regards,
Eric Du
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, December 11, 2017 6:32 AM
All replies
-
User-1716253493 posted
Why not simply using bootstrap table
<asp:GridView ID="CRUDGrid" runat="server" CssClass="table" > </asp:GridView>
<asp:GridView ID="CRUDGrid" runat="server" CssClass="table table-striped" > </asp:GridView>
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, December 9, 2017 9:25 AM -
User-1838255255 posted
Hi MuhammadNaveedHaroon,
According to your description, as far as i know, property AutoSizeColumnsMode is belongs to winform datagridview control, but you want to add this property to asp.net control gridview, so occur this error. This property could set the width of the column dynamically through content.
You could use bootstrap(responsive table) to achieve this effect, please try:
Bootstrap CSS Tables Reference:
https://www.w3schools.com/bootstrap/bootstrap_ref_css_tables.asp
Best Regards,
Eric Du
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, December 11, 2017 6:32 AM