Solved

Sharepoint WebPart backend configuration?

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
The viewer will learn how to count occurrences of each item in an array.
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.

705 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

16 Experts available now in Live!

Get 1:1 Help Now