文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > 工程科技 > 建筑/土木 > 最容易使用的验证码控件(附代码)
侵权投诉

最容易使用的验证码控件(附代码)

最容易使用的验证码控件(附代码)

//这里使用的 findcontrol + 类型强制转换 是否是最优方法呢?

get

{

System.Web.UI.Control c = this.Page.FindControl(this.control_for_user_type_id); try

{

System.Type t = c.GetType();

System.Web.UI.WebControls.TextBox textbox = c as System.Web.UI.WebControls.TextBox;

if (textbox != null)

return textbox.Text;

System.Web.UI.HtmlControls.HtmlInputText inputtext = c as System.Web.UI.HtmlControls.HtmlInputText;

if (inputtext != null)

return inputtext.Value;

System.Web.UI.HtmlControls.HtmlInputPassword pwd = c as System.Web.UI.HtmlControls.HtmlInputPassword;

if (pwd != null)

return pwd.Value;

System.Web.UI.HtmlControls.HtmlTextArea textarea = c as System.Web.UI.HtmlControls.HtmlTextArea;

if (textarea != null)

return textarea.Value;

throw new Gugu.CheckBotComponent.CheckBotException

("从\"" + this.UniqueID + "\"的\"ControlForUserType\"属性指定的控件\"" + this.control_for_user_type_id + "\"无法获取用户输入的验证码。");

//Control 'Image1' referenced by the ControlToValidate property of 'RequiredFieldValidator1' cannot be validated.

}

catch (System.NullReferenceException)

//System.NullReferenceException 在 [System.Type t = c.GetType()] 语句在 [c == null] 时触发。当 c = Page.FindControl(id) 没有找到控件时返回 null

{

if (this.control_for_user_type_id == null || this.control_for_user_type_id == System.String.Empty)

throw new Gugu.CheckBotComponent.CheckBotException ("\"" + this.UniqueID + "\"的\"ControlForUserType\"属性不能为空。");

//The ControlToValidate property of 'RequiredFieldValidator1' cannot be blank. else

throw new Gugu.CheckBotComponent.CheckBotException

("无法为\"" + this.UniqueID + "\"的\"ControlForUserType\"属性找到ID为\"" + this.control_for_user_type_id + "\"的控件。");

//Unable to find control id '1111' referenced by the 'ControlToValidate' property of 'RequiredFieldValidator1'.

上一页第14页

热门文档

相关文档

  • 验证码控件使用方法

    验证码控件使用方法_计算机软件及应用_IT/计算机_专业...页面的点击事件会触发验证,无需后台代码验证 一、...最容易使用的验证码控件... 38页 免费 验证码使用...

  • ASP.NET验证码控件(附详细用法)

    ASP.NET验证码控件(附详细用法)_理学_高等教育_教育专区。很实用的 .net 验证码控件 代码 大家看看验证码控件(附详细用法) 共享一款 ASP.NET 验证码控件(附详细...

  • 验证控件使用

    在控件中,这些控件创 建了针对特定浏览器的代码,...最容易使用的验证码控件... 38页 免费 最容易使用...实验二 - 服务器控件及内... 6页 免费 5第五章...

  • 验证码插件使用教程

    Web 页面: Html 代码 1 2 3 4 <asp:Button ID...ASP.NET验证码控件(附详... 10页 免费 ...最容易使用的验证码控件... 38页 免费 最容易使用...

  • 最新发布,验证码控件,绝对原创

    最新发布,验证码控件,绝对原创_其它考试_资格考试/认证_教育专区。今日推荐 180份文档 2014证券从业资格考试 2014证券资格证券交易高分突破试卷及答案 2014年证券考试...

  • .net中验证控件

    .net中验证控件_计算机软件及应用_IT/计算机_专业资料。自带的验证控件及使用方法...你可以自己容易构造验证方式,我们先来 看看标准代码: <ASP:RegularExpression...

  • 第10章[验证控件和正则表达式]理论课

    第10章[验证控件和正则表达式]理论课_计算机软件及应用_IT/计算机_专业资料。验证...或者VBScript来实现验证,需要编写大量的JavaScript代码, 使 用非常不方便;但是ASP...

  • 验证控件

    输入验证控件 验证控件 5.4.1 5.4.2 5.4.3 5.4.4 验证控件及其作用 验证控件的公有成员 验证控件的用法 禁用数据验证 1 验证控件及其作用 ASP.NET验证...

  • 项目四应用验证控件

    代码如下: 页面加载时执行的事件过程代码如下: 页面加载时执行的事件过程代码如下...性进行比较验证,使用必须项验证控件 (RequiredFieldValidator)设置用户名及密码为...

  • 计算机动态网络第四章验证控件和验证码控件

    看下列代码进行操作: 验证码 ...2014计算机一级WPS及基础... 2014年9月计算机三级软件... 【呕心推荐...最容易使用的验证码控件... 38页 免费 网络投票系统...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email