Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
ASP .Net
Dropdownlist not displaying list
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Guest, post: 1083611"] Hi Everyone, I had posted a message about the dropdownlist not displaying newly added items. Just alittle background. I'm working with a masterpage and a usercontrol(Search control) (VS2005) that contains a few controls and a dropdownlist. Once the user logs in I have a event that is triggered(Master page captures event) from another usercontrol(login) and executes LoadAdminOptions. So I thought I'd start from scratch and wrote the following code: Public sub LoadAdminOptions() cmbOptions.DataSource = CreateDataSource() cmbOptions.DataTextField = "ItemText" cmbOptions.DataValueField = "ItemValue" cmbOptions.DataBind() End Sub Function CreateDataSource() As ICollection Dim dt As New DataTable() Dim dr As DataRow Dim lUser as new User lUser = Session("UserInfo") dt.Columns.Add(New DataColumn("ItemText", GetType(String ))) dt.Columns.Add(New DataColumn("ItemValue", GetType(Integer ))) dr = dt.NewRow() dr(0) = "Search by PO ID" dr(1) = 0 dt.Rows.Add(dr) dr = dt.NewRow() dr(0) = "Search by Field" dr(1) = 1 dt.Rows.Add(dr) dr = dt.NewRow() dr(0) = "Search between dates" dr(1) = 2 dt.Rows.Add(dr) dr = dt.NewRow() dr(0) = "Most recent # days" dr(1) = 3 dt.Rows.Add(dr) if lUser.Role.RoleName.ToUpper = "ADMIN" then dr = dt.NewRow() dr(0) = "Search by UserId" dr(1) = 4 dt.Rows.Add(dr) dr = dt.NewRow() dr(0) = "Awaiting Approval" dr(1) = 5 dt.Rows.Add(dr) end if Dim dv As New DataView(dt) Return dv End Function The problem is that after the code runs, there are NO ITEMS in the list. Why? This is almost a copy of the code from the online help file. In searching what was going on I added the following code to the Search control load event: if not IsPostBack then msgbox ("load event") else msgbox ("Post Back") end if Observations: Get "load event" when page is first loaded as expected. When user logs in and event is executed I get "Post Back" my code get executed and then the I get the "load event". It appears that something is out of sinc. Anyone have a suggestions how to handle this one. I've gone back to the event way, cause I was having Major problems getting a reference to properties or functions from outside the user controls. What do you think? Thanks for any suggestion. Mike [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
ASP .Net
Dropdownlist not displaying list
Top