请教一段语句的C#写法 if Request.Form["xxx"].ToString()="任何地方"{...}else{...} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <asp:CheckBoxList id="CheckBoxList1" style="Z-INDEX: 102; LEFT: 200px; POSITION: absolute; TOP: 296px" runat="server"> <asp:ListItem Value="上海">上海</asp:ListItem> <asp:ListItem Value="北京">北京</asp:ListItem> <asp:ListItem Value="天津">天津</asp:ListItem> <asp:ListItem Value="重庆">重庆</asp:ListItem> <asp:ListItem Value="所有地方">所有地方</asp:ListItem> </asp:CheckBoxList>private string GetSelectAddress() { string returnStr = ""; for(int i=0;i<CheckBoxList1.Items.Count;i++) { if(CheckBoxList1.Items[i].Selected) { if(CheckBoxList1.Items[i].Text != "所有地方") returnStr += " " + CheckBoxList1.Items[i].Text; else returnStr = "所有地方"; } } return returnStr; } private StringBuilder GetSelectAddress(){ if (CheckList1.Items.Count == 0) { Response.write("<script>alert('Pls select one!');</script>"); return ""; } StringBuilder returnStr = ""; for(int i=0; i<CheckBoxList1.Items.Count; i++) { if(CheckBoxList1.Items[i].Selected) { if(CheckBoxList1.Items[i].Text != "所有地方") returnStr.Append(CheckBoxList1.Items[i].Text).Append(","); else { returnStr.Append("所有地方"); break; } } } if (returnStr[returnStr.Length-1] == ",") { returnStr.Remove(returnStr.Length-1, 1); } return returnStr;} 有个地方错了,改正如下:private StringBuilder GetSelectAddress(){ if (CheckList1.Items.Count == 0) { Response.write("<script>alert('Pls select one!');</script>"); return ""; } StringBuilder returnStr = ""; for(int i=0; i<CheckBoxList1.Items.Count; i++) { if(CheckBoxList1.Items[i].Selected) { if(CheckBoxList1.Items[i].Text != "所有地方") returnStr.Append(CheckBoxList1.Items[i].Text).Append(","); else { returnStr = "所有地方"; break; } } } if (returnStr[returnStr.Length-1] == ",") { returnStr.Remove(returnStr.Length-1, 1); } return returnStr;} 急!!!求解! 弱弱的问句 有谁做过gridview按月份 分页吗?给个思路也行 .net网站 每天上午8点群发邮件,如何实现,最好是自动的 ObjectDataSource如用BLL提供的删除方法删除一条数据呢? 请给一段拉模式下的水晶报表代码(vs2005) 偶送分来了,很简单的问题问大家。 求教一个正则表达式 老大难阿!难晕了! 待解决问题 初学ASP.Net,想问一下关于开发环境的选择 如何在DataList中判断时间,且在天与天之间的数据中输出日期?(ASP.NET--C#) 表格!又见表格!又见不是一般表格的表格!表是表格的表!格是表格的格!!DataGrid问题~~~~~~~~
runat="server">
<asp:ListItem Value="上海">上海</asp:ListItem>
<asp:ListItem Value="北京">北京</asp:ListItem>
<asp:ListItem Value="天津">天津</asp:ListItem>
<asp:ListItem Value="重庆">重庆</asp:ListItem>
<asp:ListItem Value="所有地方">所有地方</asp:ListItem>
</asp:CheckBoxList>
private string GetSelectAddress()
{
string returnStr = "";
for(int i=0;i<CheckBoxList1.Items.Count;i++)
{
if(CheckBoxList1.Items[i].Selected)
{
if(CheckBoxList1.Items[i].Text != "所有地方")
returnStr += " " + CheckBoxList1.Items[i].Text;
else
returnStr = "所有地方";
}
}
return returnStr;
}
{
if (CheckList1.Items.Count == 0)
{
Response.write("<script>alert('Pls select one!');</script>");
return "";
}
StringBuilder returnStr = "";
for(int i=0; i<CheckBoxList1.Items.Count; i++)
{
if(CheckBoxList1.Items[i].Selected)
{
if(CheckBoxList1.Items[i].Text != "所有地方")
returnStr.Append(CheckBoxList1.Items[i].Text).Append(",");
else
{
returnStr.Append("所有地方");
break;
}
}
}
if (returnStr[returnStr.Length-1] == ",")
{
returnStr.Remove(returnStr.Length-1, 1);
}
return returnStr;
}
private StringBuilder GetSelectAddress()
{
if (CheckList1.Items.Count == 0)
{
Response.write("<script>alert('Pls select one!');</script>");
return "";
}
StringBuilder returnStr = "";
for(int i=0; i<CheckBoxList1.Items.Count; i++)
{
if(CheckBoxList1.Items[i].Selected)
{
if(CheckBoxList1.Items[i].Text != "所有地方")
returnStr.Append(CheckBoxList1.Items[i].Text).Append(",");
else
{
returnStr = "所有地方";
break;
}
}
}
if (returnStr[returnStr.Length-1] == ",")
{
returnStr.Remove(returnStr.Length-1, 1);
}
return returnStr;
}