帖子之后ASP.NET自定义服务器控件不保留值回 [英] ASP.NET custom server control not retaining values after post back

查看:139
本文介绍了帖子之后ASP.NET自定义服务器控件不保留值回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义服务器控件(复合控件有动态创建的下拉框和文本框)。我已启用AJAX,以避免页面reload.The服务器控件其具有控制服务器控制的知名度几个按钮的ASP.NET夏精内部使用。现在,我请在下拉框中的值和texboxes并单击任何其他按钮。这回发后,最后输入的值都不见了!控制是不是想起了值。谁能帮我?我怎样才能回发后保留的价值?

I have a custom server control (composite control having dynamically created dropdown boxes and textboxes). I have enabled AJAX in order to avoid page reload.The server control is used inside the ASP.NET webcontrol having few buttons which controls the visibility of the server control. Now I enter values in the dropdown box and texboxes and click on any other button. After this postback the last entered values are gone! The control is not remembering the values. Can anyone help me? How can I retain the values after post back?

推荐答案

确保控制是每次回发后给予完全相同的ID。你可能也想尝试Page_Init如果可能的话在初始化动态控制(的DropDownList和TextBox)。

Ensure that the controls are given the exact same ID after each postback. Also you might want to try initialising your dynamic controls (DropDownList and TextBox) during Page_Init if possible.

这篇关于帖子之后ASP.NET自定义服务器控件不保留值回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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