Click here to Skip to main content
14,603,886 members
Rate this:
Please Sign up or sign in to vote.
See more:
HI iam yogesh and i have made a website on forums,ie (to ask questions and reply to questions). now for good looks i have add a css template(some part of css template, header and footer.. In my main.aspx i want to display all questions asked by users on a link button dynamically.. i have successfully did this job. But i have a problem that, my footer is displaying immediately below the header( as it looks in the design of master page->1. the header,2. contentplaceholder,3. footer.) I need to add the dynamically generated controls to the contentplaceholder, and the at end the footer should be displayed.please help m.. my code for master page is....
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="forum.master.cs" Inherits="ADVANCED_FORUM.forum" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head  runat="server">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Advantage by Free Css Templates</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header" style="height: 273px">
	<div id="logo" style="width: 137px; height: 55px">
		<h1><a href="#">Forums</a></h1>
		<h2><a href="http://www.csstemplatesforfree.com/">By Yogesh Sharma</a></h2>
	</div>
	<div id="menu" style="height: 118px">
		<ul>
			<li class="active"><a href="#" title="">Homepage</a></li>
			<li><a href="#" title="">About Us</a></li>
			<li><a href="main.aspx" title="">View all questions</a></li>
			<li><a href="#" title="">Unanswered question</a></li>
			<li><a href="#" title="">Ask a question</a></li>
		</ul>
	</div>
</div>
   <form id="formm"  runat="server">
       <asp:ContentPlaceHolder ID ="cp1" runat="server">
        
   </form>
<div id="footer" style="height: 66px">
	<p id="legal">Copyright © 2007 Advantage. All Rights Reserved. Designed by <a href="http://nicecsstemplates.com/" title="nice free css templates">CSS Templates For Free</a>.</p>
	<p id="links"><a href="#">Privacy Policy</a> | <a href="#">Terms of Use</a></p>
</div>   
   </body>
</html>

AND the code for dynamically generated link button is
methods.createcon("forum");
            SqlCommand chkcmd = new SqlCommand("select q.*,r.* from questinfo q join reginfo r on q.quid= r.userid order by qdate desc", methods.connection);
            SqlDataReader dispdr = chkcmd.ExecuteReader();
            if (dispdr.HasRows)
            {
                  t=70
                  while (dispdr.Read())
                {
                    string mtop = t.ToString() + "px";
                    LinkButton lnk1 = new LinkButton();
                    lnk1.Style["position"] = "absolute";
                    lnk1.Style["left"] = "170px";
                    lnk1.Style["top"] = mtop;
                    lnk1.ID = "lnkbtn" + dispdr["qid"].ToString() + "_" + dispdr["quid"].ToString();
                    lnk1.Text = dispdr["question"].ToString();
                    lnk1.Font.Bold = true;
                    lnk1.Font.Italic = true;
                    lnk1.Font.Size = 10;
                    lnk1.ForeColor = Color.Navy;
                    t=t+50;/to set the top property of controls/
((Panel((ContentPlaceHolder)Master.FindControl("cp1")).FindControl("panel1")).Controls.Add(lnk1);           
 ((Panel)((ContentPlaceHolder)Master.FindControl("cp1")).FindControl("Panel1")).Height = t + 60;

Iam placing the controls on a panel which is on the main.aspx page. and also i am setting the hieght of panel.. WHAT"S wrong with this.?
Please help me and give some solution or some other suggestions..
Posted
Updated 15-Aug-11 2:22am
v2
Comments
BoxyBrown 15-Aug-11 7:58am
   
There are some tags without closing. For ex. "<asp:ContentPlaceHolder ID ="cp1" runat="server">".

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

I think that problem is in your errors in markup. Close "<asp:contentplaceholder xmlns:asp="#unknown">" and check other tags.
   
Comments
BoxyBrown 15-Aug-11 8:16am
   
And may be it will be better to put your "form" tag in "div".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100