<div style="padding-top: 10px; padding-right: 15px; padding-bottom: 25px">
<div class="table">
<div>
<asp:GridView ID="gvList" runat="server" AutoGenerateColumns="false"
DataKeyNames="UserId" AllowSorting="true" onrowcreated="gvList_RowCreated"
onrowdatabound="gvList_RowDataBound"
onsorting="gvList_Sorting">
<AlternatingRowStyle CssClass="even" />
<EmptyDataTemplate>
Records for selected criteria do not exist
</EmptyDataTemplate>
<Columns>
<asp:TemplateField>
<ItemStyle Width="2%"/>
<HeaderTemplate>
<asp:Label ID="lblSelect" runat="server" Text="<%$ Resources:LBShowcaseRes,lblSelect %>"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle width="15%"/>
<HeaderTemplate>
<asp:LinkButton ID="lnkFirstName" runat="server" Text="<%$ Resources:LBShowcaseRes,lblFirstName %>" CommandName="Sort" CommandArgument="FirstName"></asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblFirstName" runat="server" Text='<%#Eval("FirstName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle Width="18%"/>
<HeaderTemplate>
<asp:LinkButton ID="lnkLastName" runat="server" Text="<%$ Resources:LBShowcaseRes,lblLastName %>" CommandName="Sort" CommandArgument="LastName"></asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblLastName" runat="server" Text='<%#Eval("LastName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle Width="20%"/>
<HeaderTemplate>
<asp:LinkButton ID="lnkEmailId" runat="server" Text="<%$ Resources:LBShowcaseRes,lblEmailid %>" CommandName="Sort" CommandArgument="EmailAddress"></asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblEmailId" runat="server" Text='<%# Eval("EmailAddress") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle Width="15%" />
<HeaderTemplate>
<asp:Label ID="lblUserName" runat="server" Text="<%$ Resources:LBShowcaseRes,lblUserName %>"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="txtUserName" runat="server" Text='<%# Eval("UserName") %>' MaxLength="75" Width="100px" EnableViewState="true"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle Width="10%" />
<HeaderTemplate>
<asp:LinkButton ID="lnkOffice" runat="server" Text="<%$ Resources:LBShowcaseRes,lblOffice %>" CommandName="Sort" CommandArgument="OfficeName"></asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblOffice" runat="server" Text='<%# Eval("OfficeName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle Width="20%" />
<HeaderTemplate>
<asp:Label ID="lblRolePrompt" runat="server" Text="<%$ Resources:LBShowcaseRes,lblRole %>"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:HiddenField ID="hdnRole" runat="server" Value='<%# Eval("RoleName") %>' />
<asp:DropDownList ID="ddlRole" runat="server" AppendDataBoundItems="true">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<div class="table-nav">
<asp:Button ID="btnDelete" runat="server" Text="<%$ Resources:LBShowcaseRes,btnDelete %>" SkinID="leftButton"
OnClientClick="var values= GetSelectedUser();return ConfirmDeleteWithValues('Please select at least one User for deletion.',values);"
onclick="btnDelete_Click" />
<asp:Button ID="btnPrintExport" runat="server" Text="<%$ Resources:LBShowcaseRes,btnPrintRep %>" CausesValidation="false"/>
<asp:Button ID="btnSave" runat="server" OnClientClick="return ConfirmAddUser();"
Text="<%$Resources:LBShowcaseRes,btnSave %>"
onclick="btnSave_Click" />
</div>
<div class="clear">
</div>
</div>
</div>
我的表css是 表{border-collapse:collapse;寬度:100%}Gridview寬度超出邊界bcz內容寬度更大
現在,當我運行該頁面的GridView寬度超出100%bcz的內容寬度是非常大的...所以我想這樣做,它應該在達到寬度後打破內容該列應該怎麼辦PLZ幫我.......
修改 記錄爲選擇的標準是不存在的
<Columns>
<asp:TemplateField>
<ItemStyle Width="20px"/>
<HeaderTemplate>
<asp:Label ID="lblSelect" runat="server" Text="<%$ Resources:LBShowcaseRes,lblSelect %>"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle width="35px"/>
<HeaderTemplate>
<asp:LinkButton ID="lnkFirstName" runat="server" Text="<%$ Resources:LBShowcaseRes,lblFirstName %>" CommandName="Sort" CommandArgument="FirstName"></asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblFirstName" runat="server" Text='<%#Eval("FirstName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle Width="35px"/>
<HeaderTemplate>
<asp:LinkButton ID="lnkLastName" runat="server" Text="<%$ Resources:LBShowcaseRes,lblLastName %>" CommandName="Sort" CommandArgument="LastName"></asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblLastName" runat="server" Text='<%#Eval("LastName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle Width="35px"/>
<HeaderTemplate>
<asp:LinkButton ID="lnkEmailId" runat="server" Text="<%$ Resources:LBShowcaseRes,lblEmailid %>" CommandName="Sort" CommandArgument="EmailAddress"></asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblEmailId" runat="server" Text='<%# Eval("EmailAddress") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle Width="35px" />
<HeaderTemplate>
<asp:Label ID="lblUserName" runat="server" Text="<%$ Resources:LBShowcaseRes,lblUserName %>"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="txtUserName" runat="server" Text='<%# Eval("UserName") %>' MaxLength="75" Width="100px" EnableViewState="true"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle Width="35px" />
<HeaderTemplate>
<asp:LinkButton ID="lnkOffice" runat="server" Text="<%$ Resources:LBShowcaseRes,lblOffice %>" CommandName="Sort" CommandArgument="OfficeName"></asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblOffice" runat="server" Text='<%# Eval("OfficeName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle Width="50px" />
<HeaderTemplate>
<asp:Label ID="lblRolePrompt" runat="server" Text="<%$ Resources:LBShowcaseRes,lblRole %>"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:HiddenField ID="hdnRole" runat="server" Value='<%# Eval("RoleName") %>' />
<asp:DropDownList ID="ddlRole" runat="server" AppendDataBoundItems="true">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<div class="table-nav">
<asp:Button ID="btnDelete" runat="server" Text="<%$ Resources:LBShowcaseRes,btnDelete %>" SkinID="leftButton"
OnClientClick="var values= GetSelectedUser();return ConfirmDeleteWithValues('Please select at least one User for deletion.',values);"
onclick="btnDelete_Click" />
<asp:Button ID="btnPrintExport" runat="server" Text="<%$ Resources:LBShowcaseRes,btnPrintRep %>" CausesValidation="false"/>
<asp:Button ID="btnSave" runat="server" OnClientClick="return ConfirmAddUser();"
Text="<%$Resources:LBShowcaseRes,btnSave %>"
onclick="btnSave_Click" />
</div>
<div class="clear">
</div>
</div>
</div>
哪些內容非常大!!請提及它... – sikender
in gidview lblEmailId content – user993634
@ user993634,你說lblEmailId是最大的,但爲什麼你給了一些其他列的寬度和寬度與lblEmailId相同。將最大寬度僅限於emailid,並減小所有剩餘寬度。 –