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. Can Someone Explain this (ref Page Life Cycle)

Can Someone Explain this (ref Page Life Cycle)

Scheduled Pinned Locked Moved ASP.NET
csharpdesignhelpquestion
1 Posts 1 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
    mani_iips
    wrote on last edited by
    #1

    I have made a user control ( text.ascx) with a text box (txtUserControl) and a button (btnUserControl) . <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="test.ascx.cs" Inherits="WebApplication1.test" %> Now i load this usercontrol dynamically on (default.aspx) into two panels: public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { test tst = Page.LoadControl(@"~\test.ascx") as test; pnlDefaultOne.Controls.Add(tst); } protected void btnDefault_Click(object sender, EventArgs e) { test tst = Page.LoadControl(@"~\test.ascx") as test; pnlDefaultTwo.Controls.Add(tst); } } Now, the question is about the beahviour of textbox (txtUserControl), and its viewstate. When i click btnDefault.. it loads the userControl in panelTwo. now when i enter values in both the textboxes (each of a usercontrol), and click the btnDefault, the value in the first control (the one loaded at page_load) is persisted, while in the other one which was loaded in btnEvent is NOT. i have read decent enough abt page cycle and am aware abt rendering, viewstate, postBackData. BUt cant really figure out the reason behind this. Any comment on the same will be of help. Thanks in advance.

    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