I am having a weird problem with innerHtml that I'm hoping someone can help me with. The code displays two sections (one "EP offers" and one "LP offers" section as indicated in the code below. The code that works just fine locally, but when I upload it to the host site (DiscountASP) it builds the html fine (everything shows up in View Source after the page is built), and the "EP" section appears briefly, but then just "disappears" after the page is built. As I said, the "disappearing" section does show up in the View Source (in IE). Please help!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Security;
using System.Web.Security;

public partial class MyPageOffersView : System.Web.UI.UserControl
{
    public static int UserID;
    public static int LP = 0;
    public static int EP = 0;
    public static int OfferHeaderID;
    public static string UserName;
 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Application["Development"].ToString() != "1")
        {
            if (!Request.IsSecureConnection)
            {
                string sURL = Request.Url.ToString();
                int iIndex = sURL.IndexOf("www");
                if (iIndex == -1)
                {
                    Response.Redirect(Request.Url.ToString().Replace("http://", "https://www."));
                }
                else
                {
                    Response.Redirect(Request.Url.ToString().Replace("http://", "https://"));
                }
            }
        }
        
        SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionInfo"]);
        conn.Open();
        try
        {
            FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity;
            UserName = id.Name.ToString();
            if (UserName == "Admin") // deny admin
            {
                conn.Dispose();
                conn.Close();
                Response.Redirect("~/login_register.aspx");
            }
        }
        catch (Exception ex)
        {
            conn.Dispose();
            conn.Close();
            Response.Redirect("~/login_register.aspx"); // whatever your login page is
        }

        try
        {
            UserID = int.Parse(Request.QueryString["UID"]);
        }
        catch
        {
            SqlCommand cmdUser = new SqlCommand("GetUserByUsername", conn);
            cmdUser.CommandType = CommandType.StoredProcedure;
            cmdUser.Parameters.Add("@Username", SqlDbType.VarChar);
            cmdUser.Parameters["@Username"].Value = UserName.ToString();
            SqlDataReader rdr = cmdUser.ExecuteReader();
            while (rdr.Read())
            {
                UserID = int.Parse(rdr["user_id"].ToString());
            }
            cmdUser.Dispose();
        }

        string contentstring = null;
        contentstring = contentstring + "<table border='0' width='100%'><tr><td>";
        contentstring = contentstring + "<div id='content'>";

        // Active EP Offers section
        SqlCommand cmd = new SqlCommand("GetActiveEPOffers", conn);
        cmd.CommandType = CommandType.StoredProcedure;           
        SqlDataAdapter da1 = new SqlDataAdapter(cmd);
        DataSet ds1 = new DataSet();
        da1.Fill(ds1);

        contentstring = contentstring + "<h2>Equity Offers</h2>";
        contentstring = contentstring + "<table border='0' width='100%'>";
        contentstring = contentstring + "<tr>";
        
        int i = 0;
        int rowcnt = ds1.Tables[0].Rows.Count;
        if (rowcnt == 0)
        {
            contentstring = contentstring + "Offers are currently being posted... check back soon!";
        }
        else
        {
        foreach (DataRow dr in ds1.Tables[0].Rows)
        {
            i = i + 1;
            contentstring = contentstring + "<td valign='top' align='center'>";
            contentstring = contentstring + "<div class='property_box'>";
            contentstring = contentstring + "<h3><a href='MyPagePropertyView.aspx?uid=" + UserID + "&pid=" + dr["offer_header_id"] + "&v=i'>";
            contentstring = contentstring + "Equity Offer " + String.Format("{0:$##0;($#,##0);$0}", dr["equity_offer"]) + "<br />";
            contentstring = contentstring + "Annual Profit " + String.Format("{0:$##0;($#,##0);$0}", dr["net_annual_profit_share"]) + "<br />";
            contentstring = contentstring + "<a href='MyPagePropertyView.aspx?uid=" + UserID + "&pid=" + dr["offer_header_id"] + "&v=i'>";
            contentstring = contentstring + "<img alt='property image' src='../images/HomeImages/" + dr["offer_header_id"] + "/" + dr["photo1"] + "' width='190px' border='0' align='center'>";
            contentstring = contentstring + "</div>";
            contentstring = contentstring + "</td>";
            if (i == 2)
            {
                contentstring = contentstring + "</tr><tr>";
                i = 0;
            }
        }
        contentstring = contentstring + "</table>";
        }

        
        // Active LP Offers section
        SqlCommand cmd1 = new SqlCommand("GetActiveLPOffers", conn);
        cmd1.CommandType = CommandType.StoredProcedure;           
        SqlDataAdapter da2 = new SqlDataAdapter(cmd1);
        DataSet ds2 = new DataSet();
        da2.Fill(ds2);

        contentstring = contentstring + "<h2>Lending Offers</h2>";
        contentstring = contentstring + "<table border='0' width='100%'>";
        contentstring = contentstring + "<tr>";
        
        i = 0;
        rowcnt = ds2.Tables[0].Rows.Count;
        if (rowcnt == 0)
        {
            contentstring = contentstring + "Offers are current being posted... check back soon!";
        }
        else
        {
            foreach (DataRow dr in ds2.Tables[0].Rows)
            {
                i = i + 1;
                contentstring = contentstring + "<td valign='top' align='center'>";
                contentstring = contentstring + "<div class='property_box'>";
                contentstring = contentstring + "<h3><a href='MyPagePropertyView.aspx?UID=" + UserID + "&PID=" + dr["offer_header_id"] + "&v=i'>";
                contentstring = contentstring + "Note Value " + String.Format("{0:$##0;($#,##0);$0}", dr["note_amt"]) + "<br />";
                contentstring = contentstring + "Note % " + dr["interest_rate"] + "<br />";
                contentstring = contentstring + "Term " + String.Format("{0:##0;(#,##0);0}", dr["term_months"]) + " mos </h3>";

                contentstring = contentstring + "<a href='MyPagePropertyView.aspx?uid=" + UserID + "&pid=" + dr["offer_header_id"] + "&v=i'>";
                contentstring = contentstring + "<img alt='property image' src='../images/HomeImages/" + dr["offer_header_id"] + "/" + dr["photo1"] + "'width='190' border='0'>";
                contentstring = contentstring + "</div>";
                contentstring = contentstring + "</td>";
                if (i == 2)
                {
                    contentstring = contentstring + "</tr><tr>";
                    i = 0;
                }
            }
        }
                    
        contentstring = contentstring + "</div>";
        contentstring = contentstring + "</td></tr></table></table>";
        frm1.InnerHtml = contentstring;
        
        conn.Dispose();
        conn.Close();

    }
}

instead of giving frm,create one div inside frm and set

div.innerhtml=contentstring

,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.