Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0ajax timer with adRotator to dynamically change bannerajax timer with adRotator to dynamically change banner
Previous
 
Next
New Post
4/29/2009 1:19 PM
 

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);
                   

                }

 

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0ajax timer with adRotator to dynamically change bannerajax timer with adRotator to dynamically change banner


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out