Re: Why use <%= %> ?

From: Karl Seguin (_at_)
Date: 01/24/05


Date: Mon, 24 Jan 2005 11:50:52 -0500

There are controls which let you render text or even html inside a tag, but
I don't think there are any that let you define the attributes via
strings...even if they did, it would be the same as using <%= %> as you
wouldn't be able to program against it.

Karl

-- 
MY ASP.Net tutorials
http://www.openmymind.net/
"Alan Silver" <alan-silver@nospam.thanx> wrote in message
news:VrrOvlSZRS9BFwXa@nospamthankyou.spam...
> >Alan:
> >You are right, there's almost never a good reason to prefer <%= %> over
> >using controls.  True <%= %> might be nanoseconds faster, but you pay the
> >price (about 10x over) with maintenance and bugs.  Hopefully the book was
> >just showing that you COULD do it.
>
> OK, I guessed it wasn't necessary (usually), but it's nice tohave it
> confirmed.
>
> >  There might be very odd occasions were
> >you want to.  Someone recently asked how to create a <base> tag...at
ifrst I
> >thought just use <base id="x" runat="server" />  and declare it as an
> >HtmlGenericControl...but it turns out <base> CAN'T have a closing tag,
and
> >all server/html controls render a closing tag. I provided the guy with a
> >server control which overwrote the closing tag behaviour, but using <%=
%>
> >might have been an easier solution for him to use...There have been
other,
> >although I can probably count them on a single hand, occasions...
>
> OK, forgive the ignorance as I'm *really* new at this, but I think I
> read that one of the generic controls just produces pretty much what you
> put in, which could be plain text. If I'm right, then can't you use that
> instead? Or can't you use a control inside a tag? Just occurred to me as
> I'm typing that this might not work.
>
> Thanks
>
> -- 
> Alan Silver
> (anything added below this line is nothing to do with me)


Relevant Pages

  • Re: Setting color of table cell based on list selection
    ... That's why there are no members of the FormFields collection. ... Either you can replace those content controls with dropdown formfields from the ... You can't refer to a content control directly by its tag the way you could refer ... Sub ColorRiskCell() ...
    (microsoft.public.word.docmanagement)
  • Re: SuspendLayout Not Suspending...
    ... Then I add 81 "tags" to the controls collection of the panel ... I have a panel on a form that is being populated with 81 of the tag ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Assigning more than one tag to tag property
    ... so by parsing out multiple tag properties the code ... controls with a tag property of "carryover". ... Dim rst As DAO.Recordset ... Dim ctl As Control ...
    (microsoft.public.access.forms)
  • Re: prevent runat="server"
    ... I don't think there is any way that you can easily get away from including the runat="server" attribute value pair since it is exactly what the server uses to identify sever side nodes. ... The asp:ListItem can probably get away without it since it is a child of an asp:DropDownList tag that already has a runat="server attribute/value pair. ... I would not recommend going to the effort of using it unless it is a control that is used ONLY between the opening/closing tags of one of your other controls. ... way I can specify this in my code, so that the designer using my controls doesn't have to specify this for each custom control tag? ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • RE: HELP!! Form control visibility, based on user level
    ... I would use the tag property of the controls to set visibility. ... Dim intSecLevel as Integer ...
    (microsoft.public.access.gettingstarted)