ASP.net preINIT()VS的init() [英] ASP.net PreInit() Vs Init()

查看:81
本文介绍了ASP.net preINIT()VS的init()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从本地论坛上,我明白,preINIT可以用来处理以下

From local forum i understood that PreInit can be used to handle the following

PreInit()
>Master pages can be called dynamically
>Themes can be set dynamically
>Programatically add controls to controls collection

和我读的init()是

and i read Init() is for

Init()

在此事件中,我们可以读出控件的属性(在设计时设置)。 我们不能读取的控制值被用户修改,因为修改后的值会的LoadPostData()事件触发后得到加载。

In this event, we can read the controls properties (set at design time). We cannot read control values changed by the user because that changed value will get loaded after LoadPostData() event fires.

我没有得到一点:我们无法读取用户更改控制值。凡做
用户更改控件的值?。例将有助于我理解这一点。

I am not getting the point "We cannot read control values changed by the user".Where do users change the value of control?.Example would help me to understand the point.

推荐答案

比方说你有一个文本框,一个DropDownList,一些复选框...用户将数据输入到他们,你想通过写

Lets say you have a textbox, a dropdownlist, some check boxes... the user enters data into them and you want to read their values by writing

var text = myTextBox.Text;
var selectedItem = ddl.SelectedItem;

这你不能在的LoadPostData 方法被调用前后做。

this you cannot do before after the LoadPostData method has been called.

本页面提供了不同事件的pretty很好的总结,他们应该被用于的 http://msdn.microsoft.com/en-us/library/ms178472.aspx 。它说, preINIT 应使用IE浏览器。创建动态控件和初始化为他们设置属性。

This page gives a pretty good summary of the different events and what they should be used for http://msdn.microsoft.com/en-us/library/ms178472.aspx. It says that PreInit should be used for ie. creating dynamic controls and Init for setting properties on them.

这篇关于ASP.net preINIT()VS的init()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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