inline page code for sever controls never works

后端 未结 2 645
-上瘾入骨i
-上瘾入骨i 2021-01-16 19:24

I tried the following code, I tried to use inline expressions like <%, ,<%= , why I can\'t use inline expression with server side control?

In my first line of

2条回答
  •  执笔经年
    2021-01-16 20:02

    You can't use code blocks (<%%>, <%=%> and <%:%>) inside a server side control. Binding expressions (<%#%>) are a different matter.

    You need to learn about the differences between the shortcut server side code blocks just randomly trying the different ones, as you seem to be doing will teach you nothing.

    You can assign the values in the code behind file:

    TextBox1.Text = DateTime.Now.Date.ToString("dd-MM-yyyy");
    

提交回复
热议问题