将createbox1值发送到createboxwizard中chekedchanged of checkbox的textbox2 [英] send textbox1 value to textbox2 on chekedchanged of checkbox in createuserwizard

查看:73
本文介绍了将createbox1值发送到createboxwizard中chekedchanged of checkbox的textbox2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有自定义的createuserwizard控件。我在createuserwizard中选了两个文本框和一个复选框。我想要的是当用户选中复选框然后TextBox1值应该进入TextBox2。



我在cheked_changed事件上写代码如下面的复选框..但事件不是我认为那是因为复选框在createuserwizard中。



I have customized createuserwizard control. I have taken two textboxes and a checkbox in a createuserwizard. what i want is when user checked the checkbox then TextBox1 value should go in TextBox2.

I am writing code on cheked_changed event of checkbox like below.. but event is not raised.. i think that is because checkbox is inside the createuserwizard.

protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
   {
       if (((CheckBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("CheckBox1")).Checked == true)
       {
           ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("TextBox1")).Text = ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("TextBox2")).Text;
           
       }
      
   }



请建议我可以解决这个问题吗?


Please suggest me can i resolve this problem??

推荐答案

在您的复选框中添加以下属性

Add below properties to your checkbox
<asp:CheckBox ID="CheckBox2" runat="server" Text="Click here to send textbox1 value to textbox2" OnCheckedChanged="CheckBox1_CheckedChanged" AutoPostBack="True" />


这篇关于将createbox1值发送到createboxwizard中chekedchanged of checkbox的textbox2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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