|
 |
aspx thread: Working with the Items collection of a Dropdownlist control..
Message #1 by "Oliver, Wells" <WOliver@l...> on Wed, 28 Aug 2002 13:50:17 -0700
|
|
Trying this:
CType (E.Item.FindControl ("results"),
Dropdownlist).Items(OptionItem).Selected = True
Where "OptionItem" is a string, either "Pass", "Fail", or "Information".
Anyway, that doesn't compile like it is, throws the error
"System.FormatException: Input string was not in a correct format."
How can I set the selected property in the Items collection of the item with
the text value of "Pass" (for example)?
Thanks!
Wells Oliver
Web Application Programmer
Leviton Voice & Data
xxx-xxx-xxxx
http://www.levitonvoicedata.com
Message #2 by Imar Spaanjaars <Imar@S...> on Thu, 29 Aug 2002 07:56:44 +0200
|
|
Hi there,
Items is a collection and it expects an Integer.
Use FindByText instead like this:
myDropDown.FindByText("MyText").Selected = True
HtH
Imar
At 01:50 PM 8/28/2002 -0700, you wrote:
>Trying this:
> CType (E.Item.FindControl ("results"),
>Dropdownlist).Items(OptionItem).Selected = True
>
>Where "OptionItem" is a string, either "Pass", "Fail", or "Information".
>Anyway, that doesn't compile like it is, throws the error
>"System.FormatException: Input string was not in a correct format."
>
>How can I set the selected property in the Items collection of the item with
>the text value of "Pass" (for example)?
>
>Thanks!
>
>Wells Oliver
>Web Application Programmer
>Leviton Voice & Data
>xxx-xxx-xxxx
>http://www.levitonvoicedata.com
>
>
>-
Message #3 by "Oliver, Wells" <WOliver@l...> on Thu, 29 Aug 2002 09:18:02 -0700
|
|
Imar--
It doesn't seem as though FindByText is a method of the DropDownList
control.
Compiler error: BC30456: 'FindByText' is not a member of
'System.Web.UI.WebControls.DropDownList'.
Also, there's no mention of it on th MSDN page for DropDownList.
Any ideas?
-----Original Message-----
From: Imar Spaanjaars [mailto:Imar@S...]
Sent: Wednesday, August 28, 2002 10:57 PM
To: ASP+
Subject: [aspx] Re: Working with the Items collection of a Dropdownlist
control..
Hi there,
Items is a collection and it expects an Integer.
Use FindByText instead like this:
myDropDown.FindByText("MyText").Selected = True
HtH
Imar
At 01:50 PM 8/28/2002 -0700, you wrote:
>Trying this:
> CType (E.Item.FindControl ("results"),
>Dropdownlist).Items(OptionItem).Selected = True
>
>Where "OptionItem" is a string, either "Pass", "Fail", or
>"Information". Anyway, that doesn't compile like it is, throws the
>error
>"System.FormatException: Input string was not in a correct format."
>
>How can I set the selected property in the Items collection of the item
>with the text value of "Pass" (for example)?
>
>Thanks!
>
>Wells Oliver
>Web Application Programmer
>Leviton Voice & Data
>xxx-xxx-xxxx
>http://www.levitonvoicedata.com
>
>
>-
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
Message #4 by "Andrew Bradnan" <andrew@w...> on Thu, 29 Aug 2002 09:47:10 -0700
|
|
It's on the Items collection.
FindByValue
FindByText
Andrew
http://whirly.info
.NET forums, stop by and say hi.
-----Original Message-----
From: Oliver, Wells [mailto:WOliver@l...]
Sent: Thursday, August 29, 2002 9:18 AM
To: ASP+
Subject: [aspx] Re: Working with the Items collection of a Dropdownlis t
control..
Imar--
It doesn't seem as though FindByText is a method of the DropDownList
control.
Compiler error: BC30456: 'FindByText' is not a member of
'System.Web.UI.WebControls.DropDownList'.
Also, there's no mention of it on th MSDN page for DropDownList.
Any ideas?
-----Original Message-----
From: Imar Spaanjaars [mailto:Imar@S...]
Sent: Wednesday, August 28, 2002 10:57 PM
To: ASP+
Subject: [aspx] Re: Working with the Items collection of a Dropdownlist
control..
Hi there,
Items is a collection and it expects an Integer.
Use FindByText instead like this:
myDropDown.FindByText("MyText").Selected =3D True
HtH
Imar
At 01:50 PM 8/28/2002 -0700, you wrote:
>Trying this:
> CType (E.Item.FindControl ("results"),
>Dropdownlist).Items(OptionItem).Selected =3D True
>
>Where "OptionItem" is a string, either "Pass", "Fail", or
>"Information". Anyway, that doesn't compile like it is, throws the
>error
>"System.FormatException: Input string was not in a correct format."
>
>How can I set the selected property in the Items collection of the item
>with the text value of "Pass" (for example)?
>
>Thanks!
>
>Wells Oliver
>Web Application Programmer
>Leviton Voice & Data
>xxx-xxx-xxxx
>http://www.levitonvoicedata.com
>
>
>-
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=3D1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=3D1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=3D1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=3D1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
Message #5 by Imar Spaanjaars <Imar@S...> on Thu, 29 Aug 2002 20:13:12 +0200
|
|
I am sorry, my bad.
You can find the FindByText method on the Items collection:
myDropDown.Items.FindByText("MyText").Selected = True
Regards, and sorry for not paying enough attention.
Imar
At 09:18 AM 8/29/2002 -0700, you wrote:
>Imar--
>
>It doesn't seem as though FindByText is a method of the DropDownList
>control.
>
>Compiler error: BC30456: 'FindByText' is not a member of
>'System.Web.UI.WebControls.DropDownList'.
>
>Also, there's no mention of it on th MSDN page for DropDownList.
>
>Any ideas?
|
|
 |