Hi,
I'm using the DataSource and SqlDataSource to insert value in my
dropdownlist, but i want to add a -- Please Select -- at the top of the
list, but can't find a way to make it.
<asp:DropDownList ID="ddTown" runat="server" DataSourceID="SqlDataSource1"
DataTextField="idTown" DataValueField="idTown"></asp:DropDownList>
Here's some try i've made, with no success :
ddTown.Items.Add("-- Please select --")
ddTown.Items.Add(New ListItem("-- Please select --"))
ddTown.Items.Insert(0, New ListItem("-- Please select --"))
ddTown.Items.Insert(0, "-- Please select --")
Did someone have a way to make it ?
Thank you 5 4718
Code below has to work..Where uve tried adding these lines of code?
"Andre" wrote: Hi,
I'm using the DataSource and SqlDataSource to insert value in my dropdownlist, but i want to add a -- Please Select -- at the top of the list, but can't find a way to make it.
<asp:DropDownList ID="ddTown" runat="server" DataSourceID="SqlDataSource1" DataTextField="idTown" DataValueField="idTown"></asp:DropDownList>
Here's some try i've made, with no success :
ddTown.Items.Add("-- Please select --") ddTown.Items.Add(New ListItem("-- Please select --")) ddTown.Items.Insert(0, New ListItem("-- Please select --")) ddTown.Items.Insert(0, "-- Please select --")
Did someone have a way to make it ?
Thank you
The code is in the Page_Load Sub...
Work very well if i delete the DataSource of the DropDownlist... maybe my
inserted item is overwrited by the DataSource !!?
"Santhi Maadhaven" <Sa*************@discussions.microsoft.com> a écrit dans
le message de news: 95**********************************@microsoft.com... Code below has to work..Where uve tried adding these lines of code?
"Andre" wrote:
Hi,
I'm using the DataSource and SqlDataSource to insert value in my dropdownlist, but i want to add a -- Please Select -- at the top of the list, but can't find a way to make it.
<asp:DropDownList ID="ddTown" runat="server" DataSourceID="SqlDataSource1" DataTextField="idTown" DataValueField="idTown"></asp:DropDownList>
Here's some try i've made, with no success :
ddTown.Items.Add("-- Please select --") ddTown.Items.Add(New ListItem("-- Please select --")) ddTown.Items.Insert(0, New ListItem("-- Please select --")) ddTown.Items.Insert(0, "-- Please select --")
Did someone have a way to make it ?
Thank you
inserted item is overwritten by the DataSource during the databind.
add your code *after* the databind and you should be fine
On Wed, 07 Dec 2005 11:42:16 -0500, Andre wrote: The code is in the Page_Load Sub...
Work very well if i delete the DataSource of the DropDownlist... maybe my inserted item is overwrited by the DataSource !!? "Santhi Maadhaven" <Sa*************@discussions.microsoft.com> a écrit dans le message de news: 95**********************************@microsoft.com... Code below has to work..Where uve tried adding these lines of code?
"Andre" wrote:
Hi,
I'm using the DataSource and SqlDataSource to insert value in my dropdownlist, but i want to add a -- Please Select -- at the top of the list, but can't find a way to make it.
<asp:DropDownList ID="ddTown" runat="server" DataSourceID="SqlDataSource1" DataTextField="idTown" DataValueField="idTown"></asp:DropDownList>
Here's some try i've made, with no success :
ddTown.Items.Add("-- Please select --") ddTown.Items.Add(New ListItem("-- Please select --")) ddTown.Items.Insert(0, New ListItem("-- Please select --")) ddTown.Items.Insert(0, "-- Please select --")
Did someone have a way to make it ?
Thank you
It gets overwritten.
What you need is to insert into the datasource.
Woa... i did'nt know that i can insert Databind() directly without creating
a function Databind() ;o)
Everything's PERFECT.
Thank you.
"addup" <ad*****@gmail.com> a écrit dans le message de news: 11*********************@g47g2000cwa.googlegroups.c om... inserted item is overwritten by the DataSource during the databind. add your code *after* the databind and you should be fine This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Stanley J Mroczek |
last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ?
<Columns>
<asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True"
HeaderText="Option...
|
by: DotNetJunky |
last post by:
I have built a control that runs an on-line help system. Depending on the
category you selected via dropdownlist, it goes out and gets the child
subcategories, and if there are any, adds a new...
|
by: Dominic |
last post by:
Hi guys,
I'm not sure if this question belongs to FAQ, but I couldn't find a
concrete answer.
I created a Datagrid control using ItemTemplate, but it's NOT a
in-place editing datagrid. One of...
|
by: Shiju Poyilil |
last post by:
Hello,
I have a datagrid with only one row and its having 2 dropdownlists, I need
to populate the secodn dropdownlist on the basis of the selection in the
first dropdown. but I am not able to...
|
by: Sacha Korell |
last post by:
I'm trying to load a drop-down list with all DropDownList control names from
another page.
How would I be able to find those DropDownList controls? The FindControl
method will only find a...
|
by: glenn |
last post by:
Hi folks,
I have a DropDownList in a DataGrid that is populated from records in a
database.
I want to add a value that might be a string such as "Select a Company" for
the first item since an...
|
by: MaryamSh |
last post by:
Hi,
I am creating a Dynamic Search in my application.
I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove)
By pressing Add button...
|
by: MaryamSh |
last post by:
Create Dynamic Dropdownlist Controls and related event
--------------------------------------------------------------------------------
Hi,
I am creating a Dynamic Search in my application.
I...
|
by: Brett |
last post by:
I have a DropDownList in an ASP.NET web form that is populated with items
from a lookup table by binding that DropDownList to a SqlDataSource.
However, the items in the lookup table can change over...
|
by: asmx126453 |
last post by:
Hey mensen
I am having some big troubles here i tryd solving it myself with internet for 2 days but i kind fix it.
Its about this i have a DotNet project that alrydi is online and working for...
|
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,...
|
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$) {
}
...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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...
|
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,...
|
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...
| |