.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How does web part stores its properties when a piece of code is executed in it?

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :SharePoint


I am trying to program my first webpart based on this:


This webpart must show people who have birthdays on particular day of the month. There should be a button for each month (and one for "whole year) and button for each day (and one for "whole month") and so user can choose to show only those with birthdays in say, april 23, or whole june...

I did it this way:

Following the tutorial, i create all my controls inside the CreateChildControls() and i store references to them as properties of the webpart class. Also the class (public class BirthdayFullScreenWebPart) has properties (int chosen_month) and (int chosen_day).

Then i have have onclick for buttons that changes the chosen month and/or day web part property, based on which button was clicked.

Then i have a function "UpdateUserList" that ouptuts list of users into the webpart's table control, based on the chosen month and day. this function is called inside createchidlcontrols after all of them are created, and inside onclicks when the month/day is changed.


What i got is that the values of the variables were behaving really odd. 

In my mind, it

View Complete Post

More Related Resource Links

Foundations: Adding Code Access Security to WCF, Part 2


This month's column continues the discussion around code access security in WCF and partially trusted services.

Juval Lowy

MSDN Magazine July 2008

Foundations: Code Access Security in WCF, Part 1


Here we discuss code-access security in Windows Communication Foundation (WCF) and present a solution for enabling partially trusted clients for WCF services.

Juval Lowy

MSDN Magazine April 2008

Web Part Versioning and Deployment (properties only)


Suppose I have a 3<sup>rd</sup> party Web Part (source code provided, with Web Part deployed as a Feature) that’s installed and used in several Sites within a Site Collection.  I want to make changes not to the source code (which would require updating the assembly and deploying the changes as an updated Feature/Solution Package), but to property values of the Web Part that exist.  Say the WP exists on 10 pages, and I want to change the WP’s Title property from “Amazing Vendor Web Part” to “My New Title”.


First, would this be considered an “out-of-band” patch?  Not that it matters terribly how to label this…


Second, would the ideal approach be to simply add code within a Feature Receiver in that Web Parts VS project (the Feat

Customizing Web Part Properties


 I am writing a web part for SharePoint. To define a custom property that will render as a dropdown list in tool pane For That I need the variable in a type of enum.But that dropdownlist has to be populated dynamically(i.e droplist items are supposed to the list&document lib names in the entire site collection),Which is not supported by Enum.I am extremely new to coding.any help is highly appreciated .

Thankz in advance.



Moving part of the code/processing from Asp.net hosted in IIS to WCF-Windows Services will help to r

I have a web application with no user interface (GUI), this web application (asp.net) accepts some input from a program and doing some processing; In the Page Load event I am doing all processing and calling a WCF service, after receiving the response from WCF services the page get unload before writing the processing status/result to database) this asp.net application is hosted in IIS.   The WCF services is also hosted in the same machine in windows Services where IIS is hosted, I am concern about its performance of the application which is hosted in IIS.  Should I move some part of the code (processing) to another program say Create a new WCF Services and host it in Windows Services  so that the load on IIS will be reduce?  The new WCF Services will process some part of the code which IIS used to process, so helping IIS to reduce the load.       By moving some part of code from asp.net [processing] to another program hosted in WCF- Windows Services in same machine will able to reduce the load on IIS?   Please guide me.. Thanks Shaju

Changing Properties/Attributes of a Webpart in inline code block - Error 'System.Web.UI.WebControl

I'm trying this code below, but gettting error: System.Web.UI.WebControls.WebParts.WebPart' does not contain a definition for 'FilterValue1' I need to change the value of the FilterValue1 properties of a content Query WebPart with title = Applicant Files. Thanks in Advance!
protected override void OnLoad(EventArgs e) {  base.OnLoad(e); SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite SiteCollection = new SPSite("https://somesite/")) { SPWeb myWeb = SiteCollection.OpenWeb(); myWeb.AllowUnsafeUpdates = true; Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager mgr = null; mgr = myWeb.GetLimitedWebPartManager("default.aspx",System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared); foreach (System.Web.UI.WebControls.WebParts.WebPart myWebPart in mgr.WebParts) { if (myWebPart.Title == "Applicant Files") { myWebPart.FilterValue1 = "/13"; mgr.SaveChanges(myWebPart); break; } } } }); }

RDL rename breaks all references to expressions and report properties code in BIDS

I have done a 'save as' in BIDS and changed the name of the file from ordreqn-lab.rdl to ordreqn-ptheader-per-order.rdl.  The report has custom code in the report properties and expressions that are based on that code.  After renaming this report I get 100 errors all rsFieldReference errors basically saying the expressions and fields are not referring to the current dataset. Version info: SQL 2008 R2. Any assistance would be greatly appreciated. I did notice there is another rename bug.  Is this a bug also and if so what is the status of a fix. Please let me know if I can provide further information. I don't see a place to attach the rdl. http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/564f5031-e832-4666-ab52-29391b74b955/

Adding logic to the Search Core Results web part - Manipulation in code or XSL?

Hi,I need to manipulate the search core results web part, so that:- It will display a check box for each result- It Will have an additional button. When clicking on this button the checked results should be copied to a grid view.Do you have any idea how it can be done?I am not sure what is the correct way to do it – in the client side via the XSL Editor or in the server side with the C# code.Thank you so much for your help,Regards,SP beginner.

Error code -2068578304 When Installing Express SP1 x64 as a Part of Visual Studio 2010 Installation

Howdy! I was installing the VS 2010 on my server running Windows Server 2008 R2 x64 and all of a sudden the setup finished with " Setup completed, however, there were failures reported installing optional components. " The final status is success. The left-hand pane of the finish page reads as: The following component failed to install: Microsoft SQL Server 2008 Express Service Pack 1 (x64).   Leaving alone the fact why setup executed the custom action that tried to install SQL Server Express Edition and Compact Edition when I just asked it to install SQL components (which presumably should be SQL SMO and DMO libraries), I would like to understand what had happed to Express install.   Inspecting the .\Logs\dd_error_vs_vstdcore_100.txt file gives the following record:   [09/16/10,16:06:51] Microsoft SQL Server 2008 Express Service Pack 1 (x64): [2] Error code -2068578304 for this component is not recognized. [09/16/10,16:06:51] Microsoft SQL Server 2008 Express Service Pack 1 (x64): [2] Component Microsoft SQL Server 2008 Express Service Pack 1 (x64) returned an unexpected value. ***EndOfSession***   Further inspection of the dd_install_vs_vstdcore_100.txt provides with the info:   [09/16/10,16:02:51] Microsoft SQL Server 2008 Express Service Pack 1 (x64): GenericComponent Action: CreateProcess launched with cmd line : x:\setup\..\wcu\sse\SQLE

Web Part Properties issue


Hi there,

I've create a custom object for my web part. I can compile  the web part or web part editor without any issue.  However, when I click "Apply" or "Ok" on the Web Part Editor (this is where I've to update the CustomObject value, I have debugging it line by line there was NO error at all) But an error message raise on the top on the editor.

"Cannot save all of the property settings for this Web Part. An error has occurred."


Any idea what could cause this? or how should I debug this one? Thanks!


  [WebBrowsable( false ), WebDescription( "Custom Object" ), WebDisplayName( "Custom Object" ), Personalizable( PersonalizationScope.User )]
  public CustomObject ProjectCustomFieldsInfo {



No "Edit Form Code" in Button Properties box.


Using InfoPath 2007. VSTA is installed. Also have VS 2008.

Want to test button onClick, but when I double click but in form design, I don't have the "Edit Form Code" button.

ALT-SHT-F12 opens VSTA, but no code automatically added for the onCLick event like it would be with Edit Form Code button.

Any suggestions or explanation why I can't see it?

Can I "hard-code" a particular report in the report viewer web part?


Hi there,

I am wondering if it is possible to "hard-code" a particular report in the report viewer web part, such that this report is automatically loaded when a user visits a particular site. I am asking that question because I do not want to select the same report each time I want to view it; I just would like to have a link that will get me the report right away.

Best wishes



Code in Content Editoe Web Part - Issue


I added the following code in content editor web part.

<!-- Code to hide Tab Page Help Link -->

<script type="text/javascript">

 $(document).ready(function() {




<!-- Code to add Tabs -->

<div id="tabs">

  <ul class="tabNavigation ms-WPBody">

   <li><a href="#tab-1" class="selected ms-topnavselected"><span>TAB 1</span></a></li>

   <li><a href="#tab-2" ><span>TAB 2</span></a></li>

   <li><a href="#tab-3" ><span>TAB 3</span></a></li>

   <li><a href="#tab-4" ><span>TAB 4</span></a></li>


  <div style="clear: both"></div>


After few edits to the page, when I try to edit the code in the content editor web part, the code appeared as follows. Not sure why these jquery ids got appended everywhere. Any suggestion as a solution for this issue ?

<!-- Code to hide Tab Page Help Link --><script type="text/javascript">

 $(document).ready(function() {



<!-- Code to add Tabs --><div id="tabs"><ul cla

Properties from unmanged code


Hi All,

I've stumbled upon the following, i am building an 3d editor, where most of the code/engine is written in unmanaged c++. Now we are building the frontend( GUI ) in the .net( managed ) language. Everything works fine, except for emitting properties. Basically what we want is that variables created in unmanaged code can be edited inside a propertygrid.

So my guess is to write a wrapper that handles dynamically sized properties, but i have no idea where to start any pointers( pun intended ) are welcome







SummaryLinkWebPart : Access Denied saving Web Part properties after migration to Moss 2010


Hi everyone,

i got the error below when i access pages containing a SummaryLinkWebPart. The error occured only with user having non-administrative privilege.

The curious thing is that after an administrator access one of this pages, it starts to work for non-administrative users too.

The site collections containing these pages has been migrated from Moss 2007 to Moss 2010.

I'd like to find a better solution than navigate through all my pages with site collection administrator account.

Any suggestion would be very appreciate

Access Denied saving Web Part properties: either the Web Part is embedded directly in the page, or you do not have sufficient permissions to save properties

Custom web part properties are not saved in SharePoint 2010 visual web part


I have created my first visual web part in SP2010.  In 2007 version I didn't use user controls so all of my code was in a single file for the most part.  Now I've separated out the code.  Everything works great and I like this a lot better (more like traditional ASP.NET development) with one exception.  In my bootstrap .cs file (I call it that because it does nothing but load the user control file) I put all of my custom web part properties.  Then in my web part code-behind I reference them thru an instance of the containing class.  I must have something incorrectly configured because none of the changes to the properties at runtime are getting updated in the code.  Here's a filtered view of how I have it wired together:

Sample property in the top level .cs file:

private string m_ImagePath = "sites/myapp/images1/branded_image.png";
   WebDisplayName("Relative path to header image"),
   WebDescription("Relative path to header image"),

Custom Properties in Advanced Search Web Part - a bug??



we are trying to configure the advanced search web part and add some custom properties. Those properties are of type managed metadata.

We saw the following sample:


When try to use the web part, for example by add the property "product" and then search "when [product]="valueA",

we get not only results where the item has a property "product=valueA",

but also any item where in its body (full text) there is "valueA".

This behavior doesn't occur when searching non-custom property (for example "author=keren").

Is that a bug or are we missing something in the customization?

thanks a lot!



keren tsur
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend