Server tags cannot contain <% … %> constructs

前端 未结 4 1564
不思量自难忘°
不思量自难忘° 2020-12-01 06:54

I am trying to use CDN for my images on the website. Problem is, sometimes I have server controls such as ImageButton, and I would like to use a class in order to fully extr

4条回答
  •  情歌与酒
    2020-12-01 07:06

    Of course, your best bet is to give the imagebutton an id, eg:

    
    

    And then within your page load assign the imageurl:

    void Page_Load(...)
    {
         if (!Page.IsPostback)
         {
              IAgreeImageButton.ImageUrl = ResourceManager.GetImageCDN("iagree.png");
         }
    }
    

提交回复
热议问题