473,396 Members | 1,972 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,396 software developers and data experts.

Problem in displaying DropDownList in .NET

4
Hi All,

I am trying populate dropdownlist using SQL query. I am able to bind the list and populate it with query result. But in Dropdown list it shows 1st result of a query as a default value. I want to show a default value such as **select customer**. I am able to add this value in first page but having problem when running it. I am using Visual Web Developer ,C#.NET and SQL Server 2000.

Dropdown list has textfield as Customername(varchar) and valuefield as customerID(int).

When I build my page 1st time it runs fine. I can select and change my selection in dropdown list but when I again select **Select Customer** my code breaks.

I am writting :
ddl1.Items.Insert(0,"**Select Customer**");

it gives me following error :
Syntax error converting the varchar value '**Select Customer**' to a column of data type int.

Please Help me!
Nov 21 '06 #1
0 1135

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
6
by: Pat | last post by:
When selecting a DropDownlList to display some Data based on the ddl.SelectedItem.Value since a dropdownlist index starts from 0.. After selecting for example value1 and 2 which its ok but when...
2
by: Dabbler | last post by:
I have a number of rows in a GridView Column which don't have values for the DropDownList, is there a way to hide the control if it has no data? Here's my code: <ItemTemplate> <asp:DropDownList...
2
by: Yoshitha | last post by:
I've an windows application developed using vb.net( vs2003) and i'm testing this application on windows xp professional. my application is having only one form the size of the form is height :...
0
by: Frank | last post by:
Hello All, I am working with VS.NET 2005 and I have an editable GridView whose HTML markup is shown below. In short, when the user clicks on the Edit button, one of the textboxes is replaced...
0
by: Frank | last post by:
Hello All, I am working with VS.NET 2005 and I have an editable GridView whose HTML markup is shown below. In short, when the user clicks on the Edit button, one of the textboxes is replaced...
6
by: Zeba | last post by:
Hi, I have a page with a calendar and two datalist items - one containing month values and the other, year values. Depending on the month/year value chosen ( in text/string format ) I should be...
1
by: rajiv Joshi | last post by:
Hi all I m displaying locations from database in the dropdownlist box using C# .Its displaying all locations properly but when i select loacation from dropdown it is always displaying first item...
10
by: bhappy | last post by:
Hai All, im facing different problem with ajax. Im using ajax code for country,state & city dropdownlists. In city dropdownlist i had an option to add new city.Im selecting other option in city...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
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...
0
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...

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.