文本框控件验证

编程入门 行业动态 更新时间:2024-10-25 12:22:05
本文介绍了文本框控件验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的项目中使用相同的文本框,可能页面显示我想要在每个地方进行相同的验证 任何建议如何维护.

In my projects use same text box may pages show i want same validation in every where any Suggestion How Maintain.

推荐答案

只需将它们放在用户控件中,然后将相同的用户控件放在任何地方 并获取文本框的文本,请在添加了usercontrol的页面代码中使用此文本 just put them in a usercontrol and put the same usercontrol everywhere and to get the text of the textbox use this in the page code where added the usercontrol ((TextBox)this.usercontolid.FindControl('the_text_box_id')).Text

您可以将脚本移至单独的js 文件&您可以在每个页面上调用该页面.或者,如果您使用的是验证控件,则可以创建用户控件. You can move the scripts into separate js file & you can call that every page. Or if you are using Validation controls then you may create user controls.

使用此技术可以解决您的问题 这里txt_my_control是您的< b>控件ID</b> TextBox box1 =(TextBox)Gridview1.Rows [i] .Cells [2] .FindControl("txt_my_control"); By using this technique you can solve your problem here txt_my_control is your <b>control Id</b> TextBox box1 = (TextBox)Gridview1.Rows[i].Cells[2].FindControl("txt_my_control");

更多推荐

文本框控件验证

本文发布于:2023-11-11 23:44:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1579876.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   文本框

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!