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. avoid running function in page load event of user control inside a page with in master page

avoid running function in page load event of user control inside a page with in master page

Scheduled Pinned Locked Moved ASP.NET
helpdatabasequestion
4 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.
  • U Offline
    U Offline
    uglyeyes
    wrote on last edited by
    #1

    Hi, hoping someone can give me hint to solve this. I have a multiview web control in a aspx page with in master page. each view with in multiview has ascx page. by default first index of the view is set to active. as the page needs to go though the standard page life cycle so it will run all page load events of ascx even though i sent the first view to be active view. in one of the ascx page with in the view has a repeater control and i am loading a data in page load event in that ascx and its being executed everytime even though this control is not with in active view. so in aspx active view index change i added a dataload function for this page so when this the control is in the activeview the data source get bind to the control. these all is working fine. my problem is how do i get the updated dataset from ascx to aspx so i could store it in session or something without adding any function in page load event of user control. please help

    R 1 Reply Last reply
    0
    • U uglyeyes

      Hi, hoping someone can give me hint to solve this. I have a multiview web control in a aspx page with in master page. each view with in multiview has ascx page. by default first index of the view is set to active. as the page needs to go though the standard page life cycle so it will run all page load events of ascx even though i sent the first view to be active view. in one of the ascx page with in the view has a repeater control and i am loading a data in page load event in that ascx and its being executed everytime even though this control is not with in active view. so in aspx active view index change i added a dataload function for this page so when this the control is in the activeview the data source get bind to the control. these all is working fine. my problem is how do i get the updated dataset from ascx to aspx so i could store it in session or something without adding any function in page load event of user control. please help

      R Offline
      R Offline
      Rahul Rajat Singh
      wrote on last edited by
      #2

      In the ascx control you can have a public property that can return a dataset, if the databind is called already and null if it is not called. from the page you can directly use this property to get the dataset out of the control.

      U 1 Reply Last reply
      0
      • R Rahul Rajat Singh

        In the ascx control you can have a public property that can return a dataset, if the databind is called already and null if it is not called. from the page you can directly use this property to get the dataset out of the control.

        U Offline
        U Offline
        uglyeyes
        wrote on last edited by
        #3

        but repeater control has drop down list, textbox and are editable and I need to get the value of them as well. how do I do that? here is a details of my issue ViewState is disabled through out the entire aspx page Page contains a multiview control which has views and views has user controls prev and next button clicking prev or next button saves current data (SET()) within user control and loads data(GET()) of next user control (if it has any) one of the user control in a view has editable repeater control. in page load of this control I am binding the repeater as Repeater.DataSource = List of object Repeater.Databind() The problem is, this page load is being called disregard the view being active or inactive. So I need to bind the repeater else where in the user control so in my GET() function in aspx (where I load the user control with repeater) I bind the repeater by declaring repeater object as property in ascx as Me.RepeaterAsProperty.DataSource = List of object Me.RepeaterAsProperty.DataBind() I removed databind codes from ascx. upto now it works all good. When I click next button when this user control is active, I need to save modified data with in this repeater. so in SET() function I run a loop to get Me.RepeaterAsProperty.Items which is empty. I dont know how to get this working.

        U 1 Reply Last reply
        0
        • U uglyeyes

          but repeater control has drop down list, textbox and are editable and I need to get the value of them as well. how do I do that? here is a details of my issue ViewState is disabled through out the entire aspx page Page contains a multiview control which has views and views has user controls prev and next button clicking prev or next button saves current data (SET()) within user control and loads data(GET()) of next user control (if it has any) one of the user control in a view has editable repeater control. in page load of this control I am binding the repeater as Repeater.DataSource = List of object Repeater.Databind() The problem is, this page load is being called disregard the view being active or inactive. So I need to bind the repeater else where in the user control so in my GET() function in aspx (where I load the user control with repeater) I bind the repeater by declaring repeater object as property in ascx as Me.RepeaterAsProperty.DataSource = List of object Me.RepeaterAsProperty.DataBind() I removed databind codes from ascx. upto now it works all good. When I click next button when this user control is active, I need to save modified data with in this repeater. so in SET() function I run a loop to get Me.RepeaterAsProperty.Items which is empty. I dont know how to get this working.

          U Offline
          U Offline
          uglyeyes
          wrote on last edited by
          #4

          anyone??

          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