我有一个下拉列表,用于填充计算中的一组数据。在我的asp.net网站中有多个页面,我想用我的主页上的下拉列表中的当前数据显示一个标签。这是我的代码...在多个页面上填充标签
''' In the page load'''
Dim Val As Double
If Date.Now.Month = 10 OrElse Date.Now.Month = 11 OrElse Date.Now.Month = 12 Then
Val = Date.Now.Year
Else
Val = Date.Now.Year - 1
End If
For i = Val To 1996 Step -1
dropdownlist1.Items.Add(i)
Next
End Sub
'''function in a seperate class'''
Function GetDates(currentYear As Double) As String
Dim x As String
Return x
End Function
'''In the selected index event of the drop down (populates years ie. 2011, 2010, 2009)'''
Dim x As String = class1.GetDates(dropdownlist1.Text)
'''In the other pages load events'''
Dim x As String = class1.GetDates(label1.Text)
上面这行代码是我想要填充当前年份(即2011,2010,2009)任何建议?
你能提供更多关于你的问题的细节吗?下拉式填充一些DataSet?或者你想在主页上选择一年下拉式选项,并在今年的所有其他页面上查看? – Dima 2012-04-19 17:13:50
这两个都有一点,裸露在我请你,我是这个网站的新手。从下拉菜单中选择与当前会计年度相关的数据集,从1996年开始,我希望当用户从主页面选择一年(即2007年)时,可以使用标签来显示其他每个当前选定值9页。这有意义吗? – developthestars 2012-04-19 17:17:26
@developthestars - 嗨,你有可能把标签放在母版页上吗?我认为它会起作用。访问母版页标签来填充和显示 – 2012-04-19 17:25:56