Solved

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

Posted on 2013-12-10
2
1,140 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 32

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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…

691 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