Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. master-content page problem

master-content page problem

Scheduled Pinned Locked Moved ASP.NET
helpdesignsysadmin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Miss Maheshwari
    wrote on last edited by
    #1

    i have a master page n a content page..in content page i have a datalist and two button....while running this it trows an exception "Control 'ctl00_ContentPlaceHolder1_btnPrev' of type 'Button' must be placed inside a form tag with runat=server." so i add the code in content page's load event System.IO.StringWriter stringwriter = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlwriter = new System.Web.UI.HtmlTextWriter(stringwriter); this.pnl1.RenderControl(htmlwriter); string s = stringwriter.ToString(); public override void VerifyRenderingInServerForm(Control control) { return; } EnableEventValidation="false"....now its working but the problem is this..the click-event of the buttons of content page are not working...please someone help

    C 1 Reply Last reply
    0
    • M Miss Maheshwari

      i have a master page n a content page..in content page i have a datalist and two button....while running this it trows an exception "Control 'ctl00_ContentPlaceHolder1_btnPrev' of type 'Button' must be placed inside a form tag with runat=server." so i add the code in content page's load event System.IO.StringWriter stringwriter = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlwriter = new System.Web.UI.HtmlTextWriter(stringwriter); this.pnl1.RenderControl(htmlwriter); string s = stringwriter.ToString(); public override void VerifyRenderingInServerForm(Control control) { return; } EnableEventValidation="false"....now its working but the problem is this..the click-event of the buttons of content page are not working...please someone help

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You lose viewstate when you add dynamic controls, unless you do it before page_load. You'd do better to fix your tag so that it works when placed in the content page. Your content was obviously broken or you would not have got an error

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      M 1 Reply Last reply
      0
      • C Christian Graus

        You lose viewstate when you add dynamic controls, unless you do it before page_load. You'd do better to fix your tag so that it works when placed in the content page. Your content was obviously broken or you would not have got an error

        Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        M Offline
        M Offline
        Miss Maheshwari
        wrote on last edited by
        #3

        but i have done...<%@ Page Language="C#" MasterPageFile="~/MasterPage2.master" AutoEventWireup="true" EnableViewState="true" CodeFile="Default2.aspx.cs" Inherits="Default2" Title="Untitled Page" EnableEventValidation="false" %>..still my button click event is not working...please help

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups