Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: parameter with DropDownList


Message #1 by "Hovik Melkomian" <melvik@b...> on Mon, 26 Aug 2002 17:57:42 +0430
I have a output parameter from my SP in SQL Server called Birthday witch
should be set to a drop down list.
I do it like:
DropDownListMonths.SelectedIndex = (int)sqlCom.Parameters["@BirthMonth"].Value;

But it gives error. :(
How should I set it to drop down list selectedIndex value????

Tnx,
Hovik.



Message #2 by Imar Spaanjaars <Imar@S...> on Mon, 26 Aug 2002 18:52:17 +0200
If you want so preselect an item in a drop down list and don't know its 
value, you can use FindByText like this:

         myList.Items.FindByText(MyText).Selected = True

This will search the drop down with an entry of MyText and select it.

HtH

Imar


At 05:57 PM 8/26/2002 +0430, you wrote:
>I have a output parameter from my SP in SQL Server called Birthday witch
>should be set to a drop down list.
>I do it like:
>DropDownListMonths.SelectedIndex = 
>(int)sqlCom.Parameters["@BirthMonth"].Value;
>
>But it gives error. :(
>How should I set it to drop down list selectedIndex value????
>
>Tnx,
>Hovik.


Message #3 by "Hovik Melkomian" <melvik@b...> on Tue, 27 Aug 2002 17:44:47 +0430
Tnx Imar,
That work fine,

Hovik.
----- Original Message -----
From: "Imar Spaanjaars" <Imar@S...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Monday, August 26, 2002 9:22 PM
Subject: [aspx_beginners] Re: parameter with DropDownList


If you want so preselect an item in a drop down list and don't know its
value, you can use FindByText like this:

         myList.Items.FindByText(MyText).Selected = True

This will search the drop down with an entry of MyText and select it.

HtH

Imar


At 05:57 PM 8/26/2002 +0430, you wrote:
>I have a output parameter from my SP in SQL Server called Birthday witch
>should be set to a drop down list.
>I do it like:
>DropDownListMonths.SelectedIndex 
>(int)sqlCom.Parameters["@BirthMonth"].Value;
>
>But it gives error. :(
>How should I set it to drop down list selectedIndex value????
>
>Tnx,
>Hovik.



---
Beginning ASP.NET Databases using VB.NET
http://www.wrox.com/ACON11.asp?ISBN=1861006195

Beginning ASP.NET Databases using C#
http://www.wrox.com/ACON11.asp?ISBN=1861007418

These books look at how we can create data-centric ASP.NET
applications. Requiring some basic knowledge of ASP.NET,
Access and SQL the authors guide you through the process
of connecting and consuming information in a variety of
ways. They are packed full of excellent illustrative code
examples, demonstrating important fundamental principles.



  Return to Index