Solved

Sharepoint WebPart backend configuration?

Posted on 2011-03-12
4
593 Views
Last Modified: 2012-06-21
Hello everyone,

I am developing a Sharepoint Web Part, that connects to some external resources.  I am fully familiary with the programming aspects of Web Parts, however, I want to give my customer some flexibilty around the configuration of the Web Part.  For example, lets say I need to connect to a database, I would like for there to be a way to configure the web part to connect to a certain dabase, without hardcoding.

I assume I could use xml configuration files, which is all fine, but I was wondering if there is a more GUI driven way to configure web parts in Sharepoint?

Hope that makes sense!

Cheers,

DB
0
Comment
Question by:dbridle
  • 2
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
EagleUK earned 250 total points
ID: 35119917
As I understand it, the way to do this is to add Custom Properties to your Web Part to capture the relevant database connections string, User ID, and password in the Properties pane. The Web Part will persist the information automatically.

To see an overview of the process, review http://msdn.microsoft.com/en-us/library/ms948927.aspx. This is an older 2003 article, but will get you started.

This approach will allow you to capture simple connection strings, etc. If you wish to develop a more robust interface, you might want to create a custom Tool Part. See http://msdn.microsoft.com/en-us/library/dd584178.aspx.

Writing a custom Web Part to connect to a database is not trivial, so you'll probably have to do a lot of research. I don't know of any books that cover this to a satisfactory depth, but hopefully someone else will jump in with a reference.
0
 

Author Comment

by:dbridle
ID: 35120874
Eagle,

Thank you for your response.  I do not need to connect to a database I just used that as an example.

I will look into custom properties, but how are the custom properties configured? I will also check the Tool Part, which might do the job as what I need is very complex.  I was hoping it was kind of back end front end, configure the back end and hte front end will react to those configs (the web part).
0
 
LVL 7

Expert Comment

by:EagleUK
ID: 35121276
The approach could be the same, regardless of the external source. The custom Properties/Tool Part approach provides the GUI, and then you reference the values in your web part code. If you look at a third-party web part and go into Modify Web Part, you'll usually see additional categories and settings. Those are what I'm referring to.

If you explain in more detail what you are trying to do, someone might already have a solution that they can recommend.
0
 

Author Comment

by:dbridle
ID: 35122029
Happy with the link you sent, its what I am looking for. Thanks!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now