protected void btnModify_Click(object sender, EventArgs e) { string sb =String.Empty; for (int i = 0; i < this.gvBooks.Rows.Count; i++) { CheckBox cb = (gvBooks.Rows[i].FindControl("chbSelect")) as CheckBox; if (cb.Checked == true) { sb += (gvBooks.Rows[i].FindControl("lblId") as Label).Text+","; } } string catagory = this.ddlCatagory.SelectedItem.Value; ChangeCatagory(sb, catagory); } private void ChangeCatagory(String sb, string catagoryid) { if (sb.Length > 0) { sb = sb.Substring(0, sb.Length - 1); } BookManager.ModifyCatagory(sb, catagoryid); Response.Redirect("ListBooksByCategory.aspx"); } 这段代码中 sb = sb.Substring(0, sb.Length - 1);是什么意思,特别是sb.Length - 1在这里的意思,越具体越好,谢咯
相关分类