Click here to Skip to main content
15,881,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having following scenario,

I am having Course_Master table from which I want to get Course_name,Course_id and Stream.
I bind this record to dropdownlist in the following manner.

C#
DataSet ds = objExam.GetStudentPracticalSubject(Request.QueryString["admission_id"].ToString());
                  ddSubject.DataSource = ds.Tables[0];
                  ddSubject.DataTextField = "COURSE_NAME";
                  ddSubject.DataValueField = "COURSE_ID";
                  ddSubject.DataBind();


the above GetStudentPracticalSubject method return me Stream also, I want to bind that also with the dropdownlist, so that It is possible for me to pass stream as like courseid using the propertity ddSubject.SelectedValue.

I want to know how to achieve this with multiple DataValueField property for two binding values.
Posted
Updated 6-Jan-15 0:54am
v2
Comments
Suvendu Shekhar Giri 30-Dec-14 2:39am    
May not be the solution. But just an idea. You can append the courseid and stream with an uncommon special character like '$' and then when you need those values , just split them to get the two values :)

1 solution

Solution: What you can do is when you get the CourseID and Stream from SQl or any database fetch them like '1-S' where '1' is your CourseID and 'S' can be your streamID or stream value. Then you can use the 'split' function to get the value in your code. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900