Component in WebForm

Discussion in 'ASP .Net Building Controls' started by Shawn B., Sep 7, 2003.

  1. Shawn B.

    Shawn B. Guest

    Greetings,

    Is it possible to get a reference to the Page object of an ASP.NET page from
    within a Component that has been placed on the page?

    I want the component to be available on the page and when the page renders I
    want it to be able to inject something into the Page Response stream but the
    Component object itself is very non-visual and for that reason I thought it
    would be better not to have it as a control.


    Thanks,
    Shawn
    Shawn B., Sep 7, 2003
    #1
    1. Advertising

  2. Shawn B.

    Shawn B. Guest

    Actually, I need access to the RegisterClientScript function...


    Thanks,
    Shawn

    "Shawn B." <> wrote in message
    news:...
    > Greetings,
    >
    > Is it possible to get a reference to the Page object of an ASP.NET page

    from
    > within a Component that has been placed on the page?
    >
    > I want the component to be available on the page and when the page renders

    I
    > want it to be able to inject something into the Page Response stream but

    the
    > Component object itself is very non-visual and for that reason I thought

    it
    > would be better not to have it as a control.
    >
    >
    > Thanks,
    > Shawn
    >
    >
    Shawn B., Sep 7, 2003
    #2
    1. Advertising

  3. "Shawn B." <> wrote in message
    news:...
    > Greetings,
    >
    > Is it possible to get a reference to the Page object of an ASP.NET page

    from
    > within a Component that has been placed on the page?
    >
    > I want the component to be available on the page and when the page renders

    I
    > want it to be able to inject something into the Page Response stream but

    the
    > Component object itself is very non-visual and for that reason I thought

    it
    > would be better not to have it as a control.


    If it's going to emit something, even if it's "non-visual", then you should
    probably make it a control.
    --
    John Saunders
    Internet Engineer
    John Saunders, Sep 7, 2003
    #3
  4. "Shawn B." <> wrote in message
    news:...
    > Greetings,
    >
    > Is it possible to get a reference to the Page object of an ASP.NET page

    from
    > within a Component that has been placed on the page?


    Use HttpContext.Current .
    HTH.


    --
    Dave Rothgery
    David Rothgery, Sep 8, 2003
    #4
  5. Shawn B.

    Shawn B. Guest

    That didn't work because, while I could get access to the Request/Response
    objects, I need the page itself.

    So, I casted the HttpContext.Current.Handler to a page object and that
    worked.

    The only last thing I need to figure out is how to get the name of the
    instance of the Component. There is a Name property in the property editor
    for the component but there is no Name for the object (or ID) so unless I
    can figure out how to uniquely identify a particular instance of the
    component then I still am not there.

    Is there a way I can get a handle to an instnace of the component attached
    to the Form?


    Thanks,
    Shawn

    "David Rothgery" <> wrote in message
    news:...
    >
    > "Shawn B." <> wrote in message
    > news:...
    > > Greetings,
    > >
    > > Is it possible to get a reference to the Page object of an ASP.NET page

    > from
    > > within a Component that has been placed on the page?

    >
    > Use HttpContext.Current .
    > HTH.
    >
    >
    > --
    > Dave Rothgery
    >
    >
    >
    Shawn B., Sep 8, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. titof
    Replies:
    0
    Views:
    496
    titof
    Jul 24, 2003
  2. timmso
    Replies:
    1
    Views:
    477
    Alex Papadimoulis
    Dec 12, 2003
  3. =?Utf-8?B?bXN1aw==?=

    Using one webform to set a value on another webform

    =?Utf-8?B?bXN1aw==?=, Jul 12, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    456
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jul 12, 2006
  4. =?Utf-8?B?Vk1J?=

    Moving value from popup Webform to main Webform?

    =?Utf-8?B?Vk1J?=, Oct 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    567
    GroupReader
    Oct 9, 2006
  5. Luqman
    Replies:
    2
    Views:
    660
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Apr 11, 2007
Loading...

Share This Page