MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

Rendering UpdatePanel inside Webpart

  Asked By: Malinda    Date: Sep 20    Category: MOSS    Views: 3204

I have created a custom webpart for sharepoint 2007 that contains
Ajax update panel.
I created the controls in "CreateChildControls" subroutine, I placed
a Textbox and a gridview inside the updatepanel. Then I rendered the
controls in "RenderContents" subroutine .
Then I deployed the webparts into sharepoint site, and I note that
the webpart has rendered twice !!!!!!!
It seems that when I have been added the controls into the
updatepanel in "CreateChildControls" subrounte, it renders the
controls too !!
So, I removed the "RenderContents" subrounte from the webpart class,
and it works fine, it renders the controls just one time.
My question is.. why does it rendres the controls twice ?? what if I
want to render the updatepanel inside html table at render time? it
will render the update panel twice ?

what is the proper way to render update panel in webpart class.



8 Answers Found

Answer #1    Answered By: Ned Storm     Answered On: Sep 20

All set to go. You should use the credentials previously created.

Answer #2    Answered By: Myron Calhoun     Answered On: Sep 20

I suspect you are calling the base.RenderContents method inside  your overridden
RenderContents method. Calling the base will automatically render all the
controls in the Controls collection. Then the rest of your method Renders them
again. Simply comment out the base.RenderContents call and you should be fine.

Answer #3    Answered By: Rena William     Answered On: Sep 20

Anyway, I want to place an html table inside  the update panle .. How
can I do that ??

Answer #4    Answered By: Shanda Nolan     Answered On: Sep 20

Wouldn't you just add it to the Controls collection of the panel?

Answer #5    Answered By: Bailey Lewis     Answered On: Sep 20

Instantiate an ASP.NET Table object in your Create Child Controls method. That
will be rendered as an HTML Table

Answer #6    Answered By: Quentin Cummings     Answered On: Sep 20

the update panel needs UI control inside  its content, so how can I place HTML
elements inside the update panel contents , for example, html div ??

Answer #7    Answered By: Bhoomi Chabaria     Answered On: Sep 20

For any HTML element that you would want to include you should use the ASP.NET
control that will render that way. An ASP.NET panel will render as a div.
Simply add any control to the controls collection of the panel to have it
rendered inside  the <div> tag.

Answer #8    Answered By: Richa Verma     Answered On: Sep 20

You are right .. I will try your suggestion.

Didn't find what you were looking for? Find more on Rendering UpdatePanel inside Webpart Or get search suggestion and latest updates.