I have a master page that gets all its images from a table on a database, and I am trying to incorporate flash, for banners, but I can’t quite seem to figure it out.
Right now there is a:
<asp:image id="headerimg" runat="server">
and that generates the appropriate img tag needed to show an image in html. Now I would like to know if there is any way where I can generate an object tag if a .swf file is present and populate the tag with width height and data and also not show the img tag.
Update__
I now have made a usercontrol that will create the object tag, but can someone please tell me if it is looking like I am doing it right..
IDataReader dr = DB.GetRS("SELECT HeaderGraphic,HeaderAlign, fWidth, fHeight, Flash FROM Store where CustomerID='" + Session["Customer"].ToString() + "'");
if(dr["Flash"] == 1)
{
HtmlGenericControl obj = new HtmlGenericControl("object");
obj.Attributes["width"] = dr["fWidth"];
obj.Attributes["height"] = dr["fHeight"];
obj.Attributes["data"] = dr["HeaderGraphic"];
this.Controls.Add(obj);
}
else
{
HtmlGenericControl image = new HtmlGenericControl("img");
img.Attributes["src"] = dr["HeaderGraphic"];
img.Attributes["align"] = dr["HeaderAlign"];
this.Controls.Add(image);
}
is this continuing to look right? and is there anything I am missing?
Thanks.
Why not create a user control that generates the required
<OBJECT />html to display the swf file and then you can dynamically load these if there are swf file present?