Ask a Question related to ASP.NET General, Design and Development.
-
Mira Vizjak #1
DropDownList
Hi
I looked everywhere to solve my problem but with no success. On page there
is a dropdownlist control which is binded to a database. When I select one
of the list item and press a button I would like to get the SelectedItem
property, but it is always set to Nothing. What should i do? On page load I
use Page.IsPostBack=false to load the dropdownlist only once.
Thanks!
Jure
Mira Vizjak Guest
-
Dropdownlist Cascade
Hi Guys I have two dropdownlists (A and B) Both get their values from a database When i select a value from dropdownlist A It is suppose to do... -
Dropdownlist help please
Hi there, I'm a newbie to Dreamweaver MX 2004 and ASP.NET. I'm having trouble with a simple application that involves the user selecting a value... -
Add a dropDownList
Hello, Could you please give me an exemple how to add a dropdownlist in a datagrid. With this following code, I bind a datatable to a datagrid,... -
HELP with ASP.NET DropDownList Box ! : )
Hi all, I have a DropDownList on my page created in Design Time calledddlDate. In code, I do the following: 1 ddlDate = New DropDownList() <-... -
<asp:DropDownList >
It just doesn't work like that - - you need to either bind data to the datalist in code, or manually add the items, one by one, where you're doing... -
Sonali.NET[MVP] #2
Re: DropDownList
Have you set AutoPostBack =true of Ddl
Regards
Sushila
..NET MVP
"Mira Vizjak" <mira.vizjak1@guest.arnes.si> wrote in message news:berr1k$ljg$1@planja.arnes.si...> Hi
> I looked everywhere to solve my problem but with no success. On page there
> is a dropdownlist control which is binded to a database. When I select one
> of the list item and press a button I would like to get the SelectedItem
> property, but it is always set to Nothing. What should i do? On page load I
> use Page.IsPostBack=false to load the dropdownlist only once.
> Thanks!
>
> Jure
>
>Sonali.NET[MVP] Guest
-
Mira Vizjak #3
Re: DropDownList
I don't want the page to reload so I can't use AutoPostBack=true.
Mira Vizjak Guest
-
Souri Challa #4
Re: DropDownList
Did you set the 'EnableViewState' to true for the dropdownlist ?
"Mira Vizjak" <mira.vizjak1@guest.arnes.si> wrote in message
news:berr1k$ljg$1@planja.arnes.si...I> Hi
> I looked everywhere to solve my problem but with no success. On page there
> is a dropdownlist control which is binded to a database. When I select one
> of the list item and press a button I would like to get the SelectedItem
> property, but it is always set to Nothing. What should i do? On page load> use Page.IsPostBack=false to load the dropdownlist only once.
> Thanks!
>
> Jure
>
>
Souri Challa Guest
-
dj Bass #5
Re: DropDownList
the item in a check list has a value and item text, are you setting the item
value?
"Mira Vizjak" <mira.vizjak1@guest.arnes.si> wrote in message
news:berr1k$ljg$1@planja.arnes.si...I> Hi
> I looked everywhere to solve my problem but with no success. On page there
> is a dropdownlist control which is binded to a database. When I select one
> of the list item and press a button I would like to get the SelectedItem
> property, but it is always set to Nothing. What should i do? On page load> use Page.IsPostBack=false to load the dropdownlist only once.
> Thanks!
>
> Jure
>
>
dj Bass Guest
-
abacnet #6
Re: Dropdownlist
Try this after DropDownList1.DataBind ():
DropDownList1.SelectedIndex =
DropDownList1.Items.IndexOf(DropDownList1.Items.Fi ndByValue(yourKnownAuthID)
)
What you need is basically set the selectedindex property.
But first you find the list item that has the known Author ID.
This (DropDownList1.Items.FindByValue(yourKnownAuthID)) returns a list item.
This (DropDownList1.Items.IndexOf) gets the index of the listItem element
with the known value.
"Srinivasa Reddy K Ganji" <gksreddy@adsgroup.com> wrote in message
news:%23TJ1mwzWDHA.1480@tk2msftngp13.phx.gbl...that> Hi,
>
> I have the following code in Page_Load. I know the author id and I wantpage> particular author to be shown as selected in the drop downlist when the> loads. Can anyone suggest me how to do this.
>
> string dsn = ConfigurationSettings.AppSettings["testDsn"];
> SqlConnection connection = new SqlConnection (dsn);
> SqlDataAdapter adapter = new SqlDataAdapter ("select * from authors",
> connection);
> DataSet ds = new DataSet ();
> adapter.Fill (ds, "authors");
> DropDownList1.DataSource = ds;
> DropDownList1.DataTextField = "au_fname";
> DropDownList1.DataValueField = "au_id";
> DropDownList1.DataBind ();
>
> Thanks,
>
>
> Reddy
>
>
abacnet Guest
-
Reddy #7
Re: Dropdownlist
That worked. Thanks a lot
"abacnet" <abacnet@hotmail.com> wrote in message
news:uVQ6u3zWDHA.1580@tk2msftngp13.phx.gbl...DropDownList1.Items.IndexOf(DropDownList1.Items.Fi ndByValue(yourKnownAuthID)> Try this after DropDownList1.DataBind ():
> DropDownList1.SelectedIndex =
>item.> )
>
> What you need is basically set the selectedindex property.
> But first you find the list item that has the known Author ID.
> This (DropDownList1.Items.FindByValue(yourKnownAuthID)) returns a list> This (DropDownList1.Items.IndexOf) gets the index of the listItem element
> with the known value.
>
> "Srinivasa Reddy K Ganji" <gksreddy@adsgroup.com> wrote in message
> news:%23TJ1mwzWDHA.1480@tk2msftngp13.phx.gbl...> that> > Hi,
> >
> > I have the following code in Page_Load. I know the author id and I want> page> > particular author to be shown as selected in the drop downlist when the>> > loads. Can anyone suggest me how to do this.
> >
> > string dsn = ConfigurationSettings.AppSettings["testDsn"];
> > SqlConnection connection = new SqlConnection (dsn);
> > SqlDataAdapter adapter = new SqlDataAdapter ("select * from authors",
> > connection);
> > DataSet ds = new DataSet ();
> > adapter.Fill (ds, "authors");
> > DropDownList1.DataSource = ds;
> > DropDownList1.DataTextField = "au_fname";
> > DropDownList1.DataValueField = "au_id";
> > DropDownList1.DataBind ();
> >
> > Thanks,
> >
> >
> > Reddy
> >
> >
>
Reddy Guest
-
Ana Rita #8
DropDownList
Hello to all.
I´m trying to use a string, to build the ListItem's of a
DropDownList.
I declare a Public str as string in the webform1.aspx.vb,
and in the page load I build the string like this:
str = "<asp:ListItem value='0'>Blue</asp:ListItem>
<asp:ListItem value='1'>Red</asp:ListItem>"
In the webform1.aspx, html mode, I call the str within the
tag <asp:DropDownList>, like this <%str%>. As I expected,
it gives an error, saying that I can't use this type of
calls.
I want to Know, if it's possible to do something like we
do in asp to build a select object using a string with the
<options>.
Thank you all.
Best wishes.
Ana Rita
Ana Rita Guest
-
anonymous #9
DropDownList
In a drop down list you can assing the value from
recordset like this:
country.DataTextField = "country"
country.DataValueField = "Code"
What if I need to assign more value to a DataValueField
from a recordset. Something like this:
country.DataTextField = "country"
country.DataValueField(1) = "Code"
country.DataValueField(2) = "Code1"
How do I do this?
anonymous Guest
-
Eliyahu Goldin #10
Re: DropDownList
Merge all values into one string and that parse it?
Eliyahu
"anonymous" <anonymous@discussions.microsoft.com> wrote in message
news:1fee301c4588f$11aaf280$a101280a@phx.gbl...> In a drop down list you can assing the value from
> recordset like this:
> country.DataTextField = "country"
> country.DataValueField = "Code"
> What if I need to assign more value to a DataValueField
> from a recordset. Something like this:
> country.DataTextField = "country"
> country.DataValueField(1) = "Code"
> country.DataValueField(2) = "Code1"
> How do I do this?
>
Eliyahu Goldin Guest
-
Marwa Bahaa #11
DropDownList
Hi All,
I have an ASPX Page, and I want to create "Dropdown list" in the run time
and then upload its content to a database
Could any one help me on how to do this?
Marwa Bahaa Guest
-
Seelan #12
DropDownList
Hello folks,
I have a database table with CategoryID, Name and Description. I
made 2 DropDown Lists one for Displaying Name and the other for
Description. I want to add a web control, lets say a simple Datagrid
that would display the CategoryID depending on the values selected
from the 2 drop down lists. Can some one help me with this please? C#
web forms would be very helpful.
sqlDataAdapter1.Fill(dsCategories11);
DataGrid1.DataBind();
DropDownList1.DataBind();
DropDownList2.DataBind(); //upto this
point data is binded to the ddlist and everything is fine...
sqlDataAdapter1.SelectCommand.CommandText="SELECT CategoryID FROM
Categories WHERE CategoryName="+DropDownList1.SelectedItem.ToString ();
sqlDataAdapter1.Fill(dsCategories121);
Datagrid2.DataBind();
//after this I get an error saying "Invalid Coloumn name 'Beverage'
which is the item selected in the drop down list 1.
Please help...
Thanks
Seelan
Seelan Guest
-
EJD #13
Re: DropDownList
Hi,
I don't know what you're using for your database software, but just as
a suggestion, can you reproduce the full query string along with the
parameter 'Beverage' from the web page and run it in the DB software
itself?
I have a similar setup to yours but it's only using one DDL, and if I
change part of the query by adding a letter to one of the parameters,
say in your case making "CategoryName" into "CategoryName1," it would
give me the same error but instead of it saying "invalid column name
'beverage'" it would say invalid column name 'CategoryName1'.
You may want to check what your DDL1.DataMember equals as well...
I suppose it could also be that there is some kind of disconnect
between your query and your dsCategor*ies121...
HTH.
EJD Guest
-
Wojtek #14
DropDownList
Hello
I have to dropdownlists on my page: one containing project names, second
containing project versions. I would like to refresh the contents of the
second dropdownlist right after the selected item in the first
dropdownlist is changed. I tried the SelectedIndexChanged event but it
didn't work.
Regards,
Wojtek
Wojtek Guest
-
Ray Costanzo [MVP] #15
Re: DropDownList
Please read this first:
[url]http://www.aspfaq.com/show.asp?id=2081[/url] (Specifically, bullet #2)
Then check this out:
[url]http://www.aspfaq.com/show.asp?id=2270[/url]
Ray at work
"Wojtek" <wojteku@forcom.com.pl> wrote in message
news:dc7ebr$1r3$1@inews.gazeta.pl...> Hello
>
>
> I have to dropdownlists on my page: one containing project names, second
> containing project versions. I would like to refresh the contents of the
> second dropdownlist right after the selected item in the first
> dropdownlist is changed. I tried the SelectedIndexChanged event but it
> didn't work.
>
>
> Regards,
>
> Wojtek
Ray Costanzo [MVP] Guest
-
Wojtek #16
Re: DropDownList
Ray Costanzo [MVP] napisał(a):
I didn't mention, that I am using C#. I couldn't find any examples> Please read this first:
> [url]http://www.aspfaq.com/show.asp?id=2081[/url] (Specifically, bullet #2)
>
> Then check this out:
> [url]http://www.aspfaq.com/show.asp?id=2270[/url]
>
> Ray at work
>
> "Wojtek" <wojteku@forcom.com.pl> wrote in message
> news:dc7ebr$1r3$1@inews.gazeta.pl...
>>>>Hello
>>
>>
>>I have to dropdownlists on my page: one containing project names, second
>>containing project versions. I would like to refresh the contents of the
>>second dropdownlist right after the selected item in the first
>>dropdownlist is changed. I tried the SelectedIndexChanged event but it
>>didn't work.
>>
>>
>>Regards,
>>
>>Wojtek
>
>
except that using Javascript. Is it possible to achieve this using C#?
Regards,
Wojtek
Wojtek Guest
-
Ray Costanzo [MVP] #17
Re: DropDownList
In that case, you'd want to see an ASP.Net group. This is a classic ASP
group. Check out the groups with "aspnet" in their names and post there,
but still not until after reading [url]http://www.aspfaq.com/show.asp?id=2081[/url]!
Ray at work
"Wojtek" <wojteku@forcom.com.pl> wrote in message
news:dcam66$12f$1@inews.gazeta.pl...
>> >
> >
> I didn't mention, that I am using C#. I couldn't find any examples
> except that using Javascript. Is it possible to achieve this using C#?
>
> Regards,
>
> Wojtek
Ray Costanzo [MVP] Guest



Reply With Quote

