943,809 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 2373
  • ASP.NET RSS
Jan 7th, 2009
0

Control 'LeftNav1_lnkCore' of type 'LinkButton' must be placed inside a form tag with

Expand Post »
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:
---->
asp.net Syntax (Toggle Plain Text)
  1. <%@ Control Language="c#" AutoEventWireup="false" Codebehind="LeftNav.ascx.cs" Inherits="CE.userControls.LeftNav" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
  2. <td class="leftcolumn" valign="top">
  3. <div id="snav">
  4. <div class="subnav">
  5. <ul class='navlink'>
  6. <li class='navlink3'>
  7. <asp:LinkButton ID="lnkCore" Runat="server" OnClick="lnkCore_Click" CausesValidation="False" > CCR
  8. </asp:LinkButton> </li>
  9. </ul>
  10. </div>
  11.  
  12.  
  13. <asp:Panel ID="pnlCl" Runat=server Visible="False">
  14. <%
  15. Response.Write ("<div class='subnav'><ul class='navlink'><li class='navlink'");
  16. int i=0;
  17. //for (int i=0;i<arrBlock.Count;i++)
  18. //{
  19. string gyr = "0";
  20. if (Convert.ToInt32(HttpContext.Current.Session["sesgyr"]) > 0)
  21. {gyr = HttpContext.Current.Session["sesgyr"].ToString().Trim();}
  22. //Response.Write ("<li class='navlink'>");
  23. //if (bcode==(i+1)) {Response.Write ("<img src='/CE/images/arrow.down.png'>");}
  24. //else {Response.Write ("<img src='/CE/images/arrow.right.png'>");}
  25. //Response.Write ("&nbsp;<a href='/CE/default.aspx?b="+(i+1).ToString().Trim()+"'>"+arrBlock[i]+"</a></li>");
  26. //if (bcode==(i+1))
  27. //{
  28. string ugr = HttpContext.Current.Session["sesusergroup"].ToString().Trim();
  29. Response.Write ("<div class='subnav'><ul class='navlink'>");
  30. for (int j=0;j<arrCoreBlock.Count;j++)
  31. {
  32. Response.Write ("<li class='navlink'><img src='/CE/images/arrow.right.png'>&nbsp;<font color=#00646E>"+arrCoreBlock[j]+"</font></li>");
  33. Response.Write ("<table><tr>");
  34. if (ugr!="CLINBLOCK1CCF" && ugr!="CLINBLOCK1MHMC" && ugr!="CLINBLOCK2CCF" && ugr!="CLINBLOCK2MHMC")
  35. {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>");}
  36. if (ugr!="CLINBLOCK1CCF" && ugr!="CLINBLOCK1UH" && ugr!="CLINBLOCK2CCF" && ugr!="CLINBLOCK2UH")
  37. {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>");}
  38. if (ugr!="CLINBLOCK1UH" && ugr!="CLINBLOCK1MHMC" && ugr!="CLINBLOCK2UH" && ugr!="CLINBLOCK2MHMC")
  39. 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>");
  40. Response.Write ("</tr></table>");
  41. }
  42. Response.Write ("</ul></div>");
  43. //}
  44. //}
  45. Response.Write ("</ul></div>");
  46. %>
  47. </asp:Panel>
  48.  
  49. <%
  50. Response.Write ("<hr>&nbsp;<img src='/CE/images/arrow.right.png'>");
  51. Response.Write ("&nbsp;<a href='/CE/components/cgTime.aspx'>Timeliness</a>");
  52. %>
  53. <br class="header3">
  54.  
  55. </div>
  56.  
  57. </td>
  58. <td id="tdMain">
  59. <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
Last edited by peter_budo; Jan 11th, 2009 at 2:46 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
C#Novice is offline Offline
11 posts
since Aug 2007
Jan 7th, 2009
0

Re: Control 'LeftNav1_lnkCore' of type 'LinkButton' must be placed inside a form tag with

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.
Featured Poster
Reputation Points: 854
Solved Threads: 127
Banned
serkan sendur is offline Offline
2,057 posts
since Jan 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Accessing localhost problem
Next Thread in ASP.NET Forum Timeline: How to implement live video streaming in asp.net





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC