Web Control Events

Discussion in 'ASP .Net Web Controls' started by Ahmzee@gmail.com, Dec 18, 2004.

  1. Guest

    Hi All,

    I am developing webpart for Sharepoint Portal Server.Webparts inherit
    webcontrol and are similar to web custom controls.

    The problem i am faing is that if i create controls (LinkButtons) in
    the CreateChildControls Method it's click event works perfactly.

    But if i create controls (LinkButtons) in the RenderWebPart Method it's
    click event doesn't work....WHY ?

    the sequence in which the events are executing is debugged to be

    1 - CreateChildControls
    2 - Control's Event
    3 - RenderWebPart

    I came to know in the click event what UI to Create so i can't use
    CreateChildControls as it has already been executed so i want to to do
    it in RenderWebpart.

    For creating controls / UI am calling the same function from both
    CreateChildControls and RenderWebPart, but it doesn't work in the
    later.

    plz Help
    Ahmzee.
    , Dec 18, 2004
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    >
    > Hi All,
    >
    > I am developing webpart for Sharepoint Portal Server.Webparts inherit
    > webcontrol and are similar to web custom controls.
    >
    > The problem i am faing is that if i create controls (LinkButtons) in
    > the CreateChildControls Method it's click event works perfactly.
    >
    > But if i create controls (LinkButtons) in the RenderWebPart Method it's
    > click event doesn't work....WHY ?
    >
    > the sequence in which the events are executing is debugged to be
    >
    > 1 - CreateChildControls
    > 2 - Control's Event
    > 3 - RenderWebPart
    >
    > I came to know in the click event what UI to Create so i can't use
    > CreateChildControls as it has already been executed so i want to to do
    > it in RenderWebpart.


    You have to do these things in CreateChildControls.

    Whenever something happens which invalidates the set of child controls, you
    must set ChildControlsCreated to false. So, for instance, in your click
    event, if you are going to change the UI, you have to set
    ChildControlsCreated to false. This will cause CreateChildControls to be
    executed the next time someone callse EnsureChildControls. At the worst,
    this will happen just before PreRender.

    John Saunders
    John Saunders, Dec 19, 2004
    #2
    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. shiv
    Replies:
    0
    Views:
    475
  2. Alvin Bruney
    Replies:
    1
    Views:
    721
  3. Sunkam Santhoshi

    Events for menu user control using ie web control

    Sunkam Santhoshi, Dec 16, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    408
    Sunkam Santhoshi
    Dec 16, 2003
  4. =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=

    order of events - dynamic checkbox events

    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=, Aug 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    563
    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=
    Aug 17, 2005
  5. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    358
    Chris
    Aug 30, 2005
Loading...

Share This Page