if Request.Form["xxx"].ToString()="任何地方"
{
...
}
else
{
...}

解决方案 »

  1.   

    <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;
    }
      

  2.   

    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;
    }
      

  3.   

    有个地方错了,改正如下:
    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;
    }