将数据绑定到模式弹出窗口文本框 [英] bind the data to modal popups text box

查看:95
本文介绍了将数据绑定到模式弹出窗口文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框和一个名为btnFind的Web窗体按钮.模态弹出窗口的目标是btnFind.
因此,当我单击按钮时,模式弹出窗口会打开.但是我想验证文本框,因为它应该包含10位数字,并且该文本框的值应与模式弹出文本框绑定.即,模式弹出窗口中的文本.

i have a text box and a a button in web form called btnFind. the target of modal popup is btnFind.
so when i click the button, the modal popup gets open.but i want to validate the text box as it should contain 10 digit numbers and that text boxs value should be binded with the modal popups text box.i.e the text present in modal popup.

推荐答案



文本框的"OnClientClick"事件,调用一个javascript函数,该函数应检查文本框中的位数.如果数字位数为10,则返回true,否则返回false.

Hi,

"OnClientClick" event of the text box, call one javascript function, which should check the no of digits in the text box. if the no of digits are 10 then return true else return false.

//javascript function
function CheckLength(txtbox)
{
  var txt = document.getElementById(txtbox);
  if(txt.value.length <= 10)
  {
      //Assign textbox value to other textbox in modal popup panel
      document.getElementById("txtModalTextBox").value=txt.value;
      return true;
  }
  else
     return false;
}





//Add attribute to the button

btnFind.Attributes.Add("onclick","return CheckLength('"+ textbox1.ClientID +"')");




希望它能工作..




hope it works..


这篇关于将数据绑定到模式弹出窗口文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆