Hi All,
I have an application that i m developing in VS2003 using asp.net and c#
in the left navigation page I need to add the functionality to open and close a panel in the left nav.
here is my code:
---->

<%@ Control Language="c#" AutoEventWireup="false" Codebehind="LeftNav.ascx.cs" Inherits="CE.userControls.LeftNav" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<td class="leftcolumn" valign="top">
<div id="snav">
		<div class="subnav">
			<ul class='navlink'>
				<li class='navlink3'>
				<asp:LinkButton ID="lnkCore" Runat="server"  OnClick="lnkCore_Click" CausesValidation="False" > CCR
				</asp:LinkButton>	</li>
			</ul>
		</div>
		
	
	<asp:Panel ID="pnlCl"  Runat=server Visible="False">
	<%
	Response.Write ("<div class='subnav'><ul class='navlink'><li class='navlink'");
	int i=0;
		//for (int i=0;i<arrBlock.Count;i++)
		//{
			string gyr = "0";
			if (Convert.ToInt32(HttpContext.Current.Session["sesgyr"]) > 0)
			{gyr = HttpContext.Current.Session["sesgyr"].ToString().Trim();}
			//Response.Write ("<li class='navlink'>");
			//if (bcode==(i+1)) {Response.Write ("<img src='/CE/images/arrow.down.png'>");}
			//else {Response.Write ("<img src='/CE/images/arrow.right.png'>");}
			//Response.Write ("&nbsp;<a href='/CE/default.aspx?b="+(i+1).ToString().Trim()+"'>"+arrBlock[i]+"</a></li>");
			//if (bcode==(i+1))
			//{
				string ugr = HttpContext.Current.Session["sesusergroup"].ToString().Trim();
				Response.Write ("<div class='subnav'><ul class='navlink'>");
				for (int j=0;j<arrCoreBlock.Count;j++)
				{
					Response.Write ("<li class='navlink'><img src='/CE/images/arrow.right.png'>&nbsp;<font color=#00646E>"+arrCoreBlock[j]+"</font></li>");
					Response.Write ("<table><tr>");
					if (ugr!="CLINBLOCK1CCF" && ugr!="CLINBLOCK1MHMC" && ugr!="CLINBLOCK2CCF" && ugr!="CLINBLOCK2MHMC")
					{Response.Write ("<td bgcolor=#b0e0e6 border=1 bordercolor=#000000><a href='/CE/Components/blockCore.aspx?b=0&k="+(j+1).ToString().Trim()+"&h=1&y="+gyr+"'><font color=#00646E>UH/VA</font></a></td>");}
					if (ugr!="CLINBLOCK1CCF" && ugr!="CLINBLOCK1UH" && ugr!="CLINBLOCK2CCF" && ugr!="CLINBLOCK2UH")
					{Response.Write ("<td bgcolor=#f4a460 border=1 bordercolor=#000000><a href='/CE/Components/blockCore.aspx?b=0&k="+(j+1).ToString().Trim()+"&h=2&y="+gyr+"'><font color=#00646E>MHMC</font></a></td>");}
					if (ugr!="CLINBLOCK1UH" && ugr!="CLINBLOCK1MHMC" && ugr!="CLINBLOCK2UH" && ugr!="CLINBLOCK2MHMC")
					Response.Write ("<td bgcolor=#adff2f border=1 bordercolor=#000000><a href='/CE/Components/blockCore.aspx?b=0&k="+(j+1).ToString().Trim()+"&h=3&y="+gyr+"'><font color=#00646E>CCF</font></a></td>");
					Response.Write ("</tr></table>");
				}
				Response.Write ("</ul></div>");
			//}
		//}
		Response.Write ("</ul></div>");
		%>
		</asp:Panel>
		
	<%
			Response.Write ("<hr>&nbsp;<img src='/CE/images/arrow.right.png'>");
			Response.Write ("&nbsp;<a href='/CE/components/cgTime.aspx'>Timeliness</a>");
				%>
		<br class="header3">
	
	</div>
			
</td>
<td id="tdMain">
	<div class="paddedwrapper1"></div>

-------<
When I click on the link button lnkCore, i want to expand (i.e make the panel pnlCL visible.)
But I get the following error message that "Control 'LeftNav1_lnkCore' of type 'LinkButton' must be placed inside a form tag with runat="server""
i have done similar thing in my other application, and I didnt face any problem, What could the problem be?
Please help me.. i have been at this since morning!!!!!
Thanks in advance

Every web controls with runat="server" attribute must be places inside <form runat="server" id="someID"> </form> tags.
If you use visual studio express editions or visual studio.net, you wont make such mistakes.

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.