Hi friendz,
In my last project i faced Display dynamic images as per some criteria in a grid. Here i'm sharing the code
Code
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<script runat="server">
public string GetImage(object status)
{
if (status != null)
{
int s = int.Parse(status.ToString());
if (s == 1) return "~/img/yes.jpg";
else if (s == 0) return "~/img/no.gif";
return "~/img/na.gif";
}
return "~/img/na.gif";
}
</script>
</head>
<body>
<form id="form1" runat="server">
######## grid Starts here #########
Item templete
<asp:Image ID="ImportantImage" runat="server" ImageUrl='<%# this.GetImage(Eval("status")) %>' /><br />
######## grid Ends here #########
</form>
</body>
</html>
Have a nice day... 'N happy Coding :)
No comments:
Post a Comment