473,587 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Showing img on page load based on DDL initial selected value

When the page loads, a dropdownlist is populated from a table. I
populate the DataTextField with a persons name, and the DataValueField
with the ID of the table (the key field) for further processing.

I also have another field, a bit field, that I need to process on load.
Basically, when the dropdownlist is first populated (when the page is
first visited), and if the first person that shows up in the the
dropdownlist has a bit field in the table marked 1, then I need an image
to load. I can load the image if the user selects a different name from
the dropdownlist that also has a 1 in the bit field, but on on first
load. I tried this:

Dim rdrClient As SqlDataReader
Dim intGroup As Int16
objConnection.O pen()
rdrClient = objCommand.Exec uteReader()
ddlClientName.D ataSource = rdrClient
ddlClientName.D ataTextField = "clientname "
ddlClientName.D ataValueField = "id"
ddlClientName.D ataBind()
rdrClient.Close ()
intGroup = objCmdGroup.Exe cuteScalar()
objConnection.C lose()
If intGroup = 0 Then
imgGroup.Visibl e = False
Else
imgGroup.Visibl e = True
End If

I placed in some response.write' s to see what the sql string looked like
and I saw that no ID was being placed into the SQL string. I'm guessing
that all the code is being processed before any control is actually
rendered and populated with data (the dropdownlist).

So, how can I get the value of a column from the first item in a
dropdownlist on page load without changing the values of the
DataTextField or DataValueField to the data column that I need? Too bad
there wasn't another 'hidden' field in a dropdownlist that I could
populate with more data for conditional programming.
Apr 5 '07 #1
0 995

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

Similar topics

4
2241
by: middletree | last post by:
I had this going yesterday, but it seems to be forgotten because it's so far down the list now. www.middletree.net/dropdown.htm This is from an Intranet app I have going in ASP. I have no actual URL to show you, but this should work. Find the <select> dropdown called Type of Ticket. Now find the one called Environment. The boss wants a...
3
8981
by: William LaMartin | last post by:
If I create a RadioButtonList with, say, two items, then after the page loads and I select one of the items and then click on a button whose click event contains some code to display the RadioButtonlList's selected value, there is nothing. On a postback, with the dynamically created button list visible on the page and the first item...
2
3613
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
8
2186
by: Radx | last post by:
Here in my web application, I have a data entry page with serval controls. Some of the controls have autopostback is set true. But the problem is when two or more people are entering data at the same time, in the middle of my data entry , it is brining someelse data on my screen. I look everywhere i could not find the solution. Please help...
3
2330
by: Bill | last post by:
I'm using the POST method to submit a simple form html page with yes/no and checkbox fields to an asp response page which stores the values in a new dim string, then uses it to build a new table using ADO. I'm getting sometimes correct values, sometimes null values (when I know I pass a valid default value) and other times multiple values! I...
0
2087
by: Managed Code | last post by:
Hello All, Here is my issue and thanks in advance for any assistance. I have a base page with a dropdownlist that fires an event with the selected index. The content page catches the event and sets a connection string to the database. The content page has a simple gridview that should show records from the selected database. Initial...
1
4089
by: Darsin | last post by:
What i am doing is to pull the data from a CMS and import it to Word 2007 Beta and i also have to export the data from Word 2007 Beta back to that CMS. We have with us two Web Services of the CMS. The Web Services are explained as follows: IMPORT WEB SERVICE:
2
3069
by: thuythu | last post by:
Please help me.... I used and Javascript to view the data. But when i click button open a popup windows, then select data and click save button. The popup close and return the main page, but the textbox value in the main page is undefined ---------------------------------------- here are code main page:...
5
5017
by: Hans Kesting | last post by:
Hi, Is there good information about the asp.net page lifecycle in combination with dynamically loaded controls? Or on "how to build dynamic controls"? I keep hitting problems where values are not available at the moment I need them. Current problem: In a dynamically loaded ascx there is a dropdown. Based on the selected value (reloading...
0
7852
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8221
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6629
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5719
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2364
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 we have to send another system
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.