Search This Blog

Friday, June 19, 2009

How to give image url at runtime in any databound controls of asp.net

Take a image tag in ur databound control like gridview,datalist.
If you take asp image tag then set path like bellow
ImageURL = ImageTest(DataBinder.Eval(Container.DataItem, "sLogo") in asp tags.

Here ImageTest is a function in which you can give your imageurl. For example view the following :- 
 protected object ImageTest(object s)
    {
      object path = "~/aspx/productimages/" + Session["Member"] + "\\logo\\" + s;
      return path;
    }

set ur image url in path object variable.

Thank you

No comments:

Post a Comment