<% %> Syntax *grml*

2 posts, 0 answers
  1. Wolfgang Kamir
    Wolfgang Kamir avatar
    80 posts
    Member since:
    Jul 2006

    Posted 17 Jul 2006 Link to this post

    Hi all!

    This may be the most basic question there is, but as i cannot google it or search it with any other search-function (not even in my MSDN Library) i have to ask it anyway...

    What exactly means

    <%= MyRadControl.ClientID %>
    and
    <%# MyRadControl.ClientID %>
    and
    <% MyRadControl.ComeGetSome() %>   ?

    actually it's pretty clear to me that it is some kind of pre-response makro stuff (by ASP.NET), but i can't see the difference (sometimes in die radcontrols documentation <%= %> is used and sometimes <%# %> is used. What's the difference?

    It is hard to google it or find it otherwise just because it's only special characters and this is filtered out by the searchengines i tried to use...

    Best regards,
    Wolfgang
  2. Wolfgang Kamir
    Wolfgang Kamir avatar
    80 posts
    Member since:
    Jul 2006

    Posted 18 Jul 2006 Link to this post

    Nevermind, found out already ;)

    If someone else is asking himself the same thing and has troubles to look it up:

    <% %> is the normal Syntax for server-side script (processed before the page is rendered to the client).

    So something like <% Response.Output.Write("<b>Hello</b>"); %> will just write the bold 'Hello' Text to the response instead of the original statement.

    <%= %> is an abbreviation for the upper statement, i.e. <%="<b>Hello</b>" %> would just write the same text to the response...
    <%=myServersideObject.ClientID%> would write the ClientID of the object to the repsonse (given the fact, that the property 'ClientID' is a string).

    At last <%# %> is DataBinding-Syntax (therefore one has to do DataBind()) somewhere on the page when using r.a.d.window...

    Maybe this helps someone else who is new to ASP.NET too! Everyone else will know this anyway i guess ;-)

    Kind regards,
    Wolfgang

Back to Top