Hi,
I have two DropDownListBoxes one is called ddlDay and the other is ddlMonth. As their names suggests, ddlDay has values from 01 to 31 (not dynamic) and ddlMonth has values from 01 to 12. These values are not dynamically set.
When the page loads, I am getting values from the db.. depending on the value, I am using ddlDay.SelectedItem.Value = the value from the db to set
the value and make the item selected.
The code I provide below was tested with If Not Page.IsPostback Then...
statement without any luck.
however, when the page is loaded for the first time, nothing happens. but if I refresh the page and therefore cause a postback, then the values get binded correctly.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
loadInterview()
End Sub
Private Sub loadInterview()
If Request.QueryString("iID") = "" Or Request.QueryString("iID") Is Nothing Then
Response.Redirect("interviews_list.aspx")
Else
Dim int As New hh.Interviews
int = hh.Interviews.ReturnSingleInterview(Request.QueryString("iID"))
ddlDay.SelectedItem.Value = int.InterviewDate.Day.ToString("00")
ddlMonth.SelectedItem.Value = int.InterviewDate.Month.ToString("00")
txtYear.Text = int.InterviewDate.Year
txtPerson.Text = int.InterviewPerson
txtTitle.Text = int.InterviewTitle
txtText.Text = int.InterviewText
End If