将数据源添加到Gridview后,Gridview大小会发生变化吗? [英] Gridview size changes after adding datasource to Gridview ?

查看:76
本文介绍了将数据源添加到Gridview后,Gridview大小会发生变化吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何保持添加到gridview的任何行之前和之后的大小?

这里Gridview的代码

How do I keep the size as it is before and after any row added to the gridview?
Here code for Gridview

<asp:GridView ID="GridViewMBOFuncObjDetalis" runat="server"  DataKeyNames="id" AutoGenerateColumns="false"

                                 Style="margin-left:10px;margin-right:10px; text-align: left" Width="946px" 

ShowFooter="true"   >
     <columns>
         <asp:BoundField DataField="MBO_Objective"    HeaderText="Function related objectives" />
         <asp:BoundField DataField="MBO_Measured_Var" HeaderText="Measured variable" />
         <asp:BoundField DataField="MBO_Target_Date" HeaderText="Target Date" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10px" >
           <itemstyle horizontalalign="Center" width="10px" />
          
         <asp:BoundField DataField="MBO_Weighting_Factor_Emp"  HeaderText="Weighting Factor" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="60px" >
          <itemstyle horizontalalign="Center" width="60px" />
          
         <asp:TemplateField ItemStyle-HorizontalAlign ="Center" FooterStyle-HorizontalAlign="Center" >
           <itemtemplate>
         <asp:ImageButton ID="imgbtnEdit"  runat="server" height="16px" Width="16px" ToolTip="Edit" ImageUrl="~/Images/Edit.jpg" onclick="imgbtnEdit_Click" />
           </itemtemplate>
        <footerstyle horizontalalign="Center" />
        <itemstyle horizontalalign="Center" />
                                 

 <asp:TemplateField ItemStyle-HorizontalAlign ="Center" FooterStyle-HorizontalAlign="Center" >
     <itemtemplate>
  <asp:ImageButton ID="imgbtnDelete" runat="server" CommandName ="Delete" height="16px" Width="16px" CommandArgument = '<%# Eval("id")%>' 

                                 OnClientClick = "return confirm('Do you want to delete?')"

                                Text = "Delete" ToolTip="Delete" ImageUrl="~/Images/Delete.png" onclick="DeleteFuncObjDetails"/>

  </itemtemplate>
  <footertemplate>
             <asp:ImageButton ID="imgbtnAdd" runat="server" CommandName="Add" height="16px" Width="16px" ToolTip="Add" ImageUrl="~/Images/Add.jpg" onclick="imgbtnAdd_Click" />
         </footertemplate>
  <footerstyle horizontalalign="Center" />
  <HeaderStyle Wrap="False" />
  <itemstyle horizontalalign="Center" />
  
</columns>
<alternatingrowstyle backcolor="#DBEED5" />
<HeaderStyle BackColor="#81C26D" />
<rowstyle bordercolor="Black" borderstyle="Dotted" borderwidth="1px" />









添加标签。

[/编辑]

推荐答案

您已经定义了列大小,除非它将延伸到最大值数据长度
you have define the column size unless it will stretch to maximum value data length


您好,Ni!E


H_UPDATED,



< asp:gridview id =GridViewMBOFuncObjDetalisrunat =serverdatakeynames =idautogeneratecolumns =falsexmlns:asp =#unknown>

Style =margin-left:10px; margin-right:10px; text-align:left Width =100%

ShowFooter =true>





只需更改gridview WIDTH属性,%gridivew将不会更改。



如果我知道是否你有任何进一步的询问。



请通过以上建议。



如果是你的答案,请标记为解决方案。



寻求狩猎解决方案的好运。



谢谢。



问候,



Manoj Kalla
H_UPDATED,

<asp:gridview id="GridViewMBOFuncObjDetalis" runat="server" datakeynames="id" autogeneratecolumns="false" xmlns:asp="#unknown">
Style="margin-left:10px;margin-right:10px; text-align: left" Width="100%"
ShowFooter="true" >


Just change gridview WIDTH property with % your gridivew won't be change.

Let me know if you have any further query.

Please, go through above suggestion.

If its your answer, please mark as solution.

Best of luck for hunting solutions.

Thank you.

Regards,

Manoj Kalla


这篇关于将数据源添加到Gridview后,Gridview大小会发生变化吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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