how could the child web user control ( .ascx ) get the value from parent ( .aspx ) ?

Posted on 2007-07-22
Last Modified: 2008-02-01
how could the child web user control ( .ascx ) get the value from parent ( .aspx ) ?
I have a hidden control in web form ( .aspx page ) I would like to get the value of this hidden control from a nested web user control ..
any help on it ?
Question by:Ameerh24
    LVL 6

    Accepted Solution

    You can use the findcontrol method of the page within the usercontrol :
    in C# :
     HiddenField hf_page = (HiddenField)Page.FindControl("HiddenField1");

    in vb :   Dim hf_page As HiddenField
            hf_page = Page.FindControl("Hiddenfield1")
    LVL 12

    Assisted Solution

    place a public property in ascx !! for example "Property_In_ASCX "

    in aspx page

    Control obj_VMwareCtrl  ;
    obj_VMwareCtrl = LoadControl("VMware_Ctrl.ascx") ;  
    (VMware_Ctrl)obj_VMwareCtrl.Property_In_ASCX = 123;  // VMware_Ctrl be the class of ascx

    this.Controls.Add(obj_VMwareCtrl) ;



    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now