Can WebUserControls get type infomation about other WebUserControls within the project?

StackOverflow https://stackoverflow.com/questions/4932994

  •  30-10-2019
  •  | 
  •  

Frage

I'm basically trying to get webcontrols to talk to one another.

I have one WUC that wants to get information from another.

In ControlB's GetDataFromControlA method

public List<ControlBData> GetDataFromControlA()
{
    ControlA c = Page.FindControl( IdOfControlA) as ControlA;
    if( c != null)
    {
        return c.Data;
    }
   ...
}

At code time ControlB knows nothing of ControlA...so ControlB cant access its members, and the above wont compile.

I'm thinking I have to use methods in the page to get the controls talking to one another...

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top