- Password TextBox and PostBack
// Refill Password field
this.txtPassword.Attributes.Add("value", this.txtPassword.Text);
- ajax cascadingdown, 只能在放有cascadingdown控件的页面上设置static web method.
或统一指定一个ajax web service取得数据. 如果有多个下拉框的数据需要取得,.
可以使用一个web user control设置dropdownlist/cascadingdown,然后将相应的参数设置为此control的属性,并指定一个固定的web service来返回数据,从而所有相似数据只需要一段DA代码就可以返回这些cascadingdown dropdownlist. 但在取数据的web service method代码中需要能根据不同的页面参数获取不同的数据. 可以WS方法中使用category参数来区别.
- 如果ajax-enabled的页面报如下错误:
ajax: sys.invalidoperationexception: handler was not added through the sys.ui.domevent.addhandler
则在页面的 scriptmanager属性中设置scriptmode=release.
-
reuse web user control or pages
control lib project is a web application project, and after compiling it, there will be just one dll, but the dll can't include aspx define, just code. so u should add a web deploy project.
if the project is web site project, building this project will not generate any dll. u should add a web deploy project to refer it. and build the deploy project to generate one deploy dll
in web deploy project, if "allow this precompiled site to be updateable" option is checked, then pages/controls UI code will be remained, and all code-behind files will be removed.
if not check this option, then all pages just keep one line to prompt there is no UI content, and user control files will be deleted.
so if u want to reuse page, u must check this option, otherwise the remained page can't be reused.
and the user control can be reused in two methods
1. build web user control web project into a single assembly without this option
then there is no web user control files(ascx) remain after build
u can use this dll into another web project by two methods
one is declare the dll's tagprefix, namespace and assembly in web.config, then use its controls like asp.net controls.
two is add the register in each used pages, and declare the user control.
2. if build with this option,
then u can copy the output directory all to another project, and reuse the page or user controls.
-
ref:
http://weblogs.asp.net/scottgu/archive/2005/08/28/423888.aspx
http://webproject.scottgu.com/CSharp/UserControls/Usercontrols.aspx
http://www.codeproject.com/useritems/User_Control_ToCustom_One.asp
PHP migrate to asp.net http://www.asp.net/downloads/archived/migration-assistants/php-to-aspnet/
|
请发表评论