Binding Eval with an ImageURL in ASP.NET

前端 未结 4 2059
庸人自扰
庸人自扰 2021-01-21 19:35

I\'m trying to bind an image using Eval() with VB.NET and ASP.NET, but am running into issues:

Code snippet



        
4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-21 20:19

    string strImagePath = "aPage.aspx";
    string pathFormat = "~/SiteImages/ram/3/{0}";
    string path = String.Format(path, strImagePath);
    

    Thats a little bit verbose, but you get the idea. What you're looking for is the String.Format method.

    You can read more about it over at MSDN -> String.Format

    So in your case that would be:

    
    

    as long as strImagePath is set to public or protected in your codebehind

提交回复
热议问题