解决方案 »
- 【activereport】在WEB项目中,如何将CSV作为activereport的数据源?求助
- NET 如何读取CSV文件并将记录添加到数据库
- VS 2005 控件位置移动的问题?
- asp.net中的身份验证问题
- 我每次打開網站那個用到水晶報表的那個頁面就會出現然我驗證數據庫,
- 哪里有Enterprise Library for .net 1.1和2.0 下载,msdn上的下载不了,请问谁有下载地址呢
- 一个关于登录的 菜鸟问题。。
- asp.net连接http地址所包含的数据
- textbox中输入一段文字,文字中含“,”字符。应该如何处理这个“,”?
- ==DataGrid列的顺序,请教!
- ◆IBatis.NET +Castle 可以开发 winform 项目吗?◆
- QQ的sigkey是怎么算出来的?
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
txt1.Text = "";
foreach (ListItem item in CheckBoxList1.Items)
{
if (item.Selected)
txt1.Text += item.Text;
}
}
txt1.Text = "";
明显是将TextBox清空了。然后遍历CheckBoxList重新生成你要的字符串。
{
if (item.Selected)
txt1.Text += item.Text+",";
else txt1.Text= txt1.Text.Replace(item.Text+",","");
}
<asp:ListItem Value="1" Text="a"></asp:ListItem>
<asp:ListItem Value="2" Text="b"></asp:ListItem>
<asp:ListItem Value="3" Text="c"></asp:ListItem>
</asp:CheckBoxList>
<asp:TextBox ID="txt1" runat="server"></asp:TextBox>function Test(){
var str = "";if(document.getElementById("cblSiteStyle_0").checked){
str = str + document.getElementById("cblSiteStyle_0").nextSibling.innerText);
}if(document.getElementById("cblSiteStyle_1").checked){
str = str + document.getElementById("cblSiteStyle_1").nextSibling.innerText);
}if(document.getElementById("cblSiteStyle_2").checked){
str = str + document.getElementById("cblSiteStyle_2").nextSibling.innerText);
}document.getElementById("txt1").value = str;
}
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class Default4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
protected void chklstUserPass_SelectedIndexChanged(object sender, EventArgs e)
{
txt1.Text = "";
foreach (ListItem item in chklstUserPass.Items)
{
if (item.Selected)
{
txt1.Text += item.Text;
}
} }
}