ds.Tables["mytable"].DefaultView
你确保 有数据?!

解决方案 »

  1.   

    不好意思,我不懂什么作用域
    http://dev.pmcc.cn 就是这个页面 
    RadioButtonList 控件 是从数据库绑定的
      

  2.   

    Label1.Text=MovieQuality.SelectedValue;
      

  3.   

    应该可以吧
    例子
    <%@ Page Language="C#" AutoEventWireup="True" %>
    <html>
    <head>
       <script runat="server">
          void Button1_Click(object Source, EventArgs e) 
          {
             if (RadioButtonList1.SelectedIndex > -1) 
             {  
                Label1.Text = "You selected: " +
                              RadioButtonList1.SelectedItem.Text;
             }
          }
       </script>
    </head>
    <body>
       <form runat="server">
          <h3>RadioButtonList Example</h3>
          <asp:RadioButtonList id=RadioButtonList1 runat="server">
             <asp:ListItem>Item 1</asp:ListItem>
             <asp:ListItem>Item 2</asp:ListItem>
             <asp:ListItem>Item 3</asp:ListItem>
             <asp:ListItem>Item 4</asp:ListItem>
             <asp:ListItem>Item 5</asp:ListItem>
             <asp:ListItem>Item 6</asp:ListItem>
          </asp:RadioButtonList>      <asp:Button id="Button1" 
               Text="Submit" 
               OnClick="Button1_Click" 
               runat="server"/>
          <p>
          <asp:Label id="Label1" 
               Font-Name="Verdana" 
               Font-Size="8pt" 
               runat="server"/>
       </form>
    </body>
    </html>
      

  4.   

    例:CustomerID.SelectedValue.ToString()
      

  5.   

    MovieQuality.DataSource=ds.Tables["mytable"].DefaultView;
    中的DefaultView去掉,再试试。看行不行。
      

  6.   

    MovieQuality.SelectedIndex=0;
    -----------------------------------
    MovieQuality.Items[0].Select = true;改后在改行设断点,跟踪
      

  7.   

    MovieQuality.DataTextField="MovieQualityName";
    MovieQuality.DataValueField="MovieQualityId";
    是不是你表中的字段,你的sql语句中是否包含着两个字段。
    如select * from MyTable
      

  8.   

    是表中字段
    sql语句是 select MovieQualityName,MovieQualityId from Movie
      

  9.   

    MovieQuality.SelectedIndex=0;
    -----------------------------------MovieQuality.Items[0].Selected = true;索引超出范围。必须为非负值并小于集合大小。参数名: index 是不是我绑定数据库不对啊?
      

  10.   

    先绑定再设置selectedIndex试试MovieQuality.DataSource=ds.Tables["mytable"].DefaultView;
    MovieQuality.DataTextField="MovieQualityName";
    MovieQuality.DataValueField="MovieQualityId";
    MovieQuality.DataBind();
    MovieQuality.SelectedIndex=0;
      

  11.   

    不要说你没有选就在取值哦!照你的代码selectedindex应该是-1你要是没选就选当然会出错!如果你想让他默认选第一个,则要在DataBind后再将它的selectedindex设为0,如 ml_net() 兄所说!