if(RadioButtonList.selectedItem.value==null)

解决方案 »

  1.   

    不对啊,兄弟,-------------------------------------------------------------Compilation Error 
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30201: 需要表达式。Source Error:Line 17: <script runat="server">
    Line 18: Sub tj_click(Src As Object, E As EventArgs)
    Line 19: if test.selectedItem.value==null then
    Line 20: response.Write("ok")
    Line 21: else
     
    Source File: H:\web\vote\test.aspx    Line: 19
      

  2.   

    if(RadioButtonList1.SelectedIndex == -1)
    {
    Response.Write("没有选中");

    }
    else
    {
    Response.Write("选中了");
    }
      

  3.   

    http://lucky_elove.www1.dotnetplayground.com/ShowDetail.aspx?id=7AE7D20A-A5DA-4303-AC2D-32046BE4D086
      

  4.   

    RadioButtonList1.SelectedIndex表示选择项的索引,当没有选择项时其值为-1
      

  5.   

    <asp:RadioButtonList id="RadioButtonList1" runat="server"></asp:RadioButtonList>
    <asp:RequiredFieldValidator ControlToValidate="RadioButtonList1" id="RequiredFieldValidator1" runat="server" ErrorMessage="还未选择"></asp:RequiredFieldValidator>