473,473 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Dropdownlist not displaying list

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
Apr 28 '06 #1
0 1071

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: sunstarwu | last post by:
Hi, I am having difficultly being able to view certain Columns and rows via a DropDownList. Everytime I load my webpage.aspx it just shows empty drop down menus. I have no problem showing all...
3
by: Celine | last post by:
I have a webform with multiple panels with textboxes, dropdownlists, radiobuttonlists, etc. The user navigates through the panels and then submits the information at the end. The first panel...
3
by: Tim::.. | last post by:
Can someone tell me how I get the correct selected office in my drop down list when I enter edit mode. At the moment it just defaults to the office at the top of the drop down list rather than...
2
by: Kay Chan | last post by:
Hi All, I am going to using a editable datagrid, one of the field should be a dropdownlist, here is my code <EditItemTemplate> <asp:DropDownList ID="INVESTMENT_FUND_ID" DataSource="<%# ...
1
by: Trevor Bezotte | last post by:
Hi, I'm new to asp.net. I am having trouble updating and displaying a profile property through a dropdownlist. I believe the problem has something to do with autoeventwireup but I'm not sure. If...
6
by: p.mc | last post by:
Hi all, I have a MS SQLServer database which has two tables, 'images' and 'photographers'. The photographer table contains a field for PhotographerID and a one for PhotographerName. The image...
1
by: sean.polacsek | last post by:
Hi there, I have a curious problem. I have DropDownList that gets bound to datatable during PreRender. Straight after binding I set the SelectedValue of the DropDownList. When the page is...
0
by: er1 | last post by:
Hi All, I am trying populate dropdownlist using SQL query. I am able to bind the list and populate it with query result. But in Dropdown list it shows 1st result of a query as a default value. I...
3
by: =?Utf-8?B?RGVlcGE=?= | last post by:
Hi All, I have a webform in asp.net framework 1.1 where the dropdownlist is populated with list of locations from the database. The depending on the list selected, the user will be able to see...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.