How to use ASP.NET <%= tags in server control attributes?

后端 未结 7 1587
陌清茗
陌清茗 2020-11-28 10:15

This works:

\" />

This doesn\'t work:

         


        
7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 10:55

    You will need to set the value of the server control in code

    First of all, assign an ID to the label control so you can access the control

    
    

    Then, in your Page_Load function, set the value of your labels 'Text' field

    protected void Page_Load(object sender, EventArgs e)
    {
        myLabel.Text = 'Whatever you want the label to display';
    }
    

    This function will be in your code behind file, or, if you are not using the code behind model, inside your aspx page you will need

    
    

    Good luck.

提交回复
热议问题