选中文本框时插入复选框选中的值作为逗号分隔的字符串 [英] Insert checkbox checked value when checked to textbox as comma seperated string

查看:23
本文介绍了选中文本框时插入复选框选中的值作为逗号分隔的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 vb.net 或 javascript 中以逗号分隔字符串的形式选中文本框时插入复选框选中的值

Insert checkbox checked value when checked to textbox as comma seperated string in vb.net or javascript

假设我的 pages.aspx 中有 3 个复选框和 1 个文本框

suppose i have 3 checkboxes and and 1 textboxes in my webpage.aspx

当我选中 checkbox1 和 checkbox2 然后在文本框中它只会在复选框选中事件中显示为 1,2 ...

when i checked checkbox1 and checkbox2 then in textbox it will appear as 1,2 only on checkboxes checked event ...

我也希望它恢复:

如果我设置了文本框

推荐答案

应该很简单

复选框应该有以下事件

OnCheckedChanged 请参阅此处以获取更多参考http://www.w3schools.com/aspnet/control_checkbox.asp.

OnCheckedChanged see here for more reference http://www.w3schools.com/aspnet/control_checkbox.asp.

在该事件中更新文本框计数,就像绑定事件一样,每当事件发生更改时,请更新文本框.

In that event update the textbox count , like that bind the events and whenever event is changed please update the text box.

 textbox.Text=""; // textbox should be the id of textbox control

应该是非常直截了当的

由于你没有提供太多细节,我为你提供了一种方法

as you didn't provide too many details , i am providing you an approach

这篇关于选中文本框时插入复选框选中的值作为逗号分隔的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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