dorandoran
Programmer
I wonder why the column width for all the columns are same, I set up headerstyle-width and itemstyle width. for example, i only need few space for quantity but it's taking up same space all rest of the column. not to mention, scrolling to right n left. (this is just sample, i have setup headerstyle and itemstyle width for all the columns).
<td colspan=100%>
<div id="div<%# Eval("subCatID") %>" style="display:none;position:relative;left:15px;OVERFLOW: auto;WIDTH:100%" >
<asp:GridView ID="GridView2" AllowSorting="true" BackColor="White" Width=70% Font-Size=X-Small
AutoGenerateColumns=false Font-Names="Verdana" runat="server" DataKeyNames="LocationID" ShowFooter=true
OnPageIndexChanging="GridView2_PageIndexChanging" OnRowUpdating = "GridView2_RowUpdating"
OnRowCommand = "GridView2_RowCommand" OnRowEditing = "GridView2_RowEditing" GridLines=None
OnRowUpdated = "GridView2_RowUpdated" OnRowCancelingEdit = "GridView2_CancelingEdit" OnRowDataBound = "GridView2_RowDataBound"
OnRowDeleting = "GridView2_RowDeleting" OnRowDeleted = "GridView2_RowDeleted" OnSorting = "GridView2_Sorting"
BorderStyle=Double BorderColor="#0083C1">
<RowStyle BackColor="Gainsboro" />
<AlternatingRowStyle BackColor="White" />
<HeaderStyle BackColor="#0083C1" ForeColor="White"/>
<FooterStyle BackColor="White" />
<Columns>
<asp:TemplateField HeaderText="ID" SortExpression="ID" Visible="false">
<ItemTemplate><%# Eval("LocationID")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtLocationID" Text='<%# Eval("LocationID")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtLocationID" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name" SortExpression="Name" HeaderStyle-Width="80">
<ItemTemplate><%# Eval("Name")%></ItemTemplate>
<ItemStyle Width="80" />
<EditItemTemplate>
<asp:TextBox ID="txtName" Text='<%# Eval("Name")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtName" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Part" SortExpression="Part">
<ItemTemplate><%# Eval("Part")%></ItemTemplate>
<ItemStyle Width="100%" />
<EditItemTemplate>
<asp:TextBox ID="txtPart" Text='<%# Eval("Part")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtPart" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Serial" SortExpression="Serial">
<ItemTemplate><%# Eval("Serial")%></ItemTemplate>
<ItemStyle Width="100%" />
<EditItemTemplate>
<asp:TextBox ID="txtSerial" Text='<%# Eval("Serial")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtSerial" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Expiration" SortExpression="Expiration">
<ItemTemplate><%# Eval("Expiration")%></ItemTemplate>
<ItemStyle Width="100%" />
<EditItemTemplate>
<asp:TextBox ID="txtExpiration" Text='<%# Eval("Expiration")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtExpiration" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Quantity" SortExpression="Quantity">
<ItemTemplate><%# Eval("Quantity")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtQuantity" Text='<%# Eval("Quantity")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtQuantity" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Location" SortExpression="Location">
<ItemTemplate><%# Eval("Location")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtLocation" Text='<%# Eval("Location")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtLocation" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Flight" SortExpression="Flight">
<ItemTemplate><%# Eval("Flight")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtFlight" Text='<%# Eval("Flight")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtFlight" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status" SortExpression="Status">
<ItemTemplate><%# Eval("Status")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtStatus" Text='<%# Eval("Status")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtStatus" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="Edit" ShowEditButton="True" />
<asp:TemplateField HeaderText="Delete">
<ItemTemplate>
<asp:LinkButton ID="linkDeleteProd" CommandName="Delete" runat="server">Delete</asp:LinkButton>
</ItemTemplate>
<FooterTemplate>
<asp:LinkButton ID="linkAddProd" CommandName="AddProd" runat="server">Add</asp:LinkButton>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</td>
<td colspan=100%>
<div id="div<%# Eval("subCatID") %>" style="display:none;position:relative;left:15px;OVERFLOW: auto;WIDTH:100%" >
<asp:GridView ID="GridView2" AllowSorting="true" BackColor="White" Width=70% Font-Size=X-Small
AutoGenerateColumns=false Font-Names="Verdana" runat="server" DataKeyNames="LocationID" ShowFooter=true
OnPageIndexChanging="GridView2_PageIndexChanging" OnRowUpdating = "GridView2_RowUpdating"
OnRowCommand = "GridView2_RowCommand" OnRowEditing = "GridView2_RowEditing" GridLines=None
OnRowUpdated = "GridView2_RowUpdated" OnRowCancelingEdit = "GridView2_CancelingEdit" OnRowDataBound = "GridView2_RowDataBound"
OnRowDeleting = "GridView2_RowDeleting" OnRowDeleted = "GridView2_RowDeleted" OnSorting = "GridView2_Sorting"
BorderStyle=Double BorderColor="#0083C1">
<RowStyle BackColor="Gainsboro" />
<AlternatingRowStyle BackColor="White" />
<HeaderStyle BackColor="#0083C1" ForeColor="White"/>
<FooterStyle BackColor="White" />
<Columns>
<asp:TemplateField HeaderText="ID" SortExpression="ID" Visible="false">
<ItemTemplate><%# Eval("LocationID")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtLocationID" Text='<%# Eval("LocationID")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtLocationID" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name" SortExpression="Name" HeaderStyle-Width="80">
<ItemTemplate><%# Eval("Name")%></ItemTemplate>
<ItemStyle Width="80" />
<EditItemTemplate>
<asp:TextBox ID="txtName" Text='<%# Eval("Name")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtName" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Part" SortExpression="Part">
<ItemTemplate><%# Eval("Part")%></ItemTemplate>
<ItemStyle Width="100%" />
<EditItemTemplate>
<asp:TextBox ID="txtPart" Text='<%# Eval("Part")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtPart" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Serial" SortExpression="Serial">
<ItemTemplate><%# Eval("Serial")%></ItemTemplate>
<ItemStyle Width="100%" />
<EditItemTemplate>
<asp:TextBox ID="txtSerial" Text='<%# Eval("Serial")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtSerial" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Expiration" SortExpression="Expiration">
<ItemTemplate><%# Eval("Expiration")%></ItemTemplate>
<ItemStyle Width="100%" />
<EditItemTemplate>
<asp:TextBox ID="txtExpiration" Text='<%# Eval("Expiration")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtExpiration" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Quantity" SortExpression="Quantity">
<ItemTemplate><%# Eval("Quantity")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtQuantity" Text='<%# Eval("Quantity")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtQuantity" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Location" SortExpression="Location">
<ItemTemplate><%# Eval("Location")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtLocation" Text='<%# Eval("Location")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtLocation" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Flight" SortExpression="Flight">
<ItemTemplate><%# Eval("Flight")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtFlight" Text='<%# Eval("Flight")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtFlight" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status" SortExpression="Status">
<ItemTemplate><%# Eval("Status")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtStatus" Text='<%# Eval("Status")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtStatus" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="Edit" ShowEditButton="True" />
<asp:TemplateField HeaderText="Delete">
<ItemTemplate>
<asp:LinkButton ID="linkDeleteProd" CommandName="Delete" runat="server">Delete</asp:LinkButton>
</ItemTemplate>
<FooterTemplate>
<asp:LinkButton ID="linkAddProd" CommandName="AddProd" runat="server">Add</asp:LinkButton>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</td>