Can't acces SelectionList control inside devicespecific ..Plz help! RRS feed

  • Question

  • User-1052995518 posted

     hii there,

    I'm new to microsoft mobile internet toolkit ...and i'm trying to bind selectionlist that's inside devicespecific control

    i really need it ot's my graduation project [:'(]


    <mobile:DeviceSpecific id="DeviceSpecific1" runat="server">
        <Choice Filter="supportsJavaScript">
            <asp:DropDownList   id="selLstLines" runat="server" OnSelectedIndexChanged="btnSearchBuses_Click" AutoPostBack="True">
              <asp:ListItem Value="a">1</asp:ListItem>
              <asp:ListItem Value="b">2</asp:ListItem>
              <asp:ListItem Value="c">3</asp:ListItem>
            <mobile:SelectionList id="SelectionList1" runat="server" OnSelectedIndexChanged="btnSearchBuses_Click">
              <Item Value="a" Text="1"/>
              <Item Value="a" Text="2"/>
              <Item Value="a" Text="3"/>
            <mobile:Command ID="Command1" runat="server" text="Submit"/>

    here's the c# code before using devicespecific, what's the modifications should be done ?  

    public void btnSearchBuses_Click(object sender, EventArgs e)

            con = new SqlConnection();
            con.ConnectionString = ConfigurationManager.ConnectionStrings["MobileStudentPortalConnectionString"].ConnectionString;     
            cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandText = "Select Line From Buses";
            da.SelectCommand = cmd;      
            selLstLines.DataSource = ds;
            selLstLines.DataTextField = "Line";





    Tuesday, April 15, 2008 3:19 PM


  • User-1052995518 posted

    I Finally figured it out, i assigned an argument for every choice ..by this i could determine which control was loaded ( the DropDown or the SelectionList) .... the code below: if (deviceSpecificCoursesSelList_Marks.SelectedChoice.Argument.Equals("agrDrop_Marks")) { ((DropDownList)panelCoursesSelList_Marks.Content.FindControl("selListCourses_Marks"));//reference to the control. } else { (SelectionList)panelCoursesSelList_Marks.Content.FindControl("selListCourses_Marks"));//Reference to the control. }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 18, 2008 3:37 PM