Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > DataList row text

Reply
Thread Tools

DataList row text

 
 
Colin Basterfield
Guest
Posts: n/a
 
      06-10-2004
Hi,

I have a datalist which has a complete list of possible names and a check
box declared in the ItemTemplate. I get the name using the standard
mechanism:

Convert.ToString(DataBinder.Eval(Container.DataIte m,"RevenueName"))

At the time of populating the grid I don't care whether the chckbox is
checked or not, I do that afterwards once I have got the site which has its
own internal list of selected names.

I am then attempting to iterate thro the datalist items:

for (int i = 0; i < dlRevAssoc.Items.Count; i++)

revName = (dlRevAssoc.Items[i].Controls[0] as
DataBoundLiteralControl).Text;

and as can be seen above all I want initially is the Text relating to the
name, to use to find it in my Site specific list but the text that gets
assigned to the string 'revName' is encased in \r\n\t\t\t\t\t\t\, i.e.
either side e.g.

\r\n\t\t\t\t\t\t\Adventure Park\r\n\t\t\t\t\t\t\

I am struggling to see how I can get just the text, e.g. Adventure Park?

Obviously there must be lots of other ways to do the whole thing but I don't
want to break my domain model.

Many thanks in advance

Colin B


 
Reply With Quote
 
 
 
 
Colin Basterfield
Guest
Posts: n/a
 
      06-13-2004
Well solved my own problem, all I neded to do was declare a label inside the
item template which the Convert... is assigned to the labels Text property.

The iteration thro the list items can then be done using

Label revLabel;
string revName;
for (int i = 0; i < dlRevAssoc.Items.Count; i++)

revLabel = (Label)dlRevAssoc.Items[i].FindControl(lblRevName)
if (revLable != null)
revName = revLabel.Text;
etc etc

Simple really, but not when there are too many trees thro which to see the
wood.

Cheers
Colin B

"Colin Basterfield" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I have a datalist which has a complete list of possible names and a check
> box declared in the ItemTemplate. I get the name using the standard
> mechanism:
>
> Convert.ToString(DataBinder.Eval(Container.DataIte m,"RevenueName"))
>
> At the time of populating the grid I don't care whether the chckbox is
> checked or not, I do that afterwards once I have got the site which has

its
> own internal list of selected names.
>
> I am then attempting to iterate thro the datalist items:
>
> for (int i = 0; i < dlRevAssoc.Items.Count; i++)
>
> revName = (dlRevAssoc.Items[i].Controls[0] as
> DataBoundLiteralControl).Text;
>
> and as can be seen above all I want initially is the Text relating to the
> name, to use to find it in my Site specific list but the text that gets
> assigned to the string 'revName' is encased in \r\n\t\t\t\t\t\t\, i.e.
> either side e.g.
>
> \r\n\t\t\t\t\t\t\Adventure Park\r\n\t\t\t\t\t\t\
>
> I am struggling to see how I can get just the text, e.g. Adventure Park?
>
> Obviously there must be lots of other ways to do the whole thing but I

don't
> want to break my domain model.
>
> Many thanks in advance
>
> Colin B
>
>



 
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
GridView nested in DataList - refreshing corresponding DataList row after updating GridView row H5N1 ASP .Net 0 04-26-2006 11:41 PM
ok I can do a totals row but how about a percentage row after each data row D ASP .Net Datagrid Control 0 05-23-2005 04:10 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
DataList in DataList acko bogicevic ASP .Net 2 11-11-2003 08:31 AM
Datalist in Datalist How? Gönen EREN ASP .Net 0 08-22-2003 02:41 PM



Advertisments