473,473 Members | 2,169 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Binding problems to dropdowns

I have a couple of stored procedures that are being called from my Page_Load
event.

They worked before, but now they are not working.

I am getting the error:

Specified argument was out of the range of valid values. Parameter name:
value

The function called is:

************************************************** *****
Sub GetExperienceLevel()
exit sub
Dim emailReader As SqlDataReader
trace.warn("inside GetExperienceLevel")
Dim ConnectionString as String
=System.Configuration.ConfigurationSettings.AppSet tings("MM_CONNECTION_STRING_ftsol")
Dim objConn as New SqlConnection (ConnectionString)
Dim CommandText as String = "Exec GetExperienceLevel"
Dim objCmd as New SqlCommand(CommandText,objConn)
objConn.Open()

ExperienceLevel.DataSource=objCmd.ExecuteReader
ExperienceLevel.DataTextField= "Description"
ExperienceLevel.DataValueField="ExperienceLevelID"
ExperienceLevel.databind()
ExperienceLevel.Items.Insert(0, "Select Experience Level")
ExperienceLevel.Items(0).value = 0
trace.warn("exiting GetExperienceLevel")
end sub
************************************************** ******

It is dying on the databind() line.

The dropdown is:

Experience:<asp:DropDownList id="ExperienceLevel" runat="server"
/></td>

The data coming back is:

ExperienceLevelID Description
----------------- ----------------
10 Less than 1
20 1-2 Years
30 2-5 Years

Why is it not binding?

Thanks,

Tom
Nov 19 '05 #1
2 1091
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I have a couple of stored procedures that are being called from my
Page_Load event.

They worked before, but now they are not working.

I am getting the error:

Specified argument was out of the range of valid values. Parameter name:
value

The function called is:

************************************************** *****
Sub GetExperienceLevel()
exit sub
Dim emailReader As SqlDataReader
trace.warn("inside GetExperienceLevel")
Dim ConnectionString as String
=System.Configuration.ConfigurationSettings.AppSet tings("MM_CONNECTION_STRING_ftsol")
Dim objConn as New SqlConnection (ConnectionString)
Dim CommandText as String = "Exec GetExperienceLevel"
Dim objCmd as New SqlCommand(CommandText,objConn)
objConn.Open()

ExperienceLevel.DataSource=objCmd.ExecuteReader
ExperienceLevel.DataTextField= "Description"
ExperienceLevel.DataValueField="ExperienceLevelID"
ExperienceLevel.databind()
ExperienceLevel.Items.Insert(0, "Select Experience Level")
ExperienceLevel.Items(0).value = 0
trace.warn("exiting GetExperienceLevel")
end sub
************************************************** ******
I tried to change the Stored procedure line to:

Dim CommandText as String = "Select ExperienceLevelID,Description from
ExperienceLevel order by ExperienceLevelID"

This came right from the Stored Procedure and works from Sql Query (as does
the SP).

Tom
It is dying on the databind() line.

The dropdown is:

Experience:<asp:DropDownList id="ExperienceLevel" runat="server"
/></td>

The data coming back is:

ExperienceLevelID Description
----------------- ----------------
10 Less than 1
20 1-2 Years
30 2-5 Years

Why is it not binding?

Thanks,

Tom

Nov 19 '05 #2
I found out what was happening, just not why.

I had added some code before filling the dropdownlist that tried to select
the a value.

if not (PositionReader("ExperienceLevel") is DBNull.Value) then
ExperienceLevel.SelectedValue = PositionReader("ExperienceLevel")
end if

If I don't try to fill the Dropdownlist, I get the following code rendered.
************************************************** ****
Experience:<select name="ExperienceLevel" id="ExperienceLevel">
</select></td>
************************************************** ****

I am curious why my trying to fill the DDL after I do the above would cause
me a problem. I would have expected to get an error on trying to select a
non-existant value. But the error I got, was later on filling the DDL.

I don't understand why it happened that way.

Tom

"tshad" <ts**********@ftsolutions.com> wrote in message
news:O5****************@TK2MSFTNGP12.phx.gbl...
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I have a couple of stored procedures that are being called from my
Page_Load event.

They worked before, but now they are not working.

I am getting the error:

Specified argument was out of the range of valid values. Parameter name:
value

The function called is:

************************************************** *****
Sub GetExperienceLevel()
exit sub
Dim emailReader As SqlDataReader
trace.warn("inside GetExperienceLevel")
Dim ConnectionString as String
=System.Configuration.ConfigurationSettings.AppSet tings("MM_CONNECTION_STRING_ftsol")
Dim objConn as New SqlConnection (ConnectionString)
Dim CommandText as String = "Exec GetExperienceLevel"
Dim objCmd as New SqlCommand(CommandText,objConn)
objConn.Open()

ExperienceLevel.DataSource=objCmd.ExecuteReader
ExperienceLevel.DataTextField= "Description"
ExperienceLevel.DataValueField="ExperienceLevelID"
ExperienceLevel.databind()
ExperienceLevel.Items.Insert(0, "Select Experience Level")
ExperienceLevel.Items(0).value = 0
trace.warn("exiting GetExperienceLevel")
end sub
************************************************** ******


I tried to change the Stored procedure line to:

Dim CommandText as String = "Select ExperienceLevelID,Description from
ExperienceLevel order by ExperienceLevelID"

This came right from the Stored Procedure and works from Sql Query (as
does the SP).

Tom

It is dying on the databind() line.

The dropdown is:

Experience:<asp:DropDownList id="ExperienceLevel" runat="server"
/></td>

The data coming back is:

ExperienceLevelID Description
----------------- ----------------
10 Less than 1
20 1-2 Years
30 2-5 Years

Why is it not binding?

Thanks,

Tom


Nov 19 '05 #3

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

Similar topics

9
by: Zlatko Matić | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws...
3
by: Damon | last post by:
I am working on a site in which I would like to have two dropdowns that will allow a user to navigate through the administrative pages of the site. The first would allow the user to choose the...
0
by: riley.derrick | last post by:
To all the ASP.NET 2.0 Gurus, I am having a bit of a problem. Here is the situation. I have a created a web form that does the following. Has 2 dropdown lists that are databound to a SQL...
1
by: Chris | last post by:
I am programatically binding a datasouce to a dropdown. It is the names of employees that meet certain criteria. In the database they are stored as forename and surname. Aside from concatenating...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
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: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
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 ...

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.