Technodrone

there's some good in this world, Mr. Frodo... and it's worth fighting for.

  Home  |   Contact  |   Syndication    |   Login
  14 Posts | 2 Stories | 37 Comments | 0 Trackbacks

News

Article Categories

Archives

Post Categories

Image Galleries

Code hacks

Face Book Profile

LinkedIn Profile

Recommended Products

How to get embedded controls to communicate

We had this situation. MasterPage/content/tabbed control/and various user controls on the tabbed control.

 For some reason the findcontrol did not work.  I don't remember why.   We decided to use events on the user controls to populate properties so the various controls could communicate There are probably better ways to do it but it has worked for over a year.  Basically the properties being populated were used so all the controls to talk to each other.

//Code in code behind of user control called picksalesRep

  public delegate void SalesRepInfoPropertyGetHandler(object sender, EventArgs e);

 

    public event SalesRepInfoPropertyGetHandler GetSalesRepInfo;

 

    protected virtual void OnGetAddedSalesRepInfo(EventArgs e)

    {

        try

        {

            if (GetSalesRepInfo != null)

            {

                GetSalesRepInfo(this, e);

 

//code on click event of a button on the user control

    protected void ShowAddedSalesRepBtn_Click(object sender, EventArgs e)

    {

 

        try

        {

            SelectPnl.Visible = false;

            OnGetAddedSalesRepInfo(e);

 

//code on the tabbed control

private void PicksalesRep1_GetSalesRepInfo(object sender, EventArgs e)

    {

        try

        {

            int pickedSalesRepID = PicksalesRep1.SalesRepId;

            LoadPickedSalesRep(pickedSalesRepID);

 

 

 

protected void Page_Preload()

PickSalesRep1.GetSalesRepInfo +=

            new SalesRep_nbtPhysicianStyle_tabContents_PickSalesRep.SalesRepInfoPropertyGetHandler(

                PickSalesRep1_GetProviderInfo);

 

posted on Wednesday, February 13, 2008 3:50 PM