Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Read items into a DataList

Reply
Thread Tools

Read items into a DataList

 
 
Alberto
Guest
Posts: n/a
 
      10-24-2003
I have a DataList with data retrieved from a data base and, when the user
select an item with a clic, I need read the value of a Label who is in the
Datalist.

Actually I'm trying this:

((System.Web.UI.WebControls.Label)e.Item.FindContr ol("lblID")).Text

but (I don't know why) I only can modify it but I can't read it.

How can I find out the value of the label?

Thank you very much.


 
Reply With Quote
 
 
 
 
Janaka
Guest
Posts: n/a
 
      10-24-2003
What event is being raised when you click an item?

"Alberto" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I have a DataList with data retrieved from a data base and, when the user
> select an item with a clic, I need read the value of a Label who is in the
> Datalist.
>
> Actually I'm trying this:
>
> ((System.Web.UI.WebControls.Label)e.Item.FindContr ol("lblID")).Text
>
> but (I don't know why) I only can modify it but I can't read it.
>
> How can I find out the value of the label?
>
> Thank you very much.
>
>



 
Reply With Quote
 
 
 
 
Alberto
Guest
Posts: n/a
 
      10-24-2003
I'm writing the code in the ItemCommand event of the DataList.

"Janaka" <(E-Mail Removed)> escribió en el mensaje
news:u10o$(E-Mail Removed)...
> What event is being raised when you click an item?
>
> "Alberto" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > I have a DataList with data retrieved from a data base and, when the

user
> > select an item with a clic, I need read the value of a Label who is in

the
> > Datalist.
> >
> > Actually I'm trying this:
> >
> > ((System.Web.UI.WebControls.Label)e.Item.FindContr ol("lblID")).Text
> >
> > but (I don't know why) I only can modify it but I can't read it.
> >
> > How can I find out the value of the label?
> >
> > Thank you very much.
> >
> >

>
>



 
Reply With Quote
 
Janaka
Guest
Posts: n/a
 
      10-24-2003
ok try doing this:

Label lblTest = (Label)e.Item.FindControl("lblID");
Trace.Write("Label exists", lblTest == null ? "No" : "Yes");
string id = lblTest.Text;

if you get an error on the third line look at the trace and see whether its
found your Label control.

"Alberto" <(E-Mail Removed)> wrote in message
news:u$(E-Mail Removed)...
> I'm writing the code in the ItemCommand event of the DataList.
>
> "Janaka" <(E-Mail Removed)> escribió en el mensaje
> news:u10o$(E-Mail Removed)...
> > What event is being raised when you click an item?
> >
> > "Alberto" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > I have a DataList with data retrieved from a data base and, when the

> user
> > > select an item with a clic, I need read the value of a Label who is in

> the
> > > Datalist.
> > >
> > > Actually I'm trying this:
> > >
> > >

((System.Web.UI.WebControls.Label)e.Item.FindContr ol("lblID")).Text
> > >
> > > but (I don't know why) I only can modify it but I can't read it.
> > >
> > > How can I find out the value of the label?
> > >
> > > Thank you very much.
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
resolve single line with multiple items into mutliple lines, single items ela Perl Misc 12 04-06-2009 06:47 PM
Taskbar - Past Items back into Current Items Moke Gibboni Computer Support 5 10-29-2008 05:26 PM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM
How to read multiple items using read ifstream in C++ lokb C++ 5 07-08-2004 01:34 PM
grouping items among a list according to items subtag value Gilles Kuhn XML 0 09-15-2003 12:01 PM



Advertisments