tags:

views:

1304

answers:

1

If you click on the 'search' button in the following link

link text

A gridview shows up. I am trying to do something similar within a table whose width is set to auto. My current way is to create the gridview in design view, but however, my gridview does not resize to the table width. I understand that I posed 2 different questions in one.

My current gridview is as such. Defined in 'source' view

<asp:GridView ID="gridView" runat="server"
             AutoGenerateColumns="False"
             EnableSortingAndPagingCallbacks="True"
             AllowPaging="True" DataSourceID="FilesByJobObjectDataSource" 
             PageSize="5" OnRowCommand="gridView_RowCommand" DataKeyNames="FileID"  
             HorizontalAlign="Left" >
             <Columns>
                 <asp:BoundField DataField="RID" HeaderText="RID" 
                    ReadOnly="True" ItemStyle-Width="50px"  >
                     <ItemStyle Width="50px" />
                 </asp:BoundField>
                <asp:BoundField DataField="Category" HeaderText="Category" 
                    ReadOnly="True" ItemStyle-Width="100 px" >
                    <ItemStyle Width="100px" />
                 </asp:BoundField>
                <asp:BoundField DataField="FileName" HeaderText="Type" 
                     ReadOnly="True" ItemStyle-Width="575 px" > 
                    <ItemStyle Width="575px" />
                 </asp:BoundField>
                <asp:BoundField DataField="FileID" Visible="false" />
                <asp:ButtonField Text="X" ButtonType="Button" ItemStyle-Width="20px" >
                    <ItemStyle Width="20px" />
                 </asp:ButtonField>
            </Columns>
             <RowStyle CssClass="RowStyle" />
            <EmptyDataRowStyle CssClass="EmptyRowStyle" />
            <PagerStyle CssClass="PagerStyle" />
            <SelectedRowStyle CssClass="SelectedRowStyle" />
            <HeaderStyle CssClass="HeaderStyle" />
            <EditRowStyle CssClass="EditRowStyle" />
            <AlternatingRowStyle CssClass="AltRowStyle" />
     </asp:GridView>
     </ContentTemplate>
+1  A: 

Dont set the column widths....

StingyJack