473,385 Members | 1,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Unbind a DataSource and clear a DropDownList selection

on a test web page, I have two DropDownList fields. The data source for the second DDL field depends
on the value selected in the first DDL.

I want a Reset button that will re-initialize the DDL fields to their initial values. My problem is
that the second DDL cannot be re-initialized to a null/empty state. I do not want to see any data in
thesecond DDL field.

The following code worked in .Net 1.1

ddlField2.DataSource = string.empty;
ddlfield2.DataBind();
ddlFields2.SelectedIndex = 0;

However in .Net 2.0, that same code generates an ArgumentOutofRange expeption the second time the
above code is executed.

Is it possible to unbind a DDL field and have ASP.Net to clear the field on the web page?

Regards,

Gaetan
Jun 13 '06 #1
0 1495

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

Similar topics

4
by: theo | last post by:
Program flow...load file,then extract the xml text tags from the file,then the number of Xml tags retrieved from the file determines the number of dropdownlist controls instanciated in the...
3
by: Northern | last post by:
I need to write code clear the display box of my DropDownList (something like clear current selected item) while still keep the loaded item list in the DropDownList. I tried DropDownList's...
1
by: Chris | last post by:
Hi, I have a page with quite a few textboxes and dropdownlist controls. How can I clear the textboxes and reset the dropdownlist after the data is sent to the database? Do I have to perform ...
5
by: Grant Merwitz | last post by:
How do you unbind one of these web controls. I have a drop down list that based on another drop down list selection will be databouns private void BindDD2(int id) { DD2.DataSource =...
2
by: Marc Robitaille | last post by:
Hello, I set the DataSource property of a DropDownList to as DataSet that is filled from a SQLDataAdapter. The AutoPostBack property of that DropDownList is set to True. When the...
2
by: KC | last post by:
I want to remove or "unbind" a Datatable from a datagrid. Would I say, dt.Container.Dispose() where dt is the DataTable? --- Ken
3
by: Mark Rae | last post by:
Hi, Is it possible to use a Dictionary<int, stringor even Dictionary<string, stringas the DataSource for a DropDownList directly, i.e. without having to iterate through the the Dictionary's...
6
by: AG | last post by:
I have a dropdownlist bound to an objectdatasource. I need to loop through all the items in the datasource to get the values of a column that is not used as the datatextfield or the datavaluefield....
2
by: sachins5 | last post by:
I have a textbox which is bound to a datasource ... i am trying to unbind it and rebind it down the code ... I was wondering if anyone could give me a clue on how to unbind it .... a worked out...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.