473,569 Members | 2,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Specified argument was out of the range of valid values. Par

I'm getting following error in asp.net application.I search the web
and couldn't find error like this can any one help me in trouble with
this error

Specified argument was out of the range of valid values.
Parameter name: U Description: An unhandled exception
occurred during the execution of the current web request. Please
review the stack trace for more information about the error and where
it originated in the code.

Exception Details: System.Argument OutOfRangeExcep tion: Specified
argument was out of the range of valid values. Parameter name: U

Source Error:
Line 120: {
Line 121: //if(val.Length > 0)
Line 122: ((ListBox)contr ol).SelectedVal ue = val;
Line 123:
Line 124:
Source File: c:\inetpub\wwwr oot\pplproot\ca reers\cfieldmap ping.cs
Line: 122

Stack Trace:
[ArgumentOutOfRa ngeException: Specified argument was out of the range
of valid values.
Parameter name: U]
System.Web.UI.W ebControls.List Control.set_Sel ectedValue(Stri ng
value) +152
Careers.CFieldM apping.setValue (DataRow row) in
c:\inetpub\wwwr oot\pplproot\ca reers\cfieldmap ping.cs:122
Careers.SubmitR esume.loadForm( DCandidateInfo data) in
c:\inetpub\wwwr oot\pplproot\ca reers\submitres ume.aspx.cs:130
Careers.SubmitR esume.Page_Load (Object sender, EventArgs e) in
c:\inetpub\wwwr oot\pplproot\ca reers\submitres ume.aspx.cs:76
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.P age.ProcessRequ estMain() +750

Nov 18 '05 #1
9 5799
It sounds like the value you're using does not already exist in the list of
values in the ListBox.
Nov 18 '05 #2
Hi subhar:

Your ListBox control is trying to set the selected value to val, but
val does not exist as an option in the ListBox. You need to find out
why you are setting val to an illegal value, which is something we
cannot answer looking at this bit of code.

HTH,

--
Scott
http://www.OdeToCode.com/
On 30 Sep 2004 13:03:29 -0500,
su************* @yahoo-dot-com.no-spam.invalid (subdhar) wrote:
I'm getting following error in asp.net application.I search the web
and couldn't find error like this can any one help me in trouble with
this error

Specified argument was out of the range of valid values.
Parameter name: U Description: An unhandled exception
occurred during the execution of the current web request. Please
review the stack trace for more information about the error and where
it originated in the code.

Exception Details: System.Argument OutOfRangeExcep tion: Specified
argument was out of the range of valid values. Parameter name: U

Source Error:
Line 120: {
Line 121: //if(val.Length > 0)
Line 122: ((ListBox)contr ol).SelectedVal ue = val;
Line 123:
Line 124:
Source File: c:\inetpub\wwwr oot\pplproot\ca reers\cfieldmap ping.cs
Line: 122

Stack Trace:
[ArgumentOutOfRa ngeException: Specified argument was out of the range
of valid values.
Parameter name: U]
System.Web.UI.W ebControls.List Control.set_Sel ectedValue(Stri ng
value) +152
Careers.CFieldM apping.setValue (DataRow row) in
c:\inetpub\www root\pplproot\c areers\cfieldma pping.cs:122
Careers.SubmitR esume.loadForm( DCandidateInfo data) in
c:\inetpub\www root\pplproot\c areers\submitre sume.aspx.cs:13 0
Careers.SubmitR esume.Page_Load (Object sender, EventArgs e) in
c:\inetpub\www root\pplproot\c areers\submitre sume.aspx.cs:76
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.P age.ProcessRequ estMain() +750


Nov 18 '05 #3

Scott,
Below is the full code which ,where my list box is accessing the
"val" value.
//code/////

public void setValue(DataRo w row)
{
String val = null;
if(row[columnName].GetType() != typeof(DBNull))
val = (string) row[columnName];
else
val = "";

if(control.GetT ype() == typeof(TextBox) )
((TextBox)contr ol).Text = val;
else if(control.GetT ype() == typeof(ListBox) )
{
//if(val.Length > 0)
((ListBox)contr ol).SelectedVal ue = val;
}
else if(control.GetT ype() == typeof(Label))
((Label)control ).Text = val;
}
// code end here-------------------------
Below is the asp.net tracing
aspx.page Begin Init
aspx.page End Init 0.001449 0.001449
Unhandled Execution Error
Specified argument was out of the range of valid values.
Parameter name: U
at System.Web.UI.W ebControls.List Control.set_Sel ectedValue(Stri ng
value)
at Careers.CFieldM apping.setValue (DataRow row) in
c:\inetpub\wwwr oot\pplproot\ca reers\cfieldmap ping.cs:line 122
at Careers.SubmitR esume.loadForm( DCandidateInfo data) in
c:\inetpub\wwwr oot\pplproot\ca reers\submitres ume.aspx.cs:lin e 130
at Careers.SubmitR esume.Page_Load (Object sender, EventArgs e) in
c:\inetpub\wwwr oot\pplproot\ca reers\submitres ume.aspx.cs:lin e 76
at System.Web.UI.C ontrol.OnLoad(E ventArgs e)
at System.Web.UI.C ontrol.LoadRecu rsive()
at System.Web.UI.P age.ProcessRequ estMain() 0.161009 0.159560
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4
You might want to step through the code with the debugger and see what
is in the following line of code:
val = (string) row[columnName];


It would appear this does not return a value that is in the list.
You'll need to reconcile these differences, either by adding all
possible value for that column into the list, or restricting the
values appearing in the column with your SQL query (assuming this is
coming from a database).

--
Scott
http://www.OdeToCode.com/

Nov 18 '05 #5
Hi,
I am facing similar problem, but coulnt fix the bug.
I thing its not bug in our code but in .NET Framework itself.

I am using a global function to bind the dropdownlist

code
Public Sub BindComboBox(By Ref cmb As DropDownList, ByRef sql As
String)
Dim dv As DataView
dv = GetDataView(sql )
cmb.DataValueFi eld = dv.Table.Column s(0).ColumnName
cmb.DataTextFie ld = dv.Table.Column s(1).ColumnName
cmb.DataSource = dv
If dv.Count > 0 Then
cmb.DataBind()
End If
End Sub

I have used this sub in some other page which is working fine. Not just
that but it worked well till last monday, But its giving me errors now,
which i am not able to fix.

In debug mode, i traced down the values, and found the query (sql) what
i am passing is returning 2 rows.

I am worried about the mistifying behaviour of .NET which with same
piece of code works some times and soemtimes doest.

Gurus..., have any clue?
=============== =============== ==========
==************* **@yahoo.com=== ==========
=============== =============== ==========
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #6
You say the data has 2 rows, but are you sure the result also has at
least 2 columns?
--
Scott
http://www.OdeToCode.com/blogs/scott/
On Mon, 08 Nov 2004 01:10:04 -0800, vb bomb <vb****@yahoo.c om> wrote:
Hi,
I am facing similar problem, but coulnt fix the bug.
I thing its not bug in our code but in .NET Framework itself.

I am using a global function to bind the dropdownlist

code
Public Sub BindComboBox(By Ref cmb As DropDownList, ByRef sql As
String)
Dim dv As DataView
dv = GetDataView(sql )
cmb.DataValueFi eld = dv.Table.Column s(0).ColumnName
cmb.DataTextFie ld = dv.Table.Column s(1).ColumnName
cmb.DataSource = dv
If dv.Count > 0 Then
cmb.DataBind()
End If
End Sub

I have used this sub in some other page which is working fine. Not just
that but it worked well till last monday, But its giving me errors now,
which i am not able to fix.

In debug mode, i traced down the values, and found the query (sql) what
i am passing is returning 2 rows.

I am worried about the mistifying behaviour of .NET which with same
piece of code works some times and soemtimes doest.

Gurus..., have any clue?
============== =============== ===========
===========vb* ***@yahoo.com== ===========
============== =============== ===========
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 18 '05 #7
yes, if you absorve my code I am using dv.table.colums (0).columnname

If it didnt getch the 2 columns, in my code, the very next code would
give index out of range error, isnt it?.

But after long hours I solved it.

NOW I AM ROLLING BACK MY WORDS I SAID ABOUT .NET FRAMEWORK.

It was a small mistake(no its big), which was accidently modified by me.

after finding the grid, i was suppose to select the username with the
userid which i fetched from db.
For that instread of giving combobox.select edvalue=datafie ldvalue i gave
datatextvalue

it was something like this, i have userid and username columsn fecthed
and binded combobox

in my code to select the desired user in combobox, i gave
cmbReportsTo.Se lectedValue=som evalue
somevalue should be userid (but i gave username value)

thats it.

bye

=============== =============== ==========
===========vbbo mb at yahoo dot com============ =
=============== =============== ==========
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #8
Hi subdhar,

Is your problem resolved?
I thing the val at
Line 122: ((ListBox)contr ol).SelectedVal ue = val
in your code is returning the DataTextField, it should match with the
DataValueField.

Bye
=============== =============== ==========
===========vbbo mb at yahoo dot com============ =
=============== =============== ==========
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #9
The default value is set as "U" as the default value in the database is
'U',Somehow .Net didn't like this string value "U".As I was debugging
someone code,I couldn't make out where this value is coming.Even if the
default value is set "U",It's giving under paramemter error.I trick the
code and make the code works.

Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #10

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

Similar topics

3
3472
by: Michael Conroy | last post by:
Hi... Synposis... Throws exception: "Specified argument was out of the range of valid values." Read on for the juicy tidbits. MySimpleClassCol mscc=new MySimpleClassCol(); private void InitCombo() {
1
1514
by: Shakthi | last post by:
Hi, Pls let me how to solve this error "Specified argument out of range" Pls find the code below and let me know the solution. Public Class viewcart Inherits System.Web.UI.Page Protected WithEvents Cart As System.Web.UI.WebControls.DataGrid Protected WithEvents Label7 As System.Web.UI.WebControls.Label Protected WithEvents Label5 As...
4
16966
by: Todd Perkins | last post by:
Hello all, surprisingly enough, this is my first newsgroup post, I usually rely on google. So I hope I have enough info contained. Thank you in advance for any help! Problem: I am getting this error when I try to pull up my edit page to display the current database information in the form, and then edit it on click:
0
1391
by: darrel | last post by:
What does this error mean? Specified argument was out of the range of valid values. Parameter name: value System.Web It's being thrown here: DDL_SubCategory.Enabled = True DDL_SubCategory.DataSource = DS
0
3493
by: rajarameshvarma | last post by:
Hi.... I have a serious problem while deploying my asp.net application. I have developed a web project in which everypage contains Header, Left navigation and footer as usercontrols. For center court i have used Ifrmae tag to call an HTML page. It was working fine for most of the pages it is working fine. But for some pages...user controls...
1
2612
by: IndiraPriyaDarshini | last post by:
Hi , Am trying to sum the total in the footer if a gridview, but am getting the error "Specified argument was out of the range of valid values. Parameter name: index "..Its Printing one cell value in the footer.. But for the seond sum,it showing the error, the value is getting, Help me pls.. Here is the ode snippent
6
3675
by: rhepsi | last post by:
Hi All... I Came across this error while populating a combobox from a datatable (I'm working in VB.NET): Specified argument was out of the range of valid values. Parameter name: '-1' is not a valid value for 'index'
0
1523
by: gsauns | last post by:
I have a DetailsView which is inside of a FormView. I lifted this DetailsView straight off another one of my pages, where it was working beautifully. Now I get this endlessly frustrating error message whenever I try to go into Edit mode: Specified argument was out of the range of valid values. Parameter name: index The DetailsView is...
2
3082
by: Chapi | last post by:
hi, i'm having problems with a datagrid paging. it's populates fine, but when i click the paging button appears this error:"Specified argument was out of the range of valid values.Parameter name: index" I paste the code here in case someone can help me. Sub paginaNueva(ByVal sender As Object, ByVal e As...
0
7703
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...
1
7678
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
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
6286
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
5514
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
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
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
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
944
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.