Custom controls vs Web parts

W

weboweb

Hi,

I'm new in web parts, I would like to understand a couple of things:

Let's say I have a custom control that displays information. That info
is fed to the control through an XML string, so the control parses it
and builds itself.

Now that XML is obtained in the parent page, by calling a c# dll that
deals with the database tier. The page then populates some property in
the control.


Now if I where to convert this control into a web part, how would I go
about getting this information and passing it to the control?

I mean, I don't want any database functionality inside the control,
only to accept some XML string.

How do I get this information to the web part? Is there a concept of
"Page" in Sharepoint?

Please excuse me if this is not the right group, but since asp.net
controls are involved, I figured what the heck :)

Thanks all!

webo
 
T

Tomodati

Hi,
You should try to download webpart toolkit from microsoft's site.
That are some templates of webparts I mean, very simple schema of webpart
code ;)
But it is useful. As I had a deal with web parts ( later we have been using
sharepoint as a content server and been connecting from windows forms
client ), You are obliged to write all html code for rendering, so it easier
to paste whole code from Your control to body of method RenderControl ( or
something like that ) what is responsible for rendering webpart on site.
Believe me, this is the first step;) After that, You have to compile signed
webpart and import it to sharepoint site.
The best solution for you is deep analyse of sharepointportal newsgroup:)

Best regards,
Adas
 
W

weboweb

Tomodati said:
Hi,
You should try to download webpart toolkit from microsoft's site.
That are some templates of webparts I mean, very simple schema of webpart
code ;)
But it is useful. As I had a deal with web parts ( later we have been using
sharepoint as a content server and been connecting from windows forms
client ), You are obliged to write all html code for rendering, so it easier
to paste whole code from Your control to body of method RenderControl ( or
something like that ) what is responsible for rendering webpart on site.
Believe me, this is the first step;) After that, You have to compile signed
webpart and import it to sharepoint site.
The best solution for you is deep analyse of sharepointportal newsgroup:)

Best regards,
Adas

Thanks Adas for the input, I was actually looking a bit more on the
data-transfer part of it.
Since you have been using web parts, how do they display the
information?
Do they connect directly to the database, or you pass the data to them
from the containing object (call it Page, Parent, etc)

I have an idea how to convert a custom server object into a web part,
but my question is more on the way data will be provided to the web
part itself.

webO
 
G

Guest

Hi

I don't know if you've found a solution to this yet, but basically, anything
you've handled in a control previously should work in a webpart.
I don't know how you handle your c# dll, but I imagine you should have no
problem using it with a webpart, maybe referencing it in your webpart
project. All data is handled in the same way as in a regular c# project. You
can opt to use the RenderControl method to output html of the webpart to the
page, or use a slightly simpler approach in my opinion, and just use
CreateChildControls method to add labels, textboxes, datagrids and whatnot
which will be automatically rendered and put in the webpart. The data to
output can be put in the labels, textboxes etc in the code and will then be
displayed in the webpart on the page.
Hope this helps at all.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top