Hi all
I'm trying to change the alt text of some images dynamically. all the content for the page including links url copy and image alt text is stored in a db so when a user changes the language preference the site copy changes etc.
this is what i have so far
i have a dataset that is cached from the db then i loop through each row
an example of my images is
and an example of my link is
thanks
I'm trying to change the alt text of some images dynamically. all the content for the page including links url copy and image alt text is stored in a db so when a user changes the language preference the site copy changes etc.
this is what i have so far
i have a dataset that is cached from the db then i loop through each row
Code:
foreach (DataRow theRow in ds.Tables[0].Rows)
{foreach (DataRow theRow in ds.Tables[0].Rows)
{
string control = theRow["ContentId"].ToString();
HtmlContainerControl ctrl = FindControlRecursive(this, control) as HtmlContainerControl;
if (ctrl != null)
{
if (theRow["ContentType"].ToString() == "text")
{
ctrl.InnerHtml = theRow["PageContent"].ToString();
}
if (theRow["ContentType"].ToString() == "link")
{
//ctrl.HRef = theRow["PageContent"].ToString();
//doesnt work
}
if (theRow["ContentType"].ToString() == "alt")
{
//ctrl.Alt = theRow["PageContent"].ToString();
//doesnt seem to find the control and even if i hard code the the id in it doesnt work
}
}
}
<img class="socialIc on" src="/images/facebook.png" id="facebookIco n" runat="server" alt="Facebook icon" width="24" height="20" border="0" />and an example of my link is
<a href="http://www.facebook.co m" target="_blank" id="facebookHre f" runat="server">thanks
Comment