Hi,
My code is pretty streightforward, cant figure out what's wrong though. The banner doesnt change and every 3 sec the whole page is refreshed. The code works perfectly fine outside dnn, as an asp.net app. I'm trying to integrate it into the portal.
Please any suggestion helps, i'm running out of ideas. Thanks
<asp:Timer ID="Timer1" Interval="3000" runat="server" />
<div id="label_section">
<div class="header"><img src="http://localhost:2885/Website/DesktopModules/labelM/images/our_label_family_header.gif" alt="Our Label Family" /></div>
<div id="label_section_content">
<div id="label_container">
<asp:UpdatePanel ID="uplabels" runat="server">
<Triggers><asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> </Triggers>
<ContentTemplate> </ContentTemplate>
</asp:UpdatePanel>
</div>
And the code-behind:
protected void Page_Load(System.Object sender, System.EventArgs e)
{
if (!IsPostBack)
{
if (DotNetNuke.Framework.AJAX.IsInstalled())
{
DotNetNuke.Framework.AJAX.RegisterScriptManager();
}
}
try
{
string strSQL = "SELECT label_url, description, image_name, image_size, binary_image, product_line, label_group_code, label_group_desc, show_flag, label_name , (case when label_name is null or label_name='' then label_group_desc else label_name end) lbl_name FROM t_label_meta WHERE show_flag=1 AND label_group_code = '894' ORDER BY lbl_name ASC";
OracleDataReader dr = dblib.dblib.getReader("OrclConn", strSQL);
DataTable dt = new DataTable();
dt.Load(dr);
DataTable dtCopy = new DataTable();
dtCopy.Columns.Add(new DataColumn("ImageUrl", System.Type.GetType("System.String")));
dtCopy.Columns.Add(new DataColumn("AlternateText", System.Type.GetType("System.String")));
dtCopy.Columns.Add(new DataColumn("NavigateUrl", System.Type.GetType("System.String")));
if (dt.Rows.Count > 0)
{
foreach (DataRow row in dt.Rows)
{
string imagepath = "";
if (Convert.ToString(row["product_line"]) != "")
{
if (Convert.ToString(row["image_size"]).Trim().Length > 0)
{
imagepath = ("displayimage.ashx?lgc=" + row["label_group_code"].ToString() + "&pl=" + row["product_line"].ToString());
}
}
else
{
//check for image file on the server
string imagefolder = Server.MapPath("images/labelsImg/" + row["image_name"].ToString().Trim());
if (File.Exists(imagefolder))
{
imagepath = ("images/labelsImg/" + row["image_name"].ToString().Trim());
}
else
{
if (Convert.ToString(row["image_size"]).Trim().Length > 0)
{
imagepath = ("displayimage.ashx?lgc=" + row["label_group_code"].ToString());
}
else
{
imagepath = ("images/labelsImg/midden.jpg");
}
}
}
DataRow tr = dtCopy.NewRow();
tr["ImageUrl"] = imagepath;
tr["NavigateUrl"] = "http://" + row["label_url"].ToString();
tr["AlternateText"] = row["label_group_desc"].ToString();
dtCopy.Rows.Add(tr);
}
AdRotator adrLabels = new AdRotator();
adrLabels.Width = 100;
adrLabels.Height = 80;
adrLabels.DataSource = dtCopy;
adrLabels.AlternateTextField = "AlternateText";
adrLabels.NavigateUrlField = "NavigateUrl";
adrLabels.ImageUrlField = "ImageUrl";
adrLabels.Target = "_blank";
adrLabels.DataBind();
uplabels.ContentTemplateContainer.Controls.Add(adrLabels);
}