|
-
Jun 2nd, 2004, 12:30 AM
#1
Thread Starter
Addicted Member
dropdownlist selectedvalue problem
Hi all,
I have this code in my page_load event of my user control.
Code:
If Not IsPostBack() Then
LoadLocations(lstLocation)
lstLocation.Attributes.Add("onchange", "javascript: document.Form1.submit()")
Select Case strDisplayMode.ToUpper
Case "RESULTS"
poPurchaseOrders.Find(strRequestedBy, strRaisedBy, strApprovedBy, strMatterNumber, strPurchaseOrderNumber, strOffice, intPageNumber, intRecordsOnPage)
Case "MYLIST"
poPurchaseOrders.Find(Session("EmployeeName"), "", "", "", "", "", intPageNumber, intRecordsOnPage)
Case Else
poPurchaseOrders.Find("", "", "", "", "", "", intPageNumber, intRecordsOnPage)
End Select
Else
poPurchaseOrders.Find("", "", "", "", "", lstLocation.SelectedValue, intPageNumber, intRecordsOnPage)
End If
DataGrid1.DataSource = poPurchaseOrders.Results
DataGrid1.RecordCount = poPurchaseOrders.RecordCount
DataGrid1.RecordsOnPage = intRecordsOnPage
DataGrid1.CurrentPage = intPageNumber
DataGrid1.QueryString = GetQueryString()
End If
The problem is after every postback, the value of the selectedvalue of the dropdownlistbox is not the current value but the previous value. So to illustrate, suppose the value of the dropdownlistbox are '1','2','3','4'.
If the user selects '2', it gets the selected initially which is '1'.....
then the user selects '3', it gets '2',
user selects '4', it gets '3',
user selects '1', it gets '4'
I might be missing something here.
Kindly help.
Thanks in advance.
-
Jun 2nd, 2004, 06:21 AM
#2
VB Code:
lstLocation.Attributes.Add("onchange", "java script: document.Form1.submit()")
Can I assume that you are using this line to make the page post back when the user selects an item?
If so, try removing that line, and setting the dropdown's AutoPostback property to True, and see if that helps.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jun 2nd, 2004, 06:20 PM
#3
Thread Starter
Addicted Member
Hi,
I tried that, but it's still the same. May I also add that the datagrid is also a user control inside this user control.
Thanks again,
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
|