Hello,
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:
Any help is appreciated.
Thanks
Sucheta
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:
student.aspx
******************************
<
li
>
<
asp:Label
ID
=
"lbStudName"
runat
=
"server"
Text
=
"Student Name: "
AssociatedControlID
=
"lstStudName"
>
</
asp:Label
>
<
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
>
</
telerik:RadComboBox
>
</
li
>
<
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"
>
</
telerik:RadComboBox
>
</
li
>
<
asp:LinqDataSource
ID
=
"LinqDataSource1"
runat
=
"server"
ContextTypeName
=
"ModTTDataContext"
TableName
=
"StudentTutors"
>
</
asp:LinqDataSource
>
*********************************
student.aspx.cs
**********************************
protected void lstStudName_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
string StudName = ((RadComboBox)o).SelectedItem.Text;
BindCourse(StudName);
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,
}).Distinct();
BindList(lstCourseCode, query1);
//String CRef1 = lstCourseCode.SelectedItem.Text;
}
Any help is appreciated.
Thanks
Sucheta