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. Pass Data from Page to Control and find current loaded Control

Pass Data from Page to Control and find current loaded Control

Scheduled Pinned Locked Moved ASP.NET
helpquestionannouncement
5 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
    Muc_
    wrote on last edited by
    #1

    Hi people, maybe somebody knows to help me out. I have 2 problems: 1. How i can pass value from Page to a User Control maybe with a Event Delegate? 2. In the code below i have a user control, but I can not access it in the code behind and in the designer it is not registered. But as soon as I remove my update panel and repater it is visible or can be accessed on it. Why?

    thx a lot!

    B 1 Reply Last reply
    0
    • M Muc_

      Hi people, maybe somebody knows to help me out. I have 2 problems: 1. How i can pass value from Page to a User Control maybe with a Event Delegate? 2. In the code below i have a user control, but I can not access it in the code behind and in the designer it is not registered. But as soon as I remove my update panel and repater it is visible or can be accessed on it. Why?

      thx a lot!

      B Offline
      B Offline
      Brij
      wrote on last edited by
      #2

      -Muc_ wrote:

      1. How i can pass value from Page to a User Control maybe with a Event Delegate?

      - One simple way you can do it, Have a public property in usercontrol which takes the value that you want and pass it from the page.

      -Muc_ wrote:

      2. In the code below i have a user control, but I can not access it in the code behind and in the designer it is not registered.

      We cannot access directly any item that is in repeater.If you want to access it then you have to find it dynamically from codebehind using findcontrol.You can find it in itemdatabound of repeater. Actually when we bind a datasource to repeater, the number of rows is created based on data and for every row sepearte control is created, so to access these controls you can access using find control in itemadatabound. for details Have a look

      Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators

      M 1 Reply Last reply
      0
      • B Brij

        -Muc_ wrote:

        1. How i can pass value from Page to a User Control maybe with a Event Delegate?

        - One simple way you can do it, Have a public property in usercontrol which takes the value that you want and pass it from the page.

        -Muc_ wrote:

        2. In the code below i have a user control, but I can not access it in the code behind and in the designer it is not registered.

        We cannot access directly any item that is in repeater.If you want to access it then you have to find it dynamically from codebehind using findcontrol.You can find it in itemdatabound of repeater. Actually when we bind a datasource to repeater, the number of rows is created based on data and for every row sepearte control is created, so to access these controls you can access using find control in itemadatabound. for details Have a look

        Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators

        M Offline
        M Offline
        Muc_
        wrote on last edited by
        #3

        Butt how should i add a EventHandler from usercontrol in my aspx page in the Repeater if I can not find it?

        B 1 Reply Last reply
        0
        • M Muc_

          Butt how should i add a EventHandler from usercontrol in my aspx page in the Repeater if I can not find it?

          B Offline
          B Offline
          Brij
          wrote on last edited by
          #4

          You add a event itemdatabound in the repeater,which is on your page.And in this function, find out your usercontrol as

          SkillGroupControl ctrl= (SkillGroupControl)e.Item.FindControl("SkillGroup");

          Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators

          M 1 Reply Last reply
          0
          • B Brij

            You add a event itemdatabound in the repeater,which is on your page.And in this function, find out your usercontrol as

            SkillGroupControl ctrl= (SkillGroupControl)e.Item.FindControl("SkillGroup");

            Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators

            M Offline
            M Offline
            Muc_
            wrote on last edited by
            #5

            I had this event already knew that but not if I set a property of the control is static that the value is also reingespeichert. I had this event already knew that but not if I set a property of Control that the value is static stores even.

            protected virtual void RepeaterGroup_ItemdataBound(object sender, RepeaterItemEventArgs e)
            {
            MuMSkillGroup group = (MuMSkillGroup)e.Item.DataItem;
            SkillGroupControl currentGoup = (SkillGroupControl)e.Item.FindControl("Skillgroup");
            }

            But thx a Lot!

            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