|
-
Feb 26th, 2003, 01:25 PM
#1
Thread Starter
Junior Member
Matching date values w/ dropdown values
In my program, I have 6 ddl's filled programatically with date info (month, day & year) in my client-side code. Based on a selection in a listbox, the ddl's show date info for the selection based on a SQL SELECT statement in my (VB) server-side code; the problem is the date parts returned had no value. I wanted to match what was returned with values I had put in the dropdowns programatically. For example, if the day from SQL was the 3rd, I'd want it to show up in the list at the 3 that I've inserted on client-side, like so:
1
2
3 <--
4
5
Right now it comes up like this:
3 <--
1
2
3
4
5
How can this be corrected?
Note: I had been trying to use FindByValue and/or FindByText on these; they had worked on my other ddl's in the program, but not these.
The key parts of the code are like so:
Code:
Dim dateInfo As New System.Globalization.DateTimeFormatInfo()
Dim myDate As DateTime = Trim(objSQLMemoList.returnDataViewValue(intTheSelectedIndex)("mgt_effectiveStartDate").ToString())
ddlMonth.SelectedItem.Text = dateInfo.GetMonthName(myDate.Month)
ddlDay.SelectedItem.Text = myDate.Day
ddlYear.SelectedItem.Text = myDate.Year
Dim myDate2 As DateTime = Trim(objSQLMemoList.returnDataViewValue(intTheSelectedIndex)("mgt_effectiveEndDate").ToString())
ddlMonth2.SelectedItem.Text = dateInfo.GetMonthName(myDate2.Month)
ddlDay2.SelectedItem.Text = myDate2.Day
ddlYear2.SelectedItem.Text = myDate2.Year
Apparently people in other forums didn't understand what I was saying , so I'm trying to clear things up here.
Last edited by joethecool1; Feb 27th, 2003 at 06:26 PM.
"Ignorance and prejudice and fear walk hand in hand" - 'Witch Hunt', by Rush
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|