473,544 Members | 1,959 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DropDownList SelectedValue returning "out of the range"

Here's my function:

public void getInterestLeve lDDL(string co_interest_lev el)
{
sql = [valid sql];

//get_select_list creates a valid ICollection datatable
ctrlDDL_CIL.Dat aSource = tools.get_selec t_list(sql);
ctrlDDL_CIL.Dat aTextField = "value";
ctrlDDL_CIL.Dat aValueField = "key";
try
{
ctrlDDL_CIL.Sel ectedValue = co_interest_lev el;
ctrlDDL_CIL.Dat aBind();

}
catch
{
ctrlDDL_CIL.Sel ectedValue = "0";
ctrlDDL_CIL.Dat aBind();

}

}

If co_interest_lev el is in the range of dropdownlist values, I've no
problems. However, sometimes it's not, but I can't seem to get the code
to return a default gracefully. This example fails on the second
DataBind() with the error "Specified argument was out of the range of
valid values. Parameter name: value". However, the value "0" is ALWAYS
in the list, as I've made it part of the get_select_list return value.
Also, I've tried a ClearSelection( ), but that doesn't seem to do a thing...

I'd sure appreciate any help!

--Brent
Dec 1 '05 #1
2 3133
Hi,

I dont think DataBind() call in the catch block is required.

"Brent" <"writeBrent at the google mail p" wrote:
Here's my function:

public void getInterestLeve lDDL(string co_interest_lev el)
{
sql = [valid sql];

//get_select_list creates a valid ICollection datatable
ctrlDDL_CIL.Dat aSource = tools.get_selec t_list(sql);
ctrlDDL_CIL.Dat aTextField = "value";
ctrlDDL_CIL.Dat aValueField = "key";
try
{
ctrlDDL_CIL.Sel ectedValue = co_interest_lev el;
ctrlDDL_CIL.Dat aBind();

}
catch
{
ctrlDDL_CIL.Sel ectedValue = "0";
ctrlDDL_CIL.Dat aBind();

}

}

If co_interest_lev el is in the range of dropdownlist values, I've no
problems. However, sometimes it's not, but I can't seem to get the code
to return a default gracefully. This example fails on the second
DataBind() with the error "Specified argument was out of the range of
valid values. Parameter name: value". However, the value "0" is ALWAYS
in the list, as I've made it part of the get_select_list return value.
Also, I've tried a ClearSelection( ), but that doesn't seem to do a thing...

I'd sure appreciate any help!

--Brent

Dec 1 '05 #2
Hi,

You have the DataBind incorrectly , it should be:
try
{
ctrlDDL_CIL.Dat aBind();
ctrlDDL_CIL.Sel ectedValue = co_interest_lev el;
}
And remove the DataBind in the catch block
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Brent" <"writeBrent at the google mail place"> wrote in message
news:11******** *****@corp.supe rnews.com...
Here's my function:

public void getInterestLeve lDDL(string co_interest_lev el)
{
sql = [valid sql];

//get_select_list creates a valid ICollection datatable
ctrlDDL_CIL.Dat aSource = tools.get_selec t_list(sql);
ctrlDDL_CIL.Dat aTextField = "value";
ctrlDDL_CIL.Dat aValueField = "key";
try
{
ctrlDDL_CIL.Sel ectedValue = co_interest_lev el;
ctrlDDL_CIL.Dat aBind();

}
catch
{
ctrlDDL_CIL.Sel ectedValue = "0";
ctrlDDL_CIL.Dat aBind();

}

}

If co_interest_lev el is in the range of dropdownlist values, I've no
problems. However, sometimes it's not, but I can't seem to get the code to
return a default gracefully. This example fails on the second DataBind()
with the error "Specified argument was out of the range of valid values.
Parameter name: value". However, the value "0" is ALWAYS in the list, as
I've made it part of the get_select_list return value. Also, I've tried a
ClearSelection( ), but that doesn't seem to do a thing...

I'd sure appreciate any help!

--Brent

Dec 1 '05 #3

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

Similar topics

15
2631
by: Marc Le Roy | last post by:
Hello, ADA Ravenscar is a restricted subset of the ADA language that has been defined for real-time software development in safety critical applications. Completed with additional restrictions like the ones defined in the SPARK profile, it allow to build very deterministic applications that support automatic static code analysis and...
3
3470
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
2509
by: Clark Choi | last post by:
I ran the sample application called Petstore from msdn. Everything went fine until I tested Update button on the web form to update the database through Datagrid. I have been searching the web to track down this error, but none of them really explain this problem/solution very well. I tried hard to debug this, but debuggin itself was...
2
7639
by: Lenonardo | last post by:
Hi. I'm writing a VB.Net application to update multiple Excel Worksheets. I'm using late binding (i.e. all variables are objects + use createobject) I develop the application on an XP machine with Excel 2002 (version 10.0) installed - and the code works fine. I then test the code on a laptop running Excel 2000 (version 9.0) and it
0
1088
by: H5N1 | last post by:
hi all it's extremely common scenario, so I would like to ask you how do you usually implement CRUD functionality for following structure. Basically it's all about displaying "foreign name" (ie. some textual description) instead of foreign key. GUI:
1
3235
by: tkpmep | last post by:
I write data to Excel files using PyExcelerator 0.6.3.a and have done so successfully for small files (10-15 cells). I'm experiencing an error when writing a big chunk of data (10,000 cells) to Excel. By way of comparison, the same data writes perfectly well to a csv file using Python's built in csv module. I run the program in PyScripter, and...
8
28461
by: sam | last post by:
hey everybody, this is my first time posting here. i'm pretty new to python and programming in general (as you'll soon work out for yourselves...) i'm trying to code a version of a selection sort and the heart of the code is as follows (no_lines is simply the number of items to be sorted, read out of an input file): for j in range(0,...
3
3197
by: dvanderwel | last post by:
I have a .NET 1.1 web page with a DataGrid containing a TemplateColumn that contains a DropDownList. I need to fire an event when the selected item in the DropDownList changes for the current DataGrid row, and I'm having trouble figuring out how to do this. Other control types I have defined the "CommandName" property in the aspx file. ...
0
3416
by: CoreyReynolds | last post by:
Hey all, I have a piece of code that dumps a bunch of data into a spreadsheet. Also rearranges it into a pivot table and then graphs the pivot table as well so my boss can get a clear view of the data. This question is two part. One, I seem to be getting the title error at the starting line stating: oSheet.Range(rng).Select ...
0
7387
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
7643
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
7798
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...
1
7405
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
5956
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
5316
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
3441
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...
1
1862
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
0
688
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.