|
 |
aspx_professional thread: DataList Question
Message #1 by "Rich K" <rich@r...> on Mon, 23 Sep 2002 11:23:49 -0400
|
|
Andrew, that makes sense, but the scenario I am trying to solve doesn't seem
to work. I am generating a dynamic list of account functions into an array
and binding this array to a DataList. I am trying to retrieve the name of
the text that was selected from the list. I can get the index of the list
with:
dataindex = objArgs.Item.ItemIndex.ToString();
but how do I actually get the list item name. It is neccessary to obtain the
text name value because the index number will not always correlate to the
same name. I am trying to find this information by using the OnItemCommand
of the List Box control. Thanks for your help. Rich
-----Original Message-----
From: Andrew Bradnan [mailto:andrew@w...]
Sent: Monday, September 23, 2002 3:02 PM
To: ASPX_Professional
Subject: [aspx_professional] RE: DataList Question
The DataList has the SelectedItem, not the DataListItem.
-----Original Message-----
From: Rich K [mailto:rich@r...]
Sent: Monday, September 23, 2002 8:59 AM
To: ASPX_Professional
Subject: [aspx_professional] RE: DataList Question
When I try string dataitem = objArgs.Item.SelectedItem.ToString();
I get the following error:
System.Web.UI.WebControls.DataListItem' does not contain a definition
for
'SelectedItem'
-----Original Message-----
From: Tri Nguyen [mailto:tnguyen@i...]
Sent: Monday, September 23, 2002 11:45 AM
To: ASPX_Professional
Subject: [aspx_professional] RE: DataList Question
Have you tried
string dataitem = objArgs.Item.SelectedItem.ToString();
SelectedItem is one of the properties of DataList.
void Button_Click(Object sender, EventArgs e)
{
if (DataList1.SelectedItem != null)
{
DataList1.SelectedItem.ForeColor = System.Drawing.Color.Red;
}
}
-Tri
-----Original Message-----
From: Rich K [mailto:rich@r...]
Sent: Monday, September 23, 2002 10:24 AM
To: ASPX_Professional
Subject: [aspx_professional] DataList Question
Could someone tell me how to extract the value a DataList control Item.
I can extract the index, but I need to extract the value of the item
selected. Thanks in advance. Rich
Index code:
string dataindex;
dataindex = objArgs.Item.ItemIndex.ToString();
Item Value:
string datavalue;
datavalue = ?????????
---
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.
---
---
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.
---
---
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.
---
---
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.
---
|
|
 |