字符串拼接
int ArtID;
string str;
protected void LinkButton9_Click(object sender, EventArgs e)
{
foreach (RepeaterItem rep in rptList.Items)
{
CheckBox cb = (CheckBox)(rep.FindControl("cboCheck"));
if (cb.Checked == true)
{
boolean = true;
ArtID = int.Parse(des.Decrypt((((HiddenField)(rep.FindControl("hiddenFieldId"))).Value)));
}
}
str = ArtID + "," + ArtID;
Response.Redirect("Default.aspx?idd=" + str + "");
}
想得到str的值,应该是1,2,3
str = "1,2,3";
如何得到
int ArtID;
string str="";
protected void LinkButton9_Click(object sender, EventArgs e)
{
foreach (RepeaterItem rep in rptList.Items)
{
CheckBox cb = (CheckBox)(rep.FindControl("cboCheck"));
if (cb.Checked == true)
{
boolean = true;
ArtID = int.Parse(des.Decrypt((((HiddenField)(rep.FindControl("hiddenFieldId"))).Value)));
}
str += ArtID + ",";
}
Response.Redirect("Default.aspx?idd=" + str.TrimEnd(',') + "");
}