RadComboBox Items in Array to linqDataSource

1 posts, 0 answers
  1. Sucheta Patil
    Sucheta Patil avatar
    52 posts
    Member since:
    Jan 2010

    Posted 24 Sep 2010 Link to this post

    I have a form on which I am selecting Student Name and populating Course Titles which is visible false on design
    Courses could be 4 or 5 or more.
    Now for each course I need to populate Tutor name and email.
    I think I have to use Array for the courses but then how do I pass each array value to LinqDataSource to get TutorName.

    My code snippet is:

            <asp:Label ID="lbStudName" runat="server" Text="Student Name: "  AssociatedControlID="lstStudName"
            <telerik:RadComboBox ID="lstStudName"  runat="server" ShowToggleImage="false"
                DataTextField="SName" DataValueField="SName" ReadOnly="true" Enabled="true"
                 AppendDataBoundItems="true" AutoPostBack="True"
                onselectedindexchanged="lstStudName_SelectedIndexChanged" >
                <Items><telerik:RadComboBoxItem Text="Choose One..." Value="0" /></Items>
    <li><asp:Label ID="lbCourseCode" runat="server" Text="Course Code: " Visible="true" AssociatedControlID="lstCourseCode"> </asp:Label>
                  <telerik:RadComboBox ID="lstCourseCode"  runat="server" ShowToggleImage="true"
                DataTextField="CRef" DataValueField="CRef" Visible="true"
                      AppendDataBoundItems="True" ReadOnly="true" AutoPostBack="True">
    <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
     protected void lstStudName_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
            string StudName = ((RadComboBox)o).SelectedItem.Text;
            string[] course;
            foreach( Items c  in course)
               //linq query here
            //   BindTutor(CREF);
    private void BindCourse(string StudName)
            String[] str = StudName.Split(new char[] { ' ' });
            String fname = str[0];
            String lname = str[1];
            var query1 = (from z in modttdc.StudentInfos
                          where (z.Forenames.ToLower() == fname.ToLower()) && (z.Surname == lname.ToLower())
                          orderby z.Student_reference
                          select new
                              CRef = z.Course_Ref,
            BindList(lstCourseCode, query1);
            //String CRef1 = lstCourseCode.SelectedItem.Text;

    Any help is appreciated.
Back to Top