Ask a Question related to ASP.NET General, Design and Development.
-
GM #1
Advice on label text concatenation during databinding
I am building the text for a resume section label in databinding with 20 or
so data columns using a series of 20 or so code snippits like the following:
If e.Item.DataItem("EmployerDisplay") And e.Item.DataItem("Employer") <> ""
Then
Sections.Text += "<BR><B>Employer</B>: " & e.Item.DataItem("Employer")
End If
Is this an efficient way to build the section label's text property? Any
suggestions?
In each snippit, I call the data field twice, once to test for data and once
to add it to the control if present. Would it be better to pull the data
into a string or something?
Dim ds as String
------
ds = e.Item.DataItem("Employer")
If e.Item.DataItem("EmployerDisplay") And ds <> "" Then
Sections.Text += "<BR><B>Employer</B>: " & ds
End If
Thanks in advance for any suggestions.
Gary
GM Guest
-
Animate when text label changes...
I'm a new bee and I appriciate if anyone can help me on this.. Is is possible to 'animate' or apply some kind of effect (blur or fade or... -
Changing text on asp-label
Is it possible to change the text in a label from english to german like cultureinfo in Visual studio? regards reidarT -
Getting text of a label in a datalist.
I have a label in a datalist. I can reach it by controls collection of datalist. I can get its ID or change its visible property but I can't get... -
aligning text in a asp label
You can try using css. Create a custom css-class for your label and give the parameters in the css file. "Kay" <kokeeffe@proteus.ie> wrote in... -
Unbound text box as label
I have an application form that is used from year to year for the same agencies. I want to create a label that displays the year the form is used. ... -
Elliot M. Rodriguez #2
Re: Advice on label text concatenation during databinding
You can use the StringBuilder object from the System.Text namespace - its
built specifically for concatenation operations.
--
Elliot M. Rodriguez, MCSD
*** It would take 227 cans of Mountain Dew to kill me***
"GM" <gmdevREMOVE@starband.net> wrote in message
news:elhkrXhUDHA.1396@tk2msftngp13.phx.gbl...or> I am building the text for a resume section label in databinding with 20following:> so data columns using a series of 20 or so code snippits like the"">
> If e.Item.DataItem("EmployerDisplay") And e.Item.DataItem("Employer") <>once> Then
> Sections.Text += "<BR><B>Employer</B>: " & e.Item.DataItem("Employer")
> End If
>
> Is this an efficient way to build the section label's text property? Any
> suggestions?
>
> In each snippit, I call the data field twice, once to test for data and> to add it to the control if present. Would it be better to pull the data
> into a string or something?
>
> Dim ds as String
> ------
> ds = e.Item.DataItem("Employer")
> If e.Item.DataItem("EmployerDisplay") And ds <> "" Then
> Sections.Text += "<BR><B>Employer</B>: " & ds
> End If
>
> Thanks in advance for any suggestions.
> Gary
>
>
Elliot M. Rodriguez Guest
-
Rick Spiewak #3
Re: Advice on label text concatenation during databinding
It is much more efficient to use your proposed approach: ds =
e.Item.DataItem("Employer")
than it is to reference the chain of objects more than once.
"GM" <gmdevREMOVE@starband.net> wrote in message
news:elhkrXhUDHA.1396@tk2msftngp13.phx.gbl...or> I am building the text for a resume section label in databinding with 20following:> so data columns using a series of 20 or so code snippits like the"">
> If e.Item.DataItem("EmployerDisplay") And e.Item.DataItem("Employer") <>once> Then
> Sections.Text += "<BR><B>Employer</B>: " & e.Item.DataItem("Employer")
> End If
>
> Is this an efficient way to build the section label's text property? Any
> suggestions?
>
> In each snippit, I call the data field twice, once to test for data and> to add it to the control if present. Would it be better to pull the data
> into a string or something?
>
> Dim ds as String
> ------
> ds = e.Item.DataItem("Employer")
> If e.Item.DataItem("EmployerDisplay") And ds <> "" Then
> Sections.Text += "<BR><B>Employer</B>: " & ds
> End If
>
> Thanks in advance for any suggestions.
> Gary
>
>
Rick Spiewak Guest
-
Rick Spiewak #4
Re: Advice on label text concatenation during databinding
You can use a StringBuilder or String.Concat to do this efficiently, but I
wouldn't recommend constantly appending to the Label control directly.
"GM" <gmdevREMOVE@starband.net> wrote in message
news:e7s3TyiUDHA.652@tk2msftngp13.phx.gbl...the> I thought about the StringBuilder, but I don't know how the Label control
> compares.
>
> Is the text property of the Label control built to work well with
> concatenation too? Or should I builld all the resume sections in a
> StringBuilder and then assign it to the Section Label's text property atits> end?
>
> Or, are you suggesting it is better to store the data value in each code
> snippet in a StringBuilder (or String) rather than call it twice?
>
> Thanks
> Gary
>
>
>
> "Elliot M. Rodriguez" <elliotmrodriguez@hotspam.mail.com> wrote in message
> news:egogpqhUDHA.216@TK2MSFTNGP10.phx.gbl...> > You can use the StringBuilder object from the System.Text namespace -20> > built specifically for concatenation operations.
> >
> > --
> > Elliot M. Rodriguez, MCSD
> > *** It would take 227 cans of Mountain Dew to kill me***
> >
> >
> >
> > "GM" <gmdevREMOVE@starband.net> wrote in message
> > news:elhkrXhUDHA.1396@tk2msftngp13.phx.gbl...> > > I am building the text for a resume section label in databinding with<>> > or> > following:> > > so data columns using a series of 20 or so code snippets like the> > >
> > > If e.Item.DataItem("EmployerDisplay") And e.Item.DataItem("Employer")e.Item.DataItem("Employer")> > ""> > > Then
> > > Sections.Text += "<BR><B>Employer</B>: " &Any> > > End If
> > >
> > > Is this an efficient way to build the section label's text property?and> > > suggestions?
> > >
> > > In each snippet, I call the data field twice, once to test for datadata> > once> > > to add it to the control if present. Would it be better to pull the>> >> > > into a string or something?
> > >
> > > Dim ds as String
> > > ------
> > > ds = e.Item.DataItem("Employer")
> > > If e.Item.DataItem("EmployerDisplay") And ds <> "" Then
> > > Sections.Text += "<BR><B>Employer</B>: " & ds
> > > End If
> > >
> > > Thanks in advance for any suggestions.
> > > Gary
> > >
> > >
> >
>
Rick Spiewak Guest



Reply With Quote

