<div class="templatemo_product">
<img src="templatemo_photo1.jpg" alt="templatemo.com"
width="117" height="76" /><strong>Vivamus a massa</strong><br />
Donec iaculis felis id neque. Morbi nunc. Praesent varius egestas velit. Donec a
massa ut pede pulvinar vulputate. Nulla et augue. Sed eu nunc quis pede tristique
suscipit. Nam sit amet justo vel libero tincidunt dignissim. <a href="#">
<strong>
READ
MORE
</strong>
</a>
</div>
cms9651
Member
175 Points
573 Posts
Include file in aspx page
Dec 29, 2012 06:14 PM|LINK
Hello.
I have this code part in file .inc:
<div class="templatemo_product"> <img src="templatemo_photo1.jpg" alt="templatemo.com" width="117" height="76" /><strong>Vivamus a massa</strong><br /> Donec iaculis felis id neque. Morbi nunc. Praesent varius egestas velit. Donec a massa ut pede pulvinar vulputate. Nulla et augue. Sed eu nunc quis pede tristique suscipit. Nam sit amet justo vel libero tincidunt dignissim. <a href="#"> <strong> READ MORE </strong> </a> </div>In my aspx page call this file .inc with:
Now I need insert in this file .inc the value of date extract with query sql in my code-behind:
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) ViewState["LoginErrors"] = 0; OdbcConnection conn = new OdbcConnection(ConfigurationManager.ConnectionStrings["cs"].ConnectionString); conn.Open(); SQL = "SELECT * FROM TBL_E "; SQL = SQL + " ORDER BY DATA ASC; "; OdbcCommand cmd = new OdbcCommand(SQL, conn); OdbcDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { string myDate = Convert.ToString(dr["myDate"]); } dr.Close(); dr.Dispose(); cmd.Dispose(); conn.Close(); conn.Dispose(); }Can you help me?
thank you
RichardY
Star
8376 Points
1573 Posts
Re: Include file in aspx page
Dec 29, 2012 07:04 PM|LINK
Instead of using server side includes use asp.net user controls.
http://msdn.microsoft.com/en-us/library/y6wb1a0e(v=vs.100).aspx