Change a label in page when webpart properties are changed

Hi
can anyone please tel me how to
Change label in page when webpart properties are changed
Nishanthi N

Hi Nishanthi,
If it would be a Visual Webpart, then you have to pass webpart property in user control as WP property bag/collection so that you will retrieve it in ascx and assign its value to label on load event.
Add below code in Webpart:
[Personalizable(), WebBrowsable, WebDisplayName("City or Town"), Category("Address settings")]
      public String City {
get; set; }
        protected
override void CreateChildControls()
        AddressUserControl control = Page.LoadControl(_ascxPath)
as AddressUserControl;
        if
(control != null)
            control.WebPart =
this;
        Controls.Add(control);
Put this code in your ASCX Control:
MyWebPartClass ParentWebPart = (MyWebPartClass)this.Parent;
Use this code in your ASCX methods:
string webPartProperty = this.ParentWebPart.City;
Thanks
Please mark it as Answer if works...

Similar Messages

  • Why does safari display empty page when localhost service are requested using https?

    Why does safari display empty page when localhost service are requested using https and port 37542 (https://localhost:37542/), but displays page properly when regular port is used (https://localhost/).
    Both links return the same json response and work properly in other browsers. Certificate for localhost service was installed to the storage.

    Problem solved.
    I added headers for localhost service response and page displayed normally.

  • Safari can't open a specific web page when parental controls are enabled and don't give access to modify the dock.

    iMac running mountain lion with all updates applied.
    I (my kids) are trying to use www.coolmath-games.com and when I have parental controls enabled and I do not give the ability to modify the dock the page comes up blank.
    It doesn't matter how I have the web controls set (I said allow all just to be sure).
    If I toggle on "allow user to modify the dock" the above page works.  If I toggle it off, then the page doesn't work.
    I *think* this page worked in Lion, but I don't know for sure.  The kids just started complaining about it after I updated to mountain lion.
    Any suggestions?

    iMac running mountain lion with all updates applied.
    I (my kids) are trying to use www.coolmath-games.com and when I have parental controls enabled and I do not give the ability to modify the dock the page comes up blank.
    It doesn't matter how I have the web controls set (I said allow all just to be sure).
    If I toggle on "allow user to modify the dock" the above page works.  If I toggle it off, then the page doesn't work.
    I *think* this page worked in Lion, but I don't know for sure.  The kids just started complaining about it after I updated to mountain lion.
    Any suggestions?

  • Safari fails to open page when other downloads are in progress

    I have a 2.8GHz 4GB Ram machine with Mac OS X 10.5.4
    I have a broadband connection - approximately 500 Kbps
    It seems that ever time I have something downloading(e.g. a file from iTunes ) and I try to view pages with Safari I get the "Safari Can't open the page ........ because server not responding" message.
    It's as if Safari isn't able to share the internet connection !@£$£@*!
    If there are no other downloads in progress, then web pages load no problem.
    Anyone got any ideas ?

    Depending on the server software used for the downloads it may be using up all of your bandwidth leaving little for Safari.
    Use the Safari Activity window to see how the page elements load while your download is occurring.
    If you see "timed out" messages then you're going to have troubles.

  • Blank page when pdf files are opened in reader 9

    I have an issue with reader 9 and opening pdf files in internet explorer 7. A large number of computers on my network loose the ability to open pdf files in internet explorer 7.
    When this event happens and after uninstalling Adobe reader 9, and doing a reinstall I am able to view these files normally. However the problems returns within a day.
    I am looking for clues as to what could be breaking the ability to view pdf file in internet explorer 7.

    Hi,
    We can use jQuery plugin to open the PDf file in browser.
    The following link for your reference:
    http://www.jqueryrain.com/2012/09/best-jquery-pdf-viewer-plugin-examples/
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Webpart properties reset to saved when changed

    Hello!
    Is there any way to prevent saving of webparts?
    We have a problem with our custom master-page (JS, CSS, custom webparts included) - when we save changes in any webpart and any field (and not customized too) it resets to a previously saved value. When we set default master - there is no such problem.
    So we are trying to locate any places that could corrupt default saving logic, so if you can point on as many ways to prevent changes saving (using only master & custom webparts, no changes in settings) - it would be really helpful.
    Or maybe someone encountered such problem before?

    Hi,
    Based on your description, my understanding is that when you changed the webpart properties and saved it,  it reset to a previously value.
    As the issue only occurs with the custom master-page, maybe in the custom code the default values were being forcefully placed in the properties. So you need to troubleshot your custom master-page's code. 
    Here are some similar posts you can use as a reference:
    https://social.msdn.microsoft.com/Forums/en-US/6bc6226b-f58a-4ac9-8da6-024c7a88258d/web-part-properties-lost-when-saving-page?forum=sharepointdevelopmentprevious
    https://social.msdn.microsoft.com/Forums/en-US/5777b8fb-7251-4736-a424-220b31e8e7de/web-part-property-not-saving-value?forum=sharepointdevelopmentprevious
    Best Regards,
    Lisa Chen
    Lisa Chen
    TechNet Community Support

  • Adding an item to a List when clicking a WebPart Properties 'OK' button

    Hi all,
    I wonder if someone can help me. Im new to SharePoint Programming but learning slowly. 
    I have a superb Web Part downloaded from Codeplex which essentially is a Countdown Timer in jQuery. (spCountdown) The code itself works perfectly however I want to tweak it, in what I thought would be a relatively easy thing to do.
    In the Web Part properties of the solution, there is a textbox where you enter the Date/Time which you wish to set the countdown timer. When I click 'OK' to submit the WebPart, I would like the date value in the textbox to be added to a List as a new List
    item. I've got the code to add the List item (or what im think is the correct code) but what I cant do is get the function to execute when the WebPart 'OK' button is clicked. 
    Now, I have downloaded the source code which is available but I cant fathom how to hook the 'Update List Item' code onto the onclick event of the button (as I cant find an onclick event!). Any help to advise me what to do would be appreciated.
    My code to add the date to the new List:
    // create item in Deadline Configuration List
    using (SPSite oSiteCollection = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb oWeb = oSiteCollection.OpenWeb())
    SPList oList = oWeb.Lists["DLConfig"];
    SPListItem oListItem = oList.Items.Add();
    oListItem["Title"] = "Deadline Date";
    oListItem["TaskDueDate"] = new DateTime(WebPart.TargetDate.Year, WebPart.TargetDate.Month, WebPart.TargetDate.Day);
    oWeb.AllowUnsafeUpdates = true;
    oListItem.Update();
    Original WebPart Code:
    SPCountdownWebpart.cs
    using System;
    using System.ComponentModel;
    using System.Web.UI.WebControls.WebParts;
    namespace SPCountdown.SPCountdownWebPart
    [ToolboxItemAttribute(false)]
    public class SPCountdownWebPart : WebPart
    // Visual Studio might automatically update this path when you change the Visual Web Part project item.
    private const string _ascxPath = @"~/_CONTROLTEMPLATES/SPCountdown/SPCountdownWebPart/SPCountdownWebPartUserControl.ascx";
    protected override void CreateChildControls()
    var control = Page.LoadControl(_ascxPath);
    if (control != null)
    ((SPCountdownWebPartUserControl)control).WebPart = this;
    Controls.Add(control);
    [Category("Countdown Settings"),
    Personalizable(PersonalizationScope.Shared),
    WebBrowsable(true),
    WebDisplayName("Target Date/Time"),
    WebDescription("Please enter the target date/time for countdown.")]
    public DateTime TargetDate { get; set; }
    SPCountdownWebpartUserControl.cs
    using System;
    using System.Web.UI;
    using Microsoft.SharePoint;
    namespace SPCountdown.SPCountdownWebPart
    public partial class SPCountdownWebPartUserControl : UserControl
    public SPCountdownWebPart WebPart { get; set; }
    public SPCountdownWebPartUserControl()
    PreRender += SPCountdownWebPartUserControl_PreRender;
    void SPCountdownWebPartUserControl_PreRender(object sender, EventArgs e)
    // parse date from properties
    var targetDateString = string.Format("{0},{1},{2},{3},{4},{5}",
    WebPart.TargetDate.Year,
    WebPart.TargetDate.Month - 1, //uses 0-based index
    WebPart.TargetDate.Day,
    WebPart.TargetDate.Hour,
    WebPart.TargetDate.Minute,
    WebPart.TargetDate.Second);
    // js sources
    const string jqueryScript = "<script type='text/javascript' src='/_layouts/SPCountdown/js/jquery-1.10.2.min.js'></script>";
    const string countdownScript = "<script type='text/javascript' src='/_layouts/SPCountdown/js/jquery.countdown.min.js'></script>";
    // create javascript implementing countdown
    const string jsCountdownFormat = "<script type='text/javascript'>$(function () {{var targetDate = new Date({0});$('#defaultCountdown').countdown({{until: targetDate}});}});</script>";
    var jsCountdown = string.Format(jsCountdownFormat, targetDateString);
    // register client scripts
    var cs = Page.ClientScript;
    if (!cs.IsClientScriptBlockRegistered("jQuery"))
    cs.RegisterClientScriptBlock(
    GetType(),
    "jQuery",
    jqueryScript);
    if (!cs.IsClientScriptBlockRegistered("jsCountdownScript"))
    cs.RegisterClientScriptBlock(
    GetType(),
    "jsCountdownScript",
    countdownScript);
    if (!cs.IsClientScriptBlockRegistered("jsCountdown"))
    cs.RegisterClientScriptBlock(
    GetType(),
    "jsCountdown",
    jsCountdown);
    protected void Page_Load(object sender, EventArgs e)
    Can anyone help me with where I need to implement my code to get the List Item to be created when the Web Part properties are set?
    Thanks in advance.
    Rick Lister
    -=Stylus=-

    Hi,
    Please refer below link regarding web part custom properties,
    I think you need to write code under ApplyChanges() Method.I am not sure. Just try it once.
    http://sharepointkitchen.blogspot.in/2014/10/custom-web-part-properties-approach-2.html
    Don't forget to mark it as an Answer if it resolves your problem or Vote Me if it useful.
    Mahesh

  • When I open "Pages" all the forms are in spanish. ( I am english speaking) I travel a lot and wonder if the program picked up on me being in Spain or something similar. How do I change it to english?

    When I open "Pages" all the forms are in spanish. ( I am english speaking) I travel a lot and wonder if the program picked up on me being in Spain or something similar. How do I change it to english?

    See
    http://en.wikipedia.org/wiki/Lorem_ipsum
    If that is what you are seeing, you just select it and type in your own text.

  • In Pages when I go to FIND how can I change the highlight colour of the found word?  At the moment it is a very pale grey and not easily seen.

    In Pages when I go to FIND how can I change the highlight colour of the found word?  At the moment it is a very pale grey and not easily seen.

    Well, it might depend on the nationality of your keyboard, but on my US keyboard, the tilde ("squiggle") is above the TAB key; on a Mac, ⌘-TAB cycles through the active applications and ⌘-tilde cycles through the windows in the front application.
    When you do a Find, Pages selects an instance of your search text (the next one after the current selection, I think, but I didn't check that). It doesn't make the document window the front window, though. If you click in the window to bring it to the front, it moves the selection (or insertion point) to wherever you click unless you click on or above the ruler. Try clicking at the top of the document window after you do a find; say somewhere near the document name. Now you should see the highlighted selection (your search text). If you click back on the Find window, the selection will go grey again, unless you hold ⌘ down while clicking.

  • How do I get Photoshop to stop changing the page when I zoom in or out?

    I was wondering how to stop my screen in photoshop to not change the page when I zoom in or out. When I zoom in the page adjust and make the panel smaller. I would like to leave the screen ful size and just the image zoom in and out

    Argh! Don't you just hate that! I don't know why Adobe set that as default behavior. To stop it go to Photoshop Preferences > General and uncheck "Zoom Resizes Window"
    You can also hit the F key once to enter Full Screen Mode.

  • Track Changes in Pages when using Voiceover

    Has anyone successfully used theTrack Changes feature in Pages when using Voiceover? I can find out how many changes there are and navigate to them, but it's not good at telling me what the change is so I can decide to accept or reject. Has anyone got any tips for using this feature? I'm using Pages 5.2.

    TC,
    You might enjoy reading Chapter 4 of the Pages User Guide PDF. You can download it from the help menu.
    Jerry

  • How can I publish the alterations I have made to my iWeb pages when the ' Publish Site' button and 'Publish Site Changes' on the file dropdown are grey?

    How can I publish the alterations I have made to my iWeb pages when the ' Publish Site' button and 'Publish Site Changes' on the file dropdown are grey?

    this is a perfect question for the users in the iWeb forum.  https://discussions.apple.com/community/ilife/iweb.  Good luck.

  • HT2518 I reach the stage wher my PC is ready to transfer my mac is on the label page when pressing continue nothing appears to happen

    I reach the stage wher my PC is ready to transfer, my mac is on the label page when pressing continue nothing appears to happen

    I'm not sure what you mean by "my mac is on the 'label page'"?  Once your iMac has been fully set up already, then you can use its builtin feature called "Migration Assistant" to transfer files from your PC over to the Mac.  That's the recommended way of doing that.
    Hope this helps

  • The webpage declined to show this webpage when WebPart Page is loaded

    I have a webpart page when I try to open that page I'm getting. The webpage declined to show this webpage.It loaded when the part was added to the page first time.But when I redeployed the WSP I'm getting this error.
    Please help me in this.
    Thanks & Regards,
    Mathi.
    With Regards, Mathi.

    Hi,
    According to your post, my understanding is that the webpage declined to show this webpage when WebPart Page was loaded.
    The problem was within the web part page. A web part was causing the page to 403. Some configuration to the web part had made the web part no longer permissible to show to the user. Instead of just not showing the web part, SharePoint declines to show the
    web part page.
    To resolve the problem, go to the Web Part Page Maintenance page for the page that is giving the 403 error:
    http://ServerName/SiteName/_layouts/spcontnt.aspx?&url=%2fSiteName%2fPages%2fPageName.aspx
    One by one disable the web parts. One of them is the problem. When it is disabled, the page will display properly to the user.
    You’d better to delete the web part and re-add it.
    There is an article for your reference, although it is about the SharePoint 2007, it still works for SharePoint 2010.
    http://dlairman.wordpress.com/2010/10/12/error-the-website-declined-to-show-this-webpage-http-403/
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • How to Refresh The Page When The Value of selectinputData Changes

    Hi;
    I have a select input date component and I want to refresh the page when the value of selectinputdate changes. What is the way to do it?
    Also what is the way to do the same thing with choosedate component?
    Thank you very much...

    Hi Turhan,
    You may want to read about the Partial Page Refresh (PPR) capabilities in ADF Faces. You can make the selectInputDate's partialSubmit property "true" and then cause the specific components you wish refreshed have their partialTriggers property set to the ID of the selectInputDate.
    Hope this helps,
    John

Maybe you are looking for

  • I downloaded an album on itunes that is showing up on my computer but not on my ipod playlist. What should I do?

    I recently had to restore my ipod to a different computer after not using it for a long while.  I downloaded an album and I see it on my computer on my iTunes playlist but it is not on my ipod playlist.  What can I do?  I can see I purchased the albu

  • Name Exported PDFs with a filename generated from text frame on page

    Does anyone have an idea how to do the following? We are on InDesign CS5 on a Mac running OSX 10.6 We are plan on creating a document of say 100 pages. On each page will be a photo of a product and some text frames. In one of the frames will be the p

  • Mac mini hot to the touch. Is that a problem?

    It seems to be running hotter lately. I'm not sure if it has an internal fan. It's about 3 years old. Is this something to be concerned about?

  • OIM 11g LDAP Sync Features

    Folks, I`ve been researching the LDAP sync option in OIM 11g and I have some questions. 1. Is it true that once enabled, the user does not exist in OIM DB but only in LDAP? 2. Can we define rules such that only a certain set of users are in LDAP and

  • Load Images

    Hello Could you please assist me with such issue I am using a Canvas object like a container for images (Image class). My application loads 500-1000 images (tiles) dynamically and then displays them. Everything works fine but the memory grows up to 3