动态控制

编程入门 行业动态 更新时间:2024-10-28 00:19:18
本文介绍了动态控制 - 回发后消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我动态创建了几个网格,并将它们添加到vb Web表单上的不同 HTML占位符中。当网页首次启动时,它们内部的网格和控件 出现并且看得很漂亮,但是当我点击按钮,然后页面返回时,我的动态创建网格和 控件不可见。有什么想法吗?请查看下面的示例代码。 如果不是ispostback那么 creategrids 结束如果 Sub CreateGrids ''上面有很多代码 phInsulation.Controls.Add(MatrixInsul)''phinsulation是占位符 和MatrixInsul是我的网格 phGC.Controls.Add(MatrixGC) phSM.Controls.Add(MatrixSM) phControls.Controls.Add (MatrixControls) phInsulation.EnableViewState = True phGC.EnableViewState = True phSM.EnableViewState = True phControls.EnableViewState = True 结束子 提前感谢您的帮助! Chris Thunell ct******@pierceassociates

I have created several grids dynamically and have added them to different HTML placeholders on a vb web form. The grids and controls within them come up and view beautifully when the web page first starts, but when I click on a button, and the page comes back, my dynamically created grid and controls are not visible. Any thoughts? Please view my sample code below. If Not ispostback then creategrids end if Sub CreateGrids ''lots of code above phInsulation.Controls.Add(MatrixInsul) ''phinsulation is a placeholder and MatrixInsul is my grid phGC.Controls.Add(MatrixGC) phSM.Controls.Add(MatrixSM) phControls.Controls.Add(MatrixControls) phInsulation.EnableViewState = True phGC.EnableViewState = True phSM.EnableViewState = True phControls.EnableViewState = True End Sub Thanks in advance for your help! Chris Thunell ct******@pierceassociates

推荐答案

因为回发表单时没有生成控件(例如,当你点击按钮时,你会发现CreateGrid函数不会产生因此表格 将在没有控件的情况下呈现) Chris Thunell <克拉****** @ pierceassociates>在消息中写道 新闻:eq **************** @ TK2MSFTNGP10.phx.gbl ... Because the controls are not generated when you postback the form (e.g when you click the button the CreateGrid function will not fire thus the form will render without the controls) "Chris Thunell" <ct******@pierceassociates> wrote in message news:eq****************@TK2MSFTNGP10.phx.gbl... 我创建了动态的几个网格,并将它们添加到vb Web表单上的不同HTML占位符。当网页首次启动时,内的网格和控件会出现,并且当我点击一个按钮,然后页面返回时,我动态创建网格和控件不可见。有什么想法吗?请查看下面的示例代码。如果不是ispostback那么 creategrids 结束如果 Sub CreateGrids ''上面有很多代码 phInsulation.Controls.Add(MatrixInsul)''phinsulation是占位符,MatrixInsul是我的网格 phGC.Controls.Add(MatrixGC) phSM.Controls.Add(MatrixSM ) phControls.Controls.Add(MatrixControls) phInsulation.EnableViewState = True phGC.EnableViewState = True phSM.EnableViewState = True phControls.EnableViewState = True End Sub 提前感谢您的帮助! Chris Thunell ct ****** @ pierceassociates I have created several grids dynamically and have added them to different HTML placeholders on a vb web form. The grids and controls within them come up and view beautifully when the web page first starts, but when I click on a button, and the page comes back, my dynamically created grid and controls are not visible. Any thoughts? Please view my sample code below. If Not ispostback then creategrids end if Sub CreateGrids ''lots of code above phInsulation.Controls.Add(MatrixInsul) ''phinsulation is a placeholder and MatrixInsul is my grid phGC.Controls.Add(MatrixGC) phSM.Controls.Add(MatrixSM) phControls.Controls.Add(MatrixControls) phInsulation.EnableViewState = True phGC.EnableViewState = True phSM.EnableViewState = True phControls.EnableViewState = True End Sub Thanks in advance for your help! Chris Thunell ct******@pierceassociates

是 - 您需要每次调用creategrids页面加载的时间 - 不仅仅是第一次 。动态创建的控件不会自动为你重新创建。 " Chris Thunell" <克拉****** @ pierceassociates>在消息中写道 新闻:eq **************** @ TK2MSFTNGP10.phx.gbl ... Yes - you need to call creategrids every time the page loads - not just the first time. Dynamically created controls are not going to automatically be recreated for you. "Chris Thunell" <ct******@pierceassociates> wrote in message news:eq****************@TK2MSFTNGP10.phx.gbl... 我创建了动态的几个网格,并将它们添加到vb Web表单上的不同HTML占位符。当网页首次启动时,内的网格和控件会出现,并且当我点击一个按钮,然后页面返回时,我动态创建网格和控件不可见。有什么想法吗?请查看下面的示例代码。如果不是ispostback那么 creategrids 结束如果 Sub CreateGrids ''上面有很多代码 phInsulation.Controls.Add(MatrixInsul)''phinsulation是占位符,MatrixInsul是我的网格 phGC.Controls.Add(MatrixGC) phSM.Controls.Add(MatrixSM ) phControls.Controls.Add(MatrixControls) phInsulation.EnableViewState = True phGC.EnableViewState = True phSM.EnableViewState = True phControls.EnableViewState = True End Sub 提前感谢您的帮助! Chris Thunell ct ****** @ pierceassociates I have created several grids dynamically and have added them to different HTML placeholders on a vb web form. The grids and controls within them come up and view beautifully when the web page first starts, but when I click on a button, and the page comes back, my dynamically created grid and controls are not visible. Any thoughts? Please view my sample code below. If Not ispostback then creategrids end if Sub CreateGrids ''lots of code above phInsulation.Controls.Add(MatrixInsul) ''phinsulation is a placeholder and MatrixInsul is my grid phGC.Controls.Add(MatrixGC) phSM.Controls.Add(MatrixSM) phControls.Controls.Add(MatrixControls) phInsulation.EnableViewState = True phGC.EnableViewState = True phSM.EnableViewState = True phControls.EnableViewState = True End Sub Thanks in advance for your help! Chris Thunell ct******@pierceassociates

这很简单。它们是第一次生成,但在回发期间 你没有调用CreateGrids函数,因为你告诉它不要用 if if ispostback statement因此,他们不会在随后的电话中创建 。你需要确定在回发期间需要什么不需要b $ b的玩具。可能是在某些按钮点击事件中 你想要在CreateGrids sub中添加一个调用,而在其他人中你不会。 希望这会有所帮助, Mark Fitzpatrick Microsoft MVP - FrontPage " Chris Thunell" <克拉****** @ pierceassociates>在消息中写道 新闻:eq **************** @ TK2MSFTNGP10.phx.gbl ... It''s pretty simple. They''re generated the first time, but during postback you are not calling the CreateGrids function as you''ve told it not to with the if not ispostback statement, thus they aren''t getting created on subsequent calls. You need to toy with the determination of what isn''t required during a postback. It could be that in certain button click events you''ll want to add a call to the CreateGrids sub while in others you won''t. Hope this helps, Mark Fitzpatrick Microsoft MVP - FrontPage "Chris Thunell" <ct******@pierceassociates> wrote in message news:eq****************@TK2MSFTNGP10.phx.gbl... 我创建了动态的几个网格,并将它们添加到vb Web表单上的不同HTML占位符。当网页首次启动时,内的网格和控件会出现,并且当我点击一个按钮,然后页面返回时,我动态创建网格和控件不可见。有什么想法吗?请查看下面的示例代码。如果不是ispostback那么 creategrids 结束如果 Sub CreateGrids ''上面有很多代码 phInsulation.Controls.Add(MatrixInsul)''phinsulation是占位符,MatrixInsul是我的网格 phGC.Controls.Add(MatrixGC) phSM.Controls.Add(MatrixSM ) phControls.Controls.Add(MatrixControls) phInsulation.EnableViewState = True phGC.EnableViewState = True phSM.EnableViewState = True phControls.EnableViewState = True End Sub 提前感谢您的帮助! Chris Thunell ct ****** @ pierceassociates I have created several grids dynamically and have added them to different HTML placeholders on a vb web form. The grids and controls within them come up and view beautifully when the web page first starts, but when I click on a button, and the page comes back, my dynamically created grid and controls are not visible. Any thoughts? Please view my sample code below. If Not ispostback then creategrids end if Sub CreateGrids ''lots of code above phInsulation.Controls.Add(MatrixInsul) ''phinsulation is a placeholder and MatrixInsul is my grid phGC.Controls.Add(MatrixGC) phSM.Controls.Add(MatrixSM) phControls.Controls.Add(MatrixControls) phInsulation.EnableViewState = True phGC.EnableViewState = True phSM.EnableViewState = True phControls.EnableViewState = True End Sub Thanks in advance for your help! Chris Thunell ct******@pierceassociates

更多推荐

动态控制

本文发布于:2023-10-12 20:43:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1485845.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:动态

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!