如何从使用该用户控件的页面验证用户控件的控件? [英] How to Validate User Control's Control from the Page where that user control is used?
问题描述
嗨朋友们,
我需要您对我的查询提出宝贵意见/建议。
我的查询:
*我有一个用户控件(就像带有一些TextBox的网格视图一样)
*我使用了上面提到的用户控件在一个页面
*页面有用户控件加一个按钮。
一旦我点击按钮,TextBox中的值(来自用户控制)需要验证。
我需要在Javascript的帮助下在客户端执行上述操作。
请帮我写一下验证。
先谢谢了:)
Hi Friends,
I need your valuable suggestions/Advice for my Query.
My Query:
* I am having a User control (As like Grid View with Some TextBoxes)
* I used the above mentioned User control in a page
* Page is having the user control plus a Button.
Once I click on the Button, The Value in the TextBox (From User control) need to be validated.
I need to do the above at the client Side with the help of Javascript.
Please help me to write the validation.
Thanks in Advance :)
推荐答案
在usercontrol.ascx页面上点击按钮调用Javascript函数。
它可以像下面那样smthng:
Hi,
call a Javascript function on the button click in the usercontrol.ascx page.
it can be smthng like below:
function validate(text)
{
var x=text.indexOf(';');
if(x!=-1)
{
alert('the text doesnt contain semicolon');
}
else
{
alert('the text contains semicolon');
}
}
你可以进行验证,因为你不喜欢......我只是举个例子..
希望它有所帮助。
欢呼
you can have a validation as u wud like..i just gave an example..
hope it helps.
cheers
这篇关于如何从使用该用户控件的页面验证用户控件的控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!