2017-06-20 10 views
0

ドロップダウンで新しい値を選択すると、アイテムはポストバック時に空になります。ユーザーコントロール の ページの読み込み{ (未Page.IsPostBack)場合、 Populate_MonthList() Populate_YearList() 終了 もし}ドロップダウンUserControl ASP.netで新しい値を選択するとドロップダウンアイテムVB

Sub Set_Calendar(Sender As Object, E As EventArgs) 
    'Whenever month or year selection changes display the calendar for that 
    month/year   
    calendar1.TodaysDate = CDate(drpCalMonth.SelectedItem.Text & " 1, " & 
     drpCalYear.SelectedItem.Value) 
    If (Sender.Id = "drpCalYear") Then 
     Populate_YearList(True) 
    End If 
    'whenever month or year changes 

End Sub 

屈折率変化が何であるかをいくつかの助けをすることはできここで問題?

答えて

0

ドロップダウンリストを埋めるイベントをIf Not IsPostBack = True Thenに入れる必要があります。そうしないと、ドロップダウンリストが再作成され、選択した値が失われます。あなたのイベントがisPostBackの範囲内であれば、あなたの選択にアクセスできるはずです。

関連する問題