在这段代码中,我想减少第二列和第三列的宽度。我已经尝试了很多东西,但它不起作用...请帮忙 [英] In this code i want to reduce the width of the 2nd and 3 rd column..i have tried many things but its not working...pls help

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

问题描述

<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>

推荐答案

通过选择网格视图中的列来检查gridview中的width属性选择第二个中的字段在列的宽度
check the width property in gridview by choosing the column that is in grid view tasks choose fields in that the second last in the width of the column


[注意:] 在gridview上添加编辑行样式/页脚样式。我试了很多。即使在更新答案后它也没有显示。

好​​吧,已经提供了一些建议,但我认为你仍然没有得到解决方案。请参考下面的代码,它肯定会有效。

[NOTE:]Add edit rowstyle/footer style also at gridview. I have tried alot. Its not being displayed even after updating answer.
Well,some suggestions have already been provided to you but i think you still didnt get the solution. Refer below code,it will surely work.
<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:


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

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆