如何在gridview中显示下拉列表中包含多个日期的数据? [英] how to show one data select in drop downlist with many dates in gridview?

查看:74
本文介绍了如何在gridview中显示下拉列表中包含多个日期的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个gridview和一个课程表,lessondate表和LessonWithDate表
我想要一个下拉列表,单击该列表可以显示所有课程
如果我单击下拉列表中的一个课程,则将有可用的日期,并且在Gridview中显示了课程名称

因为1堂课可以有很多lessonDate和1 lessonDate可以有很多lesson
从而创建一个名为LessonWithDate
的组合表
那么如何在gridview中显示我想要的结果?因为我需要在gridview的课程之一中单击那些日期中的某一日期

然后我将点击添加到列表按钮

如果我只想要一行,这意味着所有日期都将显示在一列中,有没有一种方法允许用户选择日期之一,例如在我的下拉列表中,我单击英语,那么它将显示一个网格行中的一列将显示单选按钮中所有可用的日期列表,用户可以单击其中一个,然后获取选择插入日期库的日期,然后单击AddToList按钮,因为我要显示另一列本课程的详细信息

表:课程

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

lessonID lessonName    
1         English
2         Chinese
3         Maths 



表格:LessonDate



Table: LessonDate

lessonDateID date        
1            12/2/2012   
2            13/2/2012   
3            20/3/2012   
4            25/4/2012   



表格:LessonWithDate



Table: LessonWithDate

lessonWithDateID   lessonDateID     lessonID
1                       1             1
2                       1             2
3                       2             2
4                       3             1
5                       4             3

推荐答案

所以您的下拉列表仅显示了教训?
然后,当您选择网格时,它会显示所选的一课和所有日期?

因此,您需要过滤lessonwithdate表以仅包括所选课程的日期...

选择日期
从lessonDate作为LD
在LD.Lessondateid = LWD.LessonDateId上以LWD的形式内部连接LessonWithDate
其中LWD.LessonId = @LessonIdTheUserSelectedInTheDropDown

因此,您的网格现在仅显示下拉菜单中选择的单个课程的日期. -并且用户可以选择一个或添加一个新的...
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...



查看此链接


这篇关于如何在gridview中显示下拉列表中包含多个日期的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆