SharePoint 2013 Visual Web Part Custom Property.

 How to create drop down control to display existing libraries in current web site using a custom web part property?i want to show this control on web part configuration.then users can select the relevant library without typing.(SharePoint
2013 Visual Web Part).
Thanks 

This has been answered for SP 2010 at SP:SO. Things wont change much in SP 2013 as far as VWP is concerned. Basically you will need to implement Custom Web Part Editor.
http://stackoverflow.com/questions/6946153/edit-webpart-properties-with-dynamic-dropdownlist
Here is an example.
http://sptechbytes.blogspot.ca/2013/02/sharepoint-2010-creating-custom-editor.html
Amit

Similar Messages

  • How to Add a User Control to a SharePoint 2013 Visual Web Part ?

    Hi,
    1.I have created SharePoint 2013 Farm Solution through VS 2012.
    2.Added visual Web part
    3.Created a User control (Farm Solution ) and added some Control From tool Box.
    4.Drag and drop user control from solution explorer to visual web part.
    so its  Register tag and with prefix tag user controls automatically added on visual web part source. when i try to build solution it throws Exception:
    Exception :The name 'InitializeControl' does not exist in the current context.
    Please Provide solution after try/or proper workaround.
    Thanks,
    Siddheshwar

    Site name=http://sitename:22222/
    Visual Web part:
    <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
    <%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
    <%@ Import Namespace="Microsoft.SharePoint" %>
    <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Src="~/_controltemplates/15/SP2013Controls/SPControls.ascx" TagPrefix="uc1" TagName="SPControls" %>
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SPWebpart.ascx.cs" Inherits="SP2013Controls.SPWebpart.SPWebpart" %>
    <uc1:SPControls runat="server" id="SPControls" />
    User Control Code:
    <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
    <%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
    <%@ Import Namespace="Microsoft.SharePoint" %>
    <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SPControls.ascx.cs" Inherits="SP2013Controls.ControlTemplates.SP2013Controls.SPControls" %>
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:Button ID="Button1" runat="server" Text="Button" />
    Deployement Location:{SharePointRoot}\Template\ControlTemplates\SP2013Controls\
    After User controls added on webpart .g.cs file getting blank.
    After 1st Build:
    'InitializeControl' does not exist in the current context
    The file '/_controltemplates/15/SP2013Controls/SPControls.ascx' does not exist.
    after 2nd Build Try:
    'InitializeControl' does not exist in the current context

  • Sharepoint 2013 Visual Web part Deloyment

    Hello,
    I built a visual web part(sharepoint 2013) using visual studio 2012. But when I tried deploying, I got this error message:
    "Error occured in deployment step 'Activate Features': Feature id '****' is not installed in this farm, and cannot be added to this".
    Approaches I made to fix this :
    1) Tried changing the scope of Feature to Farm/Web/WebApplication
    2) Tried installing feature manually using Install-SPFeature -AllExistingFeatures
    3) Tried resetting IIS
    None of these attempts helped me. Can someone help me on this ?
    Thanks
    KG

    Hi,
    According to your post, my understanding is that you get error while deploying the visual web part.
    To narrow down whether the issue is related to the project itself, you can do some steps as below.
    Re-open the visual studio, create a new clean project with a simple visual web part then check whether it works.
     What’s more, you can check whether feature assembly is register in GAC or not. So try to uninstall feature and use below command: (if have not done before)
    Install-SPSolution -Identity MYfeature.wsp  -GACDeployment -force
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How to display alert message box in sharepoint 2013 visual web part?

    Hi,
    I am developing a visual web part which submits data to the list. Once it submits the data, I should convey to the user that the data has been submitted successfully.
    I tried using clientScript.RegisterStartUpScript etc, but, none of them are working. It is not throwing any error , but pop up is not getting displayed.
    Preferrably, I would like to call this alert message from cs page, because, I will be using it in several places.
    Please help me.!
    Thanks in advance.
    Hepsi

    Hepsi, 
    Step 1. On the Page_Load - This way you can pass parameters. Try this
    btn.Attributes.Add(
    "onclick", string.Format("return openSPPopup('{0}?{1}={2}', '{3}')", YourPage_URL, var1_Name, value1, Param1_PopupTitle));
    Step 2 : Javascript function
    function openSPPopup(navigateURL, popUptitle) {
    var options = {
    width: popupWidth,
    height: popupHeight,
    url: navigateURL,
    scroll: 0
    SP.UI.ModalDialog.showModalDialog(options);
    return false;
    Step 3: The popup close code (in .cs file) – I do it this way as it is just close dialog code and easy to write.
    protected void btnClose_Click(object sender, EventArgs e)
    { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", "SP.UI.ModalDialog.commonModalDialogClose(1, 1);", true);
    Courtesy -
    Thread
    Try this - https://bramdejager.wordpress.com/2011/03/21/using-sp-ui-dialog-and-sp-ui-notify-from-code-behind/
    http://msdn.microsoft.com/en-us/library/ff798390.aspx
    http://stackoverflow.com/questions/9833907/asp-net-confirm-before-executing-codebehind
    http://www.codeproject.com/Questions/443131/Call-to-javascript-Function-from-code-behind-using
    http://www.c-sharpcorner.com/uploadfile/ledomoon/calling-code-behind-function-in-javascript/
    Hope they will help!
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • SharePoint 2013 Mobile Web Part development

    i want to create a Visual web part which will render in Mobile in share point 2013
    Thanks and Regards
    Er.Pradipta Nayak
    Visit my Blog
    Xchanging

    If you want just for the webpart try using WebPartMobileAdapter class, this is in SharePoint 2010, see if it works in SP 2013
    http://www.c-sharpcorner.com/uploadfile/hec.ravi/programmatically-create-web-part-for-mobile-in-sharepoint2010/
    check here on how to implement responsive web design
    http://blogs.msdn.com/b/sharepointdev/archive/2013/04/01/implementing-your-responsive-designs-on-sharepoint-2013.aspx
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • Sharepoint 2013 - InfoPath Web Part Errors

    There may be a better way to accomplish what I'm doing so I will explain the idea first.  I'm putting together a PMO Sharepoint Site which contains drill down project information from 4 groups to over 500 projects.  I would like to display the
    data in a more dynamic way than just in lists so I am attempting to use an InfoPath form to display dynamic data in a more friendly text view.
    After creating a form view in InfoPath 2010, I loaded it into Sharepoint 2013.  I went through "Connections" and selected "Get Form From" and chose a web part list.  After choosing the view and saving I receive this error.  Sometimes
    it saves correctly but when I go back to edit the web part this error appears.

    This has been answered for SP 2010 at SP:SO. Things wont change much in SP 2013 as far as VWP is concerned. Basically you will need to implement Custom Web Part Editor.
    http://stackoverflow.com/questions/6946153/edit-webpart-properties-with-dynamic-dropdownlist
    Here is an example.
    http://sptechbytes.blogspot.ca/2013/02/sharepoint-2010-creating-custom-editor.html
    Amit

  • Internet Explorer 11 and SharePoint 2013 Standard - Web Parts and Calendar Don't Display/Render Correctly

    Hello everyone.
    I am currently running a fully patched (Service Pack 1) version of SharePoint Standard 2013 On Premises. I am having 2 problems that are reproducible on both Windows 7 and Windows 8.1 on multiple computers when running Internet Explorer 11 (fully updated
    through Windows Update). The issues are "fixed" when running compatibility view in the browser or using Chrome/Firefox.
    The issues are as follows:
    Issue 1 Calendar view does not display correctly
    Issue 2 Web parts do not display correctly when editing a page.
    Picture of calendar
    Webpart "edit menu dropdown" in upper right corner is replaced with 2 up arrows. Clicking minimizes web part.
    Is there any word on a fix for this? Is this something only I am experiencing? Is there an issue with my SharePoint server? I would hate to have to uninstall IE11 from 300 machines and install IE10.
    Thanks

    There are a few critical issues
    Pages will not enter edit mode. You will click Settings > Edit Page and the page will simply refresh but will not change over into edit mode. Seems to only affect pages with
    Web Part Zones.
    Calendar will not enter edit mode.
    Web Part Properties cannot be modified. If you are able to get into edit mode (you can edit wiki pages) you will not be able to modify existing Web Parts by using the Web Part
    Properties panel. Instead you will see a really weird collapse button that looks like it is coming from the mobile view but you cannot modify web part properties… even through the ribbon controls.
    I cannot use the import spreadsheet app, the error says it is not supported with the current browser.
    When I hoover over a “people” field I cannot see their information.
    I had all these capabilities with IE9
    This suggestion I found online appears to fix issues 1-3.
    http://windowsitpro.com/windows-7/fixing-most-not-all-ie11-compatibility-problems
    To run in compatibility mode
    Press ALT + T when viewing your      SharePoint page
    Click Compatibility View Settings      in the menu that appears
    Click Add to add the current      SharePoint site to your list of compatibility view pages
    Click Close

  • Access Exchange 2013 Calendar from Sharepoint 2013 OWA Web Part

    Hi,
    For the moment I have five User
    Mailboxes on Exchange 2010 whose
    calendars that appear in a SharePoint
    2013 using Outlook Web App Web Part.
    In Exchange 2010, IIS has created a new
    WebSite with OWA, ECP
    and some more Virtual Directories,
    where OWA is Windows Integrated
    and Basic Auth. enabled (not
    FBA).
    This makes so users do not have additional
    logins in SharePoint when they look at
    the calendars.
    I now want to move these mailboxes to an Exchange
    2013. I must then create a new WebSite
    with Win.Integrated etc, but have
    heard it is unsupported. Is there
    any other way to solve this?
    Best Regards

    Hello,
    Sorry for delayed response.
    I recommend you check the Outlook Hotfix and version number again via Control Panel.
    Please check the version number via outlook 2010 "File".
    If the outlook version number is 14.0.7113.5000, please try my above suggestion to specify the SSL certificate principal name. Because XP system is not always to look for the next lines on a SAN certificate.
    If you have any feedback on our support, please click
    here
    Cara Chen
    TechNet Community Support

  • SharePoint 2013 - Media Web Part and Silverlight

    Hi
    Is Silverlight mandatory for Media Web Part.? As per my understanding .WMV and .MP4 files will be played in HTML 5 player with IE 9 and above.
    I have configured a Media Web Part with a .WMV video file. We have to use IE9 browser. The video plays with Silverlight but if I uninstall Silverlight from machine it doesn't play. How to make these videos play in machines without
    silverlight?
    Thanks
    Ari

    Hi Ariharaselvan,
    If you use Media Web Part to play the video, you need to install Silverlight on the client server. If not, it doesn’t work.
    As a workaround, you can use a third party media player to play the video. Here is a CodePlex solution, please have a try:
    http://svp.codeplex.com/
    There are some articles for your reference:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/aed125ee-614d-4fd6-9426-93aacc702b0d/play-video-on-page-without-using-silverlight?forum=sharepointgeneralprevious
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/26a7639d-6b77-4bc3-8f36-0db10b132daf/using-internet-explorer-8-to-play-sharepoint-2013-video-stream-without-silverlight?forum=sharepointadmin
    http://sharepointconnoisseur.blogspot.in/2011/05/play-video-and-media-files-in.html
    I hope this helps.
    Thanks,
    Wendy
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Wendy Li
    TechNet Community Support

  • SharePoint 2013 Filter Web Part configure connection webpage blank

    Hi,
    I've got a problem at one of my clients. I'm trying to connect a filter web part to a document library.
    I'm configuring a connection and the first pop-up (where you can configure a "Get Parameters From or Get Filter Values from" connection type) shows up fine.
    When I select one of the options the next screen is all blank.
    I've used IE in different modes (IE 11, IE 10 IE 9) and also tried using Chrome, but all the same result.
    Can anyone help me?

    Hi Elmar,
    According to your description, my understanding is that the Configure Connection webpage of the filter web part was blank.
    I recommend to add the site where the filter web part existed to the trusted zone and add to compatibility view in Internet Explorer to see if the issue still occurs.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Create a visual web part which get data from excel sheet and import it into sql server database in sharepoint 2010 (development)

    Hi,
    I want to create a visual webpart which will read data from excel sheet and import it in to sql server database.(using sharepoint development)
    I want to do it using visual webpart.
    Please help to solve the issue.
    Thanks in advance!
    Regards
    Rajni

    Hi  Rajni,
    Microsoft.Office.Interop.Excel assembly provides class to read excel file data, in your web part solution, reference the assembly, and following blog contains samples about how to read the excel file data,
    and import it to SQL  database.
    1.Create a Visual Web Part Project:Create
    Visual Web Parts in SharePoint 2010
    2.Read the excel workbook by using SPFile class:
    http://alancejacob.blogspot.in/2012/06/read-data-from-excel-file-and-insert-in.html
    http://stackoverflow.com/questions/14496608/read-excel-file-stored-in-sharepoint-document-library
    3.Export the excel workbook to SQL Server:
    http://www.c-sharpcorner.com/UploadFile/99bb20/import-excel-data-to-sql-server-in-Asp-Net/
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Way to use Visual Web part in sharepoint 2010 without using/installing third party tools

    I want to know the way to use Visual Web part in sharepoint 2010 without using/installing third party tools.
    Please provide me a link where i can actually know how it is done.

    + to _eNo_,
    Visual Studio 2010 has support for visual webpart, you can find that under Visual C# node in the Installed Templates section (if your preferred language is C#)
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • SharePoint visual web part project creation usng TFS2010

    Hi,
    I have configured TFS2010 in SharePoint 2010 server and used TFS url in client machine.
    From client machine i am able to create new TFS project, but i cannot find information's to create SharePoint project using VS2010 SharePoint templates?
    How to create Visual web part project using TFS2010?
    Anandhan.S Remember to 'mark or propose as answer' or 'vote as helpful' as appropriate.

    Hi,
    According to your post, my understanding is that you wanted to create SharePoint project using the TFS 2010.
    Did you install the Build Support for Apps for Office and Apps for SharePoint?
    To build apps for Office and apps for SharePoint projects, several components must be installed on your system.
    What’s more, we should copy several Visual Studio SharePoint assemblies to the GAC on the build server.
    Copy the SharePoint Tool Assemblies and Files to the GAC
    The following assemblies must be copied to the GAC of the build system:
    Microsoft.VisualStudio.SharePoint.Designers.Models.dll
    Microsoft.VisualStudio.SharePoint.Designers.Models.Features.dll
    Microsoft.VisualStudio.SharePoint.Designers.Models.Packages.dll      Microsoft.VisualStudio.SharePoint.dll
    There are two articles about building SharePoint 2010 solutions on TFS 2010, I think it’s helpful for your to create project in TFS2010.
    http://msdn.microsoft.com/en-us/library/ff622991.aspx
    http://blogs.msdn.com/b/jjameson/archive/2011/02/27/building-sharepoint-2010-solutions-on-a-tfs-2010-build-server.aspx
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Sharepoint visual web part

    Hello, I would like to create visual web part, that can be used within SharePoint LIST's edit item form...I want to include treeview into the webpart and load a directory structure to it...a direcotry structure is meant a Folder hierarchy from fileprint
    server - share.
    to browse through share I use:
    stringsourcePath
    ="D:\\";
    foreach(stringdr
    inSystem.IO.Directory.GetDirectories(sourcePath))
    but I am receiving this error:
    An exception of type 'System.Security.SecurityException' occurred in prva.dll but was not handled in user code
    Additional information: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
    stack trace:
       at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
       at System.Security.CodeAccessPermission.Demand()
       at System.IO.Directory.InternalGetFileDirectoryNames(String path, String userPathOriginal, String searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption)
       at System.IO.Directory.GetDirectories(String path, String searchPattern, SearchOption searchOption)
       at System.IO.Directory.GetDirectories(String path)
       at prva.VisualWebPart1.VisualWebPart1.Page_Load(Object sender, EventArgs e)
       at System.Web.UI.Control.OnLoad(EventArgs e)
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
    please, help if possible

    You code failes because of security permission,set <trust level="Full" />
    see these threads, should help you to resolve
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/3c10b18b-b098-4967-8664-137bee9c2dcc/request-for-the-permission-of-type-fileiopermission-failed?forum=sharepointdevelopmentlegacy
    http://forums.asp.net/t/1422162.aspx?System+Security+SecurityException+Request+for+the+permission+of+type+System+Security+Permissions+FileIOPermission+mscorlib+Version+2+0+0+0+Culture+neutral+PublicKeyToken+b77a5c561934e089+failed+
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • Create a Site Definition file with Visual Web part in Visual Studio

    I tried to create a site definition file in Visual Studio 2013 and SharePoint 2013 by following the MSDN tutorial:
    Walkthrough: Create a Basic Site Definition Project. Near the end, I added a virtual web part control to the site definition and registered MyWebPartControls in the site definition's default ASPX page as written in the MSDN tutorial:
    Unfortunately, IntelliSense doesn't show any MyWebPartControls: tags, and VisualWebPart1 is highlighted with a warning “Element 'SMWebPart3' is not a known element. This can
    occur if there is a compilation error in the Web site, or the web.config file is missing.”
    Since it’s a warning, I went ahead to build and deploy the solution. However, when I used the site definition template to create a subsite, it returned a parser error:
    Unknown server tag 'MyWebPartControls:TestSiteDef1.VisualWebPart1'
    I spent half day researching and debugging, and finally solved the problem. The issue is on the registration line:
    <%@ Register Tagprefix="MyWebPartControls" Namespace="TestSiteDef.VisualWebPart1" Assembly="$SharePoint.Project.AssemblyFullName$" %>
    The $SharePoint.Project.AssemblyFullName$ is a replaceable parameter to provide values for SharePoint solution items whose actual values are not known at design time. Unfortunately, it does not find the right assembly name during the deployment. It should
    be replaced by the Assembly’s Strong Name. Here is how I fixed the problem step by step:
    In Solution Explorer, open the package node and double click Package.package
    Click Manifest tab in the Package.package.
    Copy the full assembly name in the package’s manifest. It may be similar like this:
              Assembly="TestSiteDef,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=a300f1f2da8ae976"
    Back to the site definition’s default.aspx page, replace the
                     Assembly="$SharePoint.Project.AssemblyFullName"
    in the registration line with the copied text:
    Assembly="TestSiteDef,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=a300f1f2da8ae976"
    Change the Namespace from
    Namespace="TestSiteDef.VisualWebPart1"
    to
    Namespace="TestSiteDef".
    The line to register the web part in a site definition file will look like this:
    <%@
    Register
    Tagprefix="MyWebPartControls"
    Namespace="TestSiteDef "
    Assembly="TestSiteDef, Version=1.0.0.0,
    Culture=neutral, PublicKeyToken=a300f1f2da8ae976"
    %>
    Clean, build and deploy the solution. It works like charm. (Note: the warning message on visual web part may still exist, but you can ignore it).

    Assuming your .ascx.vb file is inheriting from the web part class, you can add the custom properties in the same manor (language syntax aside).
    Be sure to use the attributes to correctly identify and scope the properties. (see:
    http://www.sbrickey.com/Tech/Blog/Post/SharePoint_Attributes_for_Web_Part_properties)
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com

Maybe you are looking for

  • Camera function is not working

    The camera function is not working on my iPhone 5 that was only bought on 19/1/2013.  Whne you click on the photo icon on the screen you just see the pictur of the closed shutter.  Does anyone know how I can fix this or have had this happen to them, 

  • How to restart imac 10.5.2 to previous days, because of accidental deletion

    Help! I deleted my things off my hd cause I am an idiot. I heard you can restart your mac to a previous days settings and have your pics and itunes back

  • How to retain field formatting using this.getField

    I am pulling a phone number from a form field using this.getField("EmailAddress").value and inserting it into an email.  Once there, it loses it's formatting as a phone number and becomes a string if 10 digits again.  Is there a way to retain or recr

  • Calendar + Badges

    Is there any way of getting a badge to show up on the calendar icon when there is something scheduled for today? For example a birthday, I don't want to set an alarm, just have a visual cue to check the calendar today... Any ideas? Or any apps that w

  • Ip addressing and subnetting

    Hello everyone i am writing a program that will test to see if to ip addresses are on the same network thet only thing is i have no idea what would the best route to take has anyone done anything similar or has anyone any advice i could use