| |

VerySource

 Forgot password?
 Register
Search
View: 2182|Reply: 18

Difference between <% # .....%> and <% = ......%>

[Copy link]

7

Threads

16

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 United States

Post time: 2020-3-1 15:30:01
| Show all posts |Read mode
<ItemTemplate>
<a href='Reader.aspx?MailID=<%# DataBinder.Eval(Container.DataItem,"MailID") %>&FolderID = <% # DataBinder.Eval (Container.DataItem, "FolderID")%> '> < % = AliasName%>&nbsp; <% = Email%> </a>
</ ItemTemplate>

I know that <% # .....%> is used for data binding, and the meaning of <% = ...%> is not clear.
Reply

Use magic Report

0

Threads

64

Posts

45.00

Credits

Newbie

Rank: 1

Credits
45.00

 Unknown

Post time: 2020-5-11 13:15:01
| Show all posts
<% = ......%> Can bind the public members defined in the background
Reply

Use magic Report

0

Threads

58

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-5-11 13:45:01
| Show all posts
<% = ......%> is equivalent to <% Response.Write ("...");%>
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-11 14:00:01
| Show all posts
# One is to bind the database field
= One is to bind public variables
My guess
Reply

Use magic Report

7

Threads

16

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

 Author| Post time: 2020-5-11 14:45:01
| Show all posts
I tried it and found that <% = AliasName%>&nbsp; <% = Email%> in the above code is the same as AliasName&nbsp; Email.
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-5-11 16:00:01
| Show all posts
#Only valid in the context of bound data.
= Is Response.Write
Reply

Use magic Report

1

Threads

60

Posts

37.00

Credits

Newbie

Rank: 1

Credits
37.00

 China

Post time: 2020-5-13 15:15:01
| Show all posts
# Bind database fields
= Is a public variable in the binding cs file
Reply

Use magic Report

7

Threads

16

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

 Author| Post time: 2020-5-20 09:15:01
| Show all posts
I tried it. In fact, # has the function of =, which means that wherever <% = ......%> appears, you can also use <% # ......%> instead, the effect is the same.
Reply

Use magic Report

0

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-5-22 20:00:01
| Show all posts
Not binding, but direct output.
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-22 23:15:01
| Show all posts
<% = ......%> which is
<% Response.Write ("...");%>
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list