Solved

How to create web part property and pass its value to my user control

Posted on 2013-12-10
2
1,066 Views
Last Modified: 2014-01-13
I created a normal web part (NOT VISUAL WEB PART) in my sharepoint 2013 environment using visual studio 2012 and C#.

I'm loading a user control inside this web part. I want to create a property in the web part and the property value I want to pass it to the user control. How do I do that.
0
Comment
Question by:bujjigadu
2 Comments
 
LVL 31

Accepted Solution

by:
Jamie McAllister MVP earned 500 total points
ID: 39710995
Create a web part property like the example here;
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/3aa35b0e-27f9-4dbb-ab8a-2fc1d7435850/custom-web-part-properties-in-visual-studio-2012?forum=sharepointdevelopmentprevious

Create a property on the user control with a scope that makes it visible to the web part, or even in the constructor if possible and appropriate.

Set the user control property when that control is instantiated in the web part.
0
 

Author Closing Comment

by:bujjigadu
ID: 39777235
Good
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

This very simple solution applies to a narrow cross-section of the "needs to close" variety. In this case, the full message in Event Viewer was in applog, Event ID 1000: Faulting application iexplore.exe, version 8.0.6001.18702, faulting module …
Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

786 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