开发者

How can I use an image or icon resource from global resource file in an asp:Image control to set the ImageUrl attribute?

开发者 https://www.devze.com 2022-12-16 07:45 出处:网络
How can I use an image or icon resource from global resource file in an asp:Image control to s开发者_如何学JAVAet the ImageUrl attribute?In code:

How can I use an image or icon resource from global resource file in an asp:Image control to s开发者_如何学JAVAet the ImageUrl attribute?


In code:

ClientScriptManager cs = Page.ClientScript;
myImage.ImageUrl= cs.GetWebResourceUrl(type, "resource name");

In the markup:

<asp:Image 
     ImageUrl="<%= Page.ClientScript.GetWebResourceUrl(typeof(MyClass), 
     "resource name") %>" 
 />

See the documentation for ClientScriptManager.GetWebResourceUrl for more info.

0

精彩评论

暂无评论...
验证码 换一张
取 消