gridview 怎么改变它的大小啊

ruanwei1987 2009-08-19 11:54:59
我修改一个gridview 无论怎么拖动都改变不了它的大小,我想让它整体高度变大,就是不需要滑动条就能把10个数据全部显示出来,来个高人速度给我明示,小弟不胜感激,谢谢了
...全文
259 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
xyunsh 2009-08-19
  • 打赏
  • 举报
回复
你这个似乎不是gridview的问题,而是gridview外面元素的样式设置问题吧
Adechen 2009-08-19
  • 打赏
  • 举报
回复
估计事你把gridview放在div这样的容器了,div的高度不高
ruanwei1987 2009-08-19
  • 打赏
  • 举报
回复
默认是有滚动跳的 只是滚动跳内有7条数据,下面三条显示不出来,我现在想把10条直接显示出来 不要滚动条,另外用的不是gridview 而是smartgridview
大家看看有没办法,上面说的好像不行,谢谢了,不行的话我贴源码出来
ruanwei1987 2009-08-19
  • 打赏
  • 举报
回复
默认是有滚动跳的 只是滚动跳内有7条数据,下面三条显示不出来,我现在想把10条直接显示出来 不要滚动条,另外用的不是gridview 而是smartgridview
大家看看有没办法,上面说的好像不行,谢谢了,不行的话我贴源码出来
panliuwen 2009-08-19
  • 打赏
  • 举报
回复
gridview有width属性的,直接使用width=“80%”,就可以了,我经常用啊
shinlgienls 2009-08-19
  • 打赏
  • 举报
回复
    <asp:TemplateColumn HeaderText="<nobr>人数</nobr>">
<HeaderStyle HorizontalAlign="Center" Width="40px"></HeaderStyle>


设置高度
plglenn 2009-08-19
  • 打赏
  • 举报
回复
设置属性吧,heigt
46539492 2009-08-19
  • 打赏
  • 举报
回复
默认是没有滚动条的吧,不知道楼主你的gridview是怎么操作的
xiezechang 2009-08-19
  • 打赏
  • 举报
回复
cssclass="abc"


head处加
<script>
.abc
{
height:100%;
}
</script>
ivws_19 2009-08-19
  • 打赏
  • 举报
回复
设定PageSize属性为10,再把allowpaging设为true
xiezechang 2009-08-19
  • 打赏
  • 举报
回复
加个pagesize
ruanwei1987 2009-08-19
  • 打赏
  • 举报
回复
郁闷 ,是一个tablehight 设置,半天没找到,谢谢楼上各位 没人都有分
flyerwing 2009-08-19
  • 打赏
  • 举报
回复
Width="100%"
试下!
ruanwei1987 2009-08-19
  • 打赏
  • 举报
回复
[Quote=引用 16 楼 winscar 的回复:]
gridview的整体不要设置高度,只要在内部编辑列的时候设置高度,这些都有可视化设置。
如果gridview整体设置了高度,那么那个高度就是一定的,一页中数据不够时,那些数据条就会被拉大,那样很难看。

宽度也是相同的道理。

[/Quote]


=============================
关键是我现在想把它变大点,不然太小了 不好看
WInScar 2009-08-19
  • 打赏
  • 举报
回复
gridview的整体不要设置高度,只要在内部编辑列的时候设置高度,这些都有可视化设置。
如果gridview整体设置了高度,那么那个高度就是一定的,一页中数据不够时,那些数据条就会被拉大,那样很难看。

宽度也是相同的道理。
ruanwei1987 2009-08-19
  • 打赏
  • 举报
回复
  <QCustom:SmartGridView ID="gvZyl29" runat="server" AutoGenerateColumns="False"
CssClassMouseOver="OverRow" PagingStyle="Default"
OnRowDataBound="gvZyl29_RowDataBound" GridLines="Horizontal"
ShowFooter="True" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None"
BorderWidth="1px" CellPadding="2"
style="top: 0px; left: 0px; width:1000px">
<FooterStyle HorizontalAlign="Center" BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<Columns>
<asp:TemplateField>
<headertemplate>
<asp:checkbox id="chkAll" runat="server" />

</headertemplate>
<footertemplate>
<asp:Image id="Image1" runat="server" ImageUrl="~/Web/Images/sap/pluginResultSuccessful.gif" ToolTip="Select"></asp:Image>

</footertemplate>
<itemstyle width="10px" />
<itemtemplate>
<asp:checkbox id="chkItem" runat="server" />

</itemtemplate>
</asp:TemplateField>
<asp:BoundField DataField="MANDT" HeaderText="Client" />
<asp:BoundField DataField="MATNR" HeaderText="Material" />
<asp:BoundField DataField="MATKL" HeaderText="Mat.Grp" Visible="False" >
<itemstyle forecolor="Red" horizontalalign="Center"/>
</asp:BoundField>
<asp:BoundField DataField="MTYPE" HeaderText="MType" />
<asp:TemplateField HeaderText="Description">
<itemstyle wrap="False" horizontalalign="Left" />
<headerstyle wrap="False" />
<itemtemplate>
  <asp:Label id="Label1" runat="server" Text=' <%# Bind("MAKTX") %>'></asp:Label>

</itemtemplate>
</asp:TemplateField>
<asp:BoundField DataField="E_I" HeaderText="E/I" />
<asp:TemplateField HeaderText="Item">
<footertemplate>
<asp:Image id="Image2" runat="server" ImageUrl="~/Web/Images/sap/bicobjdatasourcetextsmasterdata.gif" ToolTip="Item"></asp:Image>

</footertemplate>
<itemstyle wrap="False" />
<headerstyle wrap="False" />
<itemtemplate>

<asp:TextBox ID="tbZitem" runat="server" Text='<%# Bind("DECLITEM") %>' Width="50px" BackColor="#FFE0C0" Font-Bold="True" ForeColor="Black"></asp:TextBox>
<asp:Image ID="imgZitem" runat="server" ImageUrl="~/Web/Images/sap/s_bgmore.gif" />

</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="H.S.Code">
<itemtemplate>
<asp:TextBox id="tbZtax_code" runat="server" Text='<%# Bind("TAX_CODE") %>' Width="90px" BorderWidth="0px" BorderStyle="None" ></asp:TextBox>

</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Class">
<itemtemplate>
<asp:TextBox ID="tbZclass" runat="server" Text='<%# Bind("CLASS") %>' Width="80px" BorderWidth="0px" BorderStyle="None"></asp:TextBox>

</itemtemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="BUNIT">
<EditItemTemplate>
 

</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="tbZGEWEI" runat="server" Text='<%# Bind("ZGEWEI") %>' Width="40px" BorderWidth="0px" BorderStyle="None" ReadOnly="true"></asp:TextBox>

</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description">
<itemstyle wrap="False" />
<headerstyle wrap="False" />
<itemtemplate>
<asp:TextBox ID="tbZsmaktx" runat="server" Text='<%# Bind("SMAKTX") %>' Width="120px" BorderWidth="0px" BorderStyle="None"></asp:TextBox>

</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Plus">
<footertemplate>
<asp:Image id="Image6" runat="server" ImageUrl="~/Web/Images/sap/bicobjdatasourcetextsmasterdata.gif" ToolTip="Plus"></asp:Image>

</footertemplate>
<ItemTemplate>

<asp:TextBox ID="tbZplus" runat="server" Text='<%# Bind("PLUS") %>' Width="10px" BorderWidth="0px" BackColor="#FFE0C0"></asp:TextBox>

</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Declare norm">
<footertemplate>
<asp:Image id="Image30" runat="server" ImageUrl="~/Web/Images/sap/bicobjdatasourcetextsmasterdata.gif" ToolTip="Note"></asp:Image>

</footertemplate>
<itemtemplate>
<asp:TextBox ID="tbZnote0" runat="server" Text='<%# Bind("NORM") %>' Width="100px" BorderWidth="0px" BackColor="LightYellow"></asp:TextBox>

</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Note">
<footertemplate>
<asp:Image id="Image3" runat="server" ImageUrl="~/Web/Images/sap/bicobjdatasourcetextsmasterdata.gif" ToolTip="Note"></asp:Image>

</footertemplate>
<itemtemplate>
<asp:TextBox ID="tbZnote" runat="server" Text='<%# Bind("NOTE") %>' Width="100px" BorderWidth="0px" BackColor="LightYellow"></asp:TextBox>

</itemtemplate>
</asp:TemplateField>





<asp:TemplateField HeaderText="Model">
<footertemplate>
<asp:Image id="Image4" runat="server" ImageUrl="~/Web/Images/sap/bicobjdatasourcetextsmasterdata.gif" ToolTip="Model"></asp:Image>

</footertemplate>
<itemtemplate>
<asp:TextBox ID="tbZmodel" runat="server" Text='<%# Bind("Model") %>' Width="100px" BorderWidth="0px" BackColor="#FFE0C0"></asp:TextBox>

</itemtemplate>
</asp:TemplateField>
<asp:TemplateField>
<itemstyle cssclass="hidden" />
<headerstyle cssclass="hidden" />
<itemtemplate>

</itemtemplate>
<footerstyle cssclass="hidden" />
</asp:TemplateField>
</Columns>
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<FixRowCol FixColumnIndices="0,1,2" IsFixHeader="True" IsFixPager="True" TableHeight="250px"
TableWidth="1000px" EnableScrollState="True" />
<CheckboxAlls>
<QCustom:CheckboxAll CheckboxAllID="chkAll" CheckboxItemID="chkItem" />
</CheckboxAlls>
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<SortTip SortAscImage="~/Images/asc.gif" SortDescImage="~/Images/desc.gif" SortAscText="" SortDescText="" />
<ChangeRowCSSByCheckBox CheckBoxID="chkItem" CssClassRowSelected="SelectedRow" />
<AlternatingRowStyle BackColor="#F7F7F7" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
</QCustom:SmartGridView>





-------------------------------------------------------------------------
大家看下源码,外面甚至连DIV TABLE 都没有 怎么回事 大虾帮下
ruanwei1987 2009-08-19
  • 打赏
  • 举报
回复
  <QCustom:SmartGridView ID="gvZyl29" runat="server" AutoGenerateColumns="False"
CssClassMouseOver="OverRow" PagingStyle="Default"
OnRowDataBound="gvZyl29_RowDataBound" GridLines="Horizontal"
ShowFooter="True" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None"
BorderWidth="1px" CellPadding="2"
style="top: 0px; left: 0px; width:1000px">
<FooterStyle HorizontalAlign="Center" BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<Columns>
<asp:TemplateField>
<headertemplate>
<asp:checkbox id="chkAll" runat="server" />

</headertemplate>
<footertemplate>
<asp:Image id="Image1" runat="server" ImageUrl="~/Web/Images/sap/pluginResultSuccessful.gif" ToolTip="Select"></asp:Image>

</footertemplate>
<itemstyle width="10px" />
<itemtemplate>
<asp:checkbox id="chkItem" runat="server" />

</itemtemplate>
</asp:TemplateField>
<asp:BoundField DataField="MANDT" HeaderText="Client" />
<asp:BoundField DataField="MATNR" HeaderText="Material" />
<asp:BoundField DataField="MATKL" HeaderText="Mat.Grp" Visible="False" >
<itemstyle forecolor="Red" horizontalalign="Center"/>
</asp:BoundField>
<asp:BoundField DataField="MTYPE" HeaderText="MType" />
<asp:TemplateField HeaderText="Description">
<itemstyle wrap="False" horizontalalign="Left" />
<headerstyle wrap="False" />
<itemtemplate>
  <asp:Label id="Label1" runat="server" Text=' <%# Bind("MAKTX") %>'></asp:Label>

</itemtemplate>
</asp:TemplateField>
<asp:BoundField DataField="E_I" HeaderText="E/I" />
<asp:TemplateField HeaderText="Item">
<footertemplate>
<asp:Image id="Image2" runat="server" ImageUrl="~/Web/Images/sap/bicobjdatasourcetextsmasterdata.gif" ToolTip="Item"></asp:Image>

</footertemplate>
<itemstyle wrap="False" />
<headerstyle wrap="False" />
<itemtemplate>

<asp:TextBox ID="tbZitem" runat="server" Text='<%# Bind("DECLITEM") %>' Width="50px" BackColor="#FFE0C0" Font-Bold="True" ForeColor="Black"></asp:TextBox>
<asp:Image ID="imgZitem" runat="server" ImageUrl="~/Web/Images/sap/s_bgmore.gif" />

</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="H.S.Code">
<itemtemplate>
<asp:TextBox id="tbZtax_code" runat="server" Text='<%# Bind("TAX_CODE") %>' Width="90px" BorderWidth="0px" BorderStyle="None" ></asp:TextBox>

</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Class">
<itemtemplate>
<asp:TextBox ID="tbZclass" runat="server" Text='<%# Bind("CLASS") %>' Width="80px" BorderWidth="0px" BorderStyle="None"></asp:TextBox>

</itemtemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="BUNIT">
<EditItemTemplate>
 

</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="tbZGEWEI" runat="server" Text='<%# Bind("ZGEWEI") %>' Width="40px" BorderWidth="0px" BorderStyle="None" ReadOnly="true"></asp:TextBox>

</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description">
<itemstyle wrap="False" />
<headerstyle wrap="False" />
<itemtemplate>
<asp:TextBox ID="tbZsmaktx" runat="server" Text='<%# Bind("SMAKTX") %>' Width="120px" BorderWidth="0px" BorderStyle="None"></asp:TextBox>

</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Plus">
<footertemplate>
<asp:Image id="Image6" runat="server" ImageUrl="~/Web/Images/sap/bicobjdatasourcetextsmasterdata.gif" ToolTip="Plus"></asp:Image>

</footertemplate>
<ItemTemplate>

<asp:TextBox ID="tbZplus" runat="server" Text='<%# Bind("PLUS") %>' Width="10px" BorderWidth="0px" BackColor="#FFE0C0"></asp:TextBox>

</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Declare norm">
<footertemplate>
<asp:Image id="Image30" runat="server" ImageUrl="~/Web/Images/sap/bicobjdatasourcetextsmasterdata.gif" ToolTip="Note"></asp:Image>

</footertemplate>
<itemtemplate>
<asp:TextBox ID="tbZnote0" runat="server" Text='<%# Bind("NORM") %>' Width="100px" BorderWidth="0px" BackColor="LightYellow"></asp:TextBox>

</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Note">
<footertemplate>
<asp:Image id="Image3" runat="server" ImageUrl="~/Web/Images/sap/bicobjdatasourcetextsmasterdata.gif" ToolTip="Note"></asp:Image>

</footertemplate>
<itemtemplate>
<asp:TextBox ID="tbZnote" runat="server" Text='<%# Bind("NOTE") %>' Width="100px" BorderWidth="0px" BackColor="LightYellow"></asp:TextBox>

</itemtemplate>
</asp:TemplateField>





<asp:TemplateField HeaderText="Model">
<footertemplate>
<asp:Image id="Image4" runat="server" ImageUrl="~/Web/Images/sap/bicobjdatasourcetextsmasterdata.gif" ToolTip="Model"></asp:Image>

</footertemplate>
<itemtemplate>
<asp:TextBox ID="tbZmodel" runat="server" Text='<%# Bind("Model") %>' Width="100px" BorderWidth="0px" BackColor="#FFE0C0"></asp:TextBox>

</itemtemplate>
</asp:TemplateField>
<asp:TemplateField>
<itemstyle cssclass="hidden" />
<headerstyle cssclass="hidden" />
<itemtemplate>

</itemtemplate>
<footerstyle cssclass="hidden" />
</asp:TemplateField>
</Columns>
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<FixRowCol FixColumnIndices="0,1,2" IsFixHeader="True" IsFixPager="True" TableHeight="250px"
TableWidth="1000px" EnableScrollState="True" />
<CheckboxAlls>
<QCustom:CheckboxAll CheckboxAllID="chkAll" CheckboxItemID="chkItem" />
</CheckboxAlls>
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<SortTip SortAscImage="~/Images/asc.gif" SortDescImage="~/Images/desc.gif" SortAscText="" SortDescText="" />
<ChangeRowCSSByCheckBox CheckBoxID="chkItem" CssClassRowSelected="SelectedRow" />
<AlternatingRowStyle BackColor="#F7F7F7" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
</QCustom:SmartGridView>





-------------------------------------------------------------------------
大家看下源码,外面甚至连DIV TABLE 都没有 怎么回事 大虾帮下
ruanwei1987 2009-08-19
  • 打赏
  • 举报
回复
为什么gridview 缩小也不能呢?放大也不能?是不是哪个地方设置了?这个不是我建的 ,我在修改
zuoming120 2009-08-19
  • 打赏
  • 举报
回复
顶 ,可以自己写样式的

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧