本文介绍了在这段代码中,我想减少第二列和第三列的宽度。我已经尝试了很多东西,但它不起作用...请帮忙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<asp:GridView ID="gvProject" runat="server" AllowSorting="True" Font-Size="Medium" ShowFooter="True" AutoGenerateColumns="False"
               DataKeyNames="ProjectId" DataSourceID="sdsProject" OnSelectedIndexChanged="gvProject_SelectedIndexChanged" OnRowDataBound="gvProject_RowDataBound" OnRowUpdated="gvProject_RowUpdated" AllowPaging="True" OnRowCommand="gvProject_RowCommand" EnableModelValidation="True">
               <Columns>
                   <asp:TemplateField HeaderText="ProjectId" InsertVisible="False" SortExpression="ProjectId"
                       Visible="False">
                       <EditItemTemplate>
                           <asp:Label ID="Label1" runat="server" Text='<%# Eval("ProjectId") %>'></asp:Label>
                       </EditItemTemplate>
                       <ItemTemplate>
                           <asp:Label ID="Label1" runat="server" Text='<%# Bind("ProjectId") %>'></asp:Label>
                       </ItemTemplate>
                   </asp:TemplateField>

                   <asp:TemplateField >
                       <HeaderTemplate>ITWRno</HeaderTemplate>
                       <EditItemTemplate>
                           <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ITWRno") %>'></asp:TextBox>
                       </EditItemTemplate>
                       <ItemTemplate>
                           <asp:Label ID="Label2" runat="server" Text='<%# Bind("ITWRno") %>'></asp:Label>
                       </ItemTemplate>
                       <FooterTemplate>
                           <asp:TextBox ID="txtInsertITWR" runat="server" Text='<%# Bind("ITWRno") %>'></asp:TextBox>
                       </FooterTemplate>
                   </asp:TemplateField>

                   <asp:TemplateField >
                       <HeaderTemplate>ProjectName</HeaderTemplate>
                       <EditItemTemplate>
                           <asp:TextBox ID="txtProjectName" runat="server" TextMode="MultiLine" Text='<%# Bind("ProjectName") %>'></asp:TextBox>
                           <asp:RequiredFieldValidator ID="rfvProjectName" runat="server" ControlToValidate="txtProjectName" ErrorMessage="Please Provide Project Name" Text="Field Can't be blank" Display="Dynamic" ></asp:RequiredFieldValidator>
                       </EditItemTemplate>
                       <ItemTemplate>
                           <asp:Label ID="Label3" runat="server" Text='<%# Bind("ProjectName") %>'></asp:Label>
                       </ItemTemplate>
                       <FooterTemplate>
                           <asp:TextBox ID="txtInsertProjectName" runat="server" Text='<%# Bind("ProjectName") %>'></asp:TextBox>
                       </FooterTemplate>
                   </asp:TemplateField>

推荐答案


<asp:gridview id="GridView1" runat="server" autogeneratecolumns="False" datasourceid="SqlDataSource1">
<columns>
<asp:templatefield>
<itemtemplate>
<asp:label id="Label2" runat="server" text="<%# Bind("ITWRno") %>" width="10px"></asp:label>
</itemtemplate>
<itemstyle width="10px" />
<edititemtemplate>
<asp:textbox id="TextBox1" runat="server" text="<%# Bind("ITWRno") %>" width="10px"></asp:textbox>
</edititemtemplate>
</asp:templatefield>              
</columns>            
<editrowstyle width="10px" />
</asp:gridview>



问候......:笑:


Regards..:laugh:


这篇关于在这段代码中,我想减少第二列和第三列的宽度。我已经尝试了很多东西,但它不起作用...请帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:46