?
Solved

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

Posted on 2013-12-10
2
Medium Priority
?
1,189 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 1500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

752 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