RSS Forums RSS

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

Reply
Posts: 10
Reputation: C#Novice is an unknown quantity at this point 
Solved Threads: 0
C#Novice C#Novice is offline Offline
Newbie Poster

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

  #1  
Jan 7th, 2009
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:
---->
  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 1:46 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
AddThis Social Bookmark Button
Reply With Quote  
Posts: 1,413
Reputation: serkan sendur is an unknown quantity at this point 
Solved Threads: 69
Featured Poster
serkan sendur serkan sendur is offline Offline
Nearly a Posting Virtuoso

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

  #2  
Jan 7th, 2009
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.
Serkan Sendur
All my helpful posts are dedicated to Marty Friedman, especially for his song Forbidden City.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the ASP.NET Forum
Views: 591 | Replies: 1 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:49 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC