Difference between <% %>, <%= %>, <%# %>?

Whenever we are going to write code inside the <% %> then that piece of code will treated as server side code generally vbscript.

When we are accessing any server side variable into the HTML (in .aspx) side then we use <%= %>.

When we are using any binding control like repeater, gridview… etc then to bind the particular column with the database value then we are using <%# %> when the Autogenerate column of the binding controls are FALSE

For Example:

Text='<%#Eval("FirstName") %>' this tag put inside the Text property of the control inside the datagrid like (textbox, label etc....)

...S.VinothkumaR.

1 comment:

DuFFeR ڈفرستان ۔ said...

sir g these tags with % are not visible in the post. can you oplz some work around so that we can learn this topic
thanks :)