[ASP.NET]后台枚举空间
在后台用C#枚举控件不像javascript那么简单,HasControls只能抓到直属下级的控件,如果有多个div,table嵌套,就要递归了
public static void CloseAllContent(System.Web.UI.Control page,bool bOpen)
{
int nPageControls = page.Controls.Count;
for (int i = 0; i < nPageControls; i++)
{
foreach (System.Web.UI.Control control in page.Controls[i].Controls)
{
if (control.HasControls())
{
CloseAllContent(control,bOpen);
}
else
{
if (control is TextBox)
{
// (control as TextBox).Text = "";
(control as TextBox).Enabled = bOpen;
&nb
相关文档:
本文通过一段完整的代码向读者介绍复合自定义控件的制作,包括:自定义属性、事件处理、控件间数据传递等方面的技术。
以下是一个登陆框的代码,包括:用户名输入TextBox、密码输入TextBox、提交Button、重置Button以及承载以上四项的Panel。控件类名为LoginCtrl。
(例程使用C#)
using System;
using System.Web.UI;
......
第一:
private void Button1_Click( object sender, System.EventArgs e ) { Response.Redirect( Request.Url.ToString( ) ); } 第二:
private void Button2_Click( object sender, System.EventArgs e ) { Response.Write( " < script language=javascript>window.location.href=document.URL; < /script&g ......
1. 数据库访问性能优化
数据库的连接和关闭
访问数据库资源需要创建连接、打开连接和关闭连接几个操作。这些过程需要多次与数据库交换信息以通过身份验证,比较耗费服务器资源。 ASP.NET中提供了连接池(Connection Pool)改善打开和关闭数据库对性能的影响。系统将用户的数据库连接放在连接池中,需要时取出,关闭时 ......
Internet 类
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading;
namespace DownData
{
class internet
{
&nb ......
http://www.cnblogs.com/chsword/archive/2008/03/10/dotnetmvcframework.html
以下文章属于ASP.NET MVC 1.0 正式版
ASP.NET MVC雕虫小技 1-2
ASP.NET MVC 重点教程一周年版 第十一回 母版页、用户自定义控件及文件上传
ASP.NET MVC 重点教程一周年版 第十回 请求Controller
ASP.NET MVC 重点教程一周年版 第九回 H ......