Get Runtime Reference To Editor Object In Nested User Control (ascx).

  •  07-07-2004, 3:10 PM

    Get Runtime Reference To Editor Object In Nested User Control (ascx).

    I have implemented a CuteEditor ("Editor") in a user control that appears within another user control which appears on an aspx page. Yes - two nested user controls within an aspx page. At runtime, the name of the Editor as rendered in the HTML in the browser is '_ctl1__ctl3_Editor1'
     
    Issue: On postback, I need to somehow get a reference to the Editor. The following line does not work when executed from the Page_Load event during a postback (FindControl always returns null):
    Control incomingEditor = FindControl("_ctl1__ctl3_Editor1");
     
    My temporary work-around is to loop through the Forms collection, looking for '_ctl1__ctl3_Editor1'. The value of this member of the Forms collection contains what I believe is the Text value of the Editor - however I cannot be sure because it may really be the (innerText or innerHTML value). In any case even if it is the Text value, I have no way to get the XHTML value which is a member of the runtime Editor object. And, as far as I know, the XHTML value is not available via the Forms collection. My work-around won't be acceptable for my production implementation.
     
    I'd really appreciate any suggestions on how to get a true reference to the Editor object when it resides in nested user controls as described above. FWIW, I'm using C#/code-behind
     
    Thanks!
View Complete Thread