Solved

Sharepoint WebPart backend configuration?

Posted on 2011-03-12
4
601 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to count occurrences of each item in an array.

809 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