473,804 Members | 4,128 Online
Bytes | Software Development & Data Engineering Community
+ 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 GetExperienceLe vel()
exit sub
Dim emailReader As SqlDataReader
trace.warn("ins ide GetExperienceLe vel")
Dim ConnectionStrin g as String
=System.Configu ration.Configur ationSettings.A ppSettings("MM_ CONNECTION_STRI NG_ftsol")
Dim objConn as New SqlConnection (ConnectionStri ng)
Dim CommandText as String = "Exec GetExperienceLe vel"
Dim objCmd as New SqlCommand(Comm andText,objConn )
objConn.Open()

ExperienceLevel .DataSource=obj Cmd.ExecuteRead er
ExperienceLevel .DataTextField= "Descriptio n"
ExperienceLevel .DataValueField ="ExperienceLev elID"
ExperienceLevel .databind()
ExperienceLevel .Items.Insert(0 , "Select Experience Level")
ExperienceLevel .Items(0).value = 0
trace.warn("exi ting GetExperienceLe vel")
end sub
*************** *************** *************** ***********

It is dying on the databind() line.

The dropdown is:

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

The data coming back is:

ExperienceLevel ID 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 1104
"tshad" <ts**********@f tsolutions.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.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 GetExperienceLe vel()
exit sub
Dim emailReader As SqlDataReader
trace.warn("ins ide GetExperienceLe vel")
Dim ConnectionStrin g as String
=System.Configu ration.Configur ationSettings.A ppSettings("MM_ CONNECTION_STRI NG_ftsol")
Dim objConn as New SqlConnection (ConnectionStri ng)
Dim CommandText as String = "Exec GetExperienceLe vel"
Dim objCmd as New SqlCommand(Comm andText,objConn )
objConn.Open()

ExperienceLevel .DataSource=obj Cmd.ExecuteRead er
ExperienceLevel .DataTextField= "Descriptio n"
ExperienceLevel .DataValueField ="ExperienceLev elID"
ExperienceLevel .databind()
ExperienceLevel .Items.Insert(0 , "Select Experience Level")
ExperienceLevel .Items(0).value = 0
trace.warn("exi ting GetExperienceLe vel")
end sub
*************** *************** *************** ***********
I tried to change the Stored procedure line to:

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

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="ExperienceL evel" runat="server"
/></td>

The data coming back is:

ExperienceLevel ID 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 ("ExperienceLev el") is DBNull.Value) then
ExperienceLevel .SelectedValue = PositionReader( "ExperienceLeve l")
end if

If I don't try to fill the Dropdownlist, I get the following code rendered.
*************** *************** *************** *********
Experience:<sel ect name="Experienc eLevel" id="ExperienceL evel">
</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**********@f tsolutions.com> wrote in message
news:O5******** ********@TK2MSF TNGP12.phx.gbl. ..
"tshad" <ts**********@f tsolutions.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.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 GetExperienceLe vel()
exit sub
Dim emailReader As SqlDataReader
trace.warn("ins ide GetExperienceLe vel")
Dim ConnectionStrin g as String
=System.Configu ration.Configur ationSettings.A ppSettings("MM_ CONNECTION_STRI NG_ftsol")
Dim objConn as New SqlConnection (ConnectionStri ng)
Dim CommandText as String = "Exec GetExperienceLe vel"
Dim objCmd as New SqlCommand(Comm andText,objConn )
objConn.Open()

ExperienceLevel .DataSource=obj Cmd.ExecuteRead er
ExperienceLevel .DataTextField= "Descriptio n"
ExperienceLevel .DataValueField ="ExperienceLev elID"
ExperienceLevel .databind()
ExperienceLevel .Items.Insert(0 , "Select Experience Level")
ExperienceLevel .Items(0).value = 0
trace.warn("exi ting GetExperienceLe vel")
end sub
*************** *************** *************** ***********


I tried to change the Stored procedure line to:

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

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="ExperienceL evel" runat="server"
/></td>

The data coming back is:

ExperienceLevel ID 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
10431
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 As DAO.Workspace Dim db As DAO.Database Dim qdf As DAO.QueryDef Dim rs As DAO.Recordset
3
1592
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 particular site that they would like to edit. The second would allow the user to select which admin screen they would like to edit. The second dropdown needs to be populated based on the selection in the first one. I want to encapsulate these...
0
1463
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 Datasource. Has 2 calendar controls with 2 dropdowns (month/year) per Calendar. The calendars are edited/modified so that the user can choose a Month and a Year for a particular calendar and the calendar control updates and displays that particular month...
1
1389
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 them in the query how do I do it programatically. I.e. drp.DataTextName = "Forename" & "Surname"
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10577
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9150
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6853
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5521
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4299
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
3
2991
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.