Thursday, March 22, 2012

Meaning of <%#

I can't seem to find any mention of what <%# means in any
of my ASP.NET text books. Searching msdn and Goggle for
<%# also results in nothing. Can anyone offer a URL that
has some definition?

Thanks,
FrankI finally found some info on <%# when searching for Data
Binding Expression Syntax. It would be nice if MS would
add <%# to the help index in VS.NET like they did with <%
=.
Frank wrote:
> I can't seem to find any mention of what <%# means in any
> of my ASP.NET text books. Searching msdn and Goggle for
> <%# also results in nothing. Can anyone offer a URL that
> has some definition?

Frank,
Data binding individual control properties in Web Forms pages is not
implemented by directly tying the property to a source of data. Instead,
data binding is implemented by using a special expression format. The
data-binding expression is delimited with the characters <%# and %>.

For more information, please see:
http://msdn.microsoft.com/library/e...ngexpressions.a

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
<%# ... %> isn't just used in DataBinding expressions it is used in any kind
of binding say you wanted to bind a boolean return from a method you can do
that too. You can use it on anything that is marked as Bindable(true). I
tried this out once to find the difference between <%= and <%#. = is for
string returns and # is for binding to controls.

That is what I came up with.

"Frank" <anonymous@.discussions.microsoft.com> wrote in message
news:04de01c3cf2a$d2f910a0$a101280a@.phx.gbl...
> I can't seem to find any mention of what <%# means in any
> of my ASP.NET text books. Searching msdn and Goggle for
> <%# also results in nothing. Can anyone offer a URL that
> has some definition?
> Thanks,
> Frank
Carl Prothman [MVP] wrote:
> For more information, please see:
> http://msdn.microsoft.com/library/e...ngexpressions.a

Sorry, here is the correct URL
http://msdn.microsoft.com/library/e...expressions.asp

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP

0 comments:

Post a Comment