在 asp.net 中运行时设置网格视图的位置

发布于 2024-09-27 06:46:26 字数 88 浏览 0 评论 0原文

我想在页面加载时在中心显示一个网格 当我单击网格上的选择按钮时,它应该移动到页面右侧...

目前,我正在使用 2 个网格将其显示在中心和右侧...

I want to show a grid in center on pageload
and when I click on select button on grid it should shift to right of page....

Currently, I am using 2 grid's to show it on center and on right...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

嘿嘿嘿 2024-10-04 06:46:26

要从服务器端更改位置:

如果 DIV 或任何其他 HTML 标记中存在网格,则添加 runat="sever" ,然后在按下按钮后访问该 div 的样式属性和样式属性。获取左、右、上或任何其他位置属性,将所需位置分配给该属性&更新该 div 所在的 updatepanel。

<Markup>
<asp:updatepanel id="up1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="griddiv" runat="server">
<asp:grid id="maingrid" runat="server"/>
</div>
</ContentTemplate>
</asp:updatepane>


protected void btn_Click(object sender,Eventargs es)
{

griddiv.style.attribute("top","new pos");
//This is done as a precaution
maingrid.DataSource = datatable;
maingrid.Rebind();
up1.Update();
}

To change position from server side:

if grid is present in DIV or any other HTML tag add runat="sever" to that then after button is pressed access the style property of that div & get the Left or Right or Top or any other position-attribute assign the desired position to that attribute & update the updatepanel in which that div is present.

<Markup>
<asp:updatepanel id="up1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="griddiv" runat="server">
<asp:grid id="maingrid" runat="server"/>
</div>
</ContentTemplate>
</asp:updatepane>


protected void btn_Click(object sender,Eventargs es)
{

griddiv.style.attribute("top","new pos");
//This is done as a precaution
maingrid.DataSource = datatable;
maingrid.Rebind();
up1.Update();
}
无语# 2024-10-04 06:46:26

如果 div 中存在网格,则给出 id 和属性 runat=server
然后在选择按钮上给出这个编码......
griddiv.Style.Add("浮动","右");

if grid is present in div give id and property runat=server
then on select button give this coding...
griddiv.Style.Add("float","right");

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文