回发问题 [英] Post Back issue..

查看:66
本文介绍了回发问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于所有在这方面的高手,您好,我只是C#技术的新手和.NET框架的新手.

我已经在C#背后的代码上创建了一个动态控件,并且运行良好.但是当
单击按钮后面的C#代码中动态生成的按钮,该命令按钮处理回发,所有动态创建的控件都变为空...
我不知道这是什么问题..


我在page_load:
中调用了该函数

所以请大家帮我解决我的问题.


Mico

[Edited] ASP.net被添加到标签中[/Edited]

Hello to all masters out there, I am just a new to the C# technology and new to .NET framework.

I have created a dynamic controls on the code behind of C#, and it is working well. But when
Click the button the one that is generated dynamically in the C# code behind, The command button process the post back, all the controls that are created dynamically was become empty...
I don''t know what''s the problem with that..


I Called the function in the page_load:


So please Guys help me with my problem.


Mico

ASP.net is added in Tags[/Edited]

推荐答案

您需要使用ViewState来确保控件通过PostBack保存.无论是在这里还是通过Google,都有许多关于此主题的优秀教程.
You need to use ViewState to ensure that the controls are preserved through the PostBack. There are a number of good tutorials on this subject both here and via Google. Leave it to you to do your own research.


添加到Viewstate,您需要在回发期间再次重新创建动态控件,以使它们可用并且相关的数据/事件可用.
Adding to Viewstate, you would need to re-create the dynamic controls again during the postback such that they are available and related data/events are maintained.


那是做到这一点的最佳方法是什么..,
因为每次我单击按钮时,我创建的所有控件
动态地将变得不可见..,

有任何线索..?
So what is the best way to do that..,
Because every time i click the button all the controls that i''ve created
dynamically will become invisible..,

Any clue..?


这篇关于回发问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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