Solved

Sharepoint WebPart backend configuration?

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

864 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

21 Experts available now in Live!

Get 1:1 Help Now