如何用其他文本框中的值填充复选框上的文本框 [英] how to fill text boxes on checkbox click with values from other textboxes

查看:88
本文介绍了如何用其他文本框中的值填充复选框上的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!!!!

我刚才填写表格.它具有信函和永久地址的选项.我填写了通讯地址,然后有一个选项可以勾选两个地址是否相同.我检查了它,并且永久地址充满了与相应地址相同的数据.我在想它是怎么做到的.我考虑过视图状态和东西,但是没有回发,所以不要认为使用了视图状态.然后我考虑了数据表-可能是...不知道.

有人可以给我一些建议吗?

Hi all!!!

i was filling a form moments ago. it had options for correspondence and permanent address. I filled the correspondence address and then there was an option to tick if both address are same. i checked it and permanent address was filled with same data as in corresponding address. i am thinking how it is done. i thought about view state and stuff but there is not postback so don''t think view state was used. then i gave a thought to data table - may be... don know.

can anybody give me some advise how it can be done ???

推荐答案

一个选项可以是在更新面板下发生回发...
通过在复选框的勾选事件上使用javascript ...

如果需要更多帮助,请在此处发布
one option can be that postback is happening under update panel...
by the use of javascript on the tick event of check box...

post here if any more help needed


< asp:checkbox id ="chkInterest1" runat ="server" text ="Correspondence" onclick ="alert(this.checked)"/> ;

选中复选框时,这将引发客户端事件.您可以调用自己的javascript函数.在该功能中,您可以将一个控件的值设置为其他控件.

请参阅下面的链接以获得示例
http://doitdotnet.wordpress.com/2011 /12/16/handling-checkbox-checked-change-event-in-client-side/ [
<asp:checkbox id="chkInterest1" runat="server" text="Correspondence" onclick="alert(this.checked)" />

This will raise a client side event when a checkbox is checked,You can call your own javascript function. In that function you can set the value of one control to other.

Refer below link for a sample
http://doitdotnet.wordpress.com/2011/12/16/handling-checkbox-checked-change-event-in-client-side/[^]

Thanks


您还可以使用下面的代码使用Jquery进行操作.在使用下面的代码之前,请确保您添加了参考Jquery脚本.

You can do that thing using Jquery also using below code.Before used below code make sure you are add reference Jquery Script.


这篇关于如何用其他文本框中的值填充复选框上的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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