Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i have a gridview and a lesson table, lessondate table and LessonWithDate table
i want to have a drop down list which when click it, it show all the lesson
if i click on one of the lesson in drop down list, there will be the date available and lessonName show in the gridview

because 1 lesson can have many lessonDate and 1 lessonDate can have many lesson
thereby i create a combine table called LessonWithDate

so how should show in the gridview the result i want? cause i need to click on one of the date among those date available in the one of the lesson in the gridview

then i will click on add to list button

if i want only one row, which mean all dates will be show in a column, is there a way to allow user to select one of the date, take example in my drop down list, i click on English, then it will show a row of grid, in a column in will show all the list of date available in the radio button, user can click on one of it and then obtain the date that select inserting into the datebase which in click on AddToList button because i want to show another column the detail of the lesson ENGLISH

Table: Lesson
HTML
lessonID lessonName    
1         English
2         Chinese
3         Maths 


Table: LessonDate
HTML
lessonDateID date        
1            12/2/2012   
2            13/2/2012   
3            20/3/2012   
4            25/4/2012   


Table: LessonWithDate
HTML
lessonWithDateID   lessonDateID     lessonID
1                       1             1
2                       1             2
3                       2             2
4                       3             1
5                       4             3
Posted
Updated 25-Jan-12 3:33am
v3

So your drop down list shows just the lessons?
Then when selected your grid shows the one lesson selected and all the dates?

So you need to filter your lessonwithdate table to include just the dates for the lesson selected...

Select date
From lessonDate as LD
Inner join LessonWithDate as LWD On LD.Lessondateid = LWD.LessonDateId
Where LWD.LessonId = @LessonIdTheUserSelectedInTheDropDown

So your grid now shows only those dates for the single lesson selected in the drop down. - and the user can select one or add a new one...
 
Share this answer
 
Comments
cutexxbaby 25-Jan-12 9:32am    
okay, but if i want only one row, which mean all dates will be show in a column, is there a way to allow user to select one of the date, take example in my drop down list, i click on English, then it will show a row of grid, in a column in will show all the list of date available in the radio button, user can click on one of it and then obtain the date that select inserting into the datebase which in click on AddToList button because i want to show another column the detail of the lesson ENGLISH
_Maxxx_ 25-Jan-12 18:59pm    
Sorry, I don't understand what you are trying to do.
Can you try to describe in simple sentences, step by step, what you want to see happen?
You seem to have introduced radio buttons and AddToList buttons- I don't know what they are meant to be used for.
If you describe step by step in simple senetences I may be able to understand the process you are trying to achieve - or at least ask sensible questions fro clarity
cutexxbaby 25-Jan-12 21:23pm    
so first, when i click on the drop down list and choose a lesson, the a row of gridview will appear
in the one of the column, there should be a list of radio button which are all the date available, so user are able to select one of the radio button and click on the button which will insert the selected date into database
_Maxxx_ 27-Jan-12 1:06am    
I'm sorry, I really am failing to understand what you are trying to do here. It makes no sense to me.
 
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