Dylan Ryan

Hello, I am currently trying to set a webpart's "title" based on an event that happens in the editor part. I only want the title set if this event is called.

I tried to access the webpart's title value directly, but when you click "Ok" or "Apply" the value that the editor part contains gets synced up. I was wondering if I can get access to the editor parts value that gets synced up when the "OK" or "Apply" button is hit.

Just to clarify, i do not want to set the webparts title at runtime, I only want to set it programatically from the editor part based on a condition.

Thank you,

Dylan



Re: SharePoint - Development and Programming How do I programatically set the "Title" value of a webpart from inside an editor part.

DanielMc

Dylan,

I dont know if I am following the question, but I'll answer what I think you are asking.

You want the Title of the webpart to be set/changed, based on something that occured while "in" the editor part. And, you want this change to happen AFTER you click OK or Cancel.

One way to do this is to put a public property (doesnt need to be visibily exposed to the editor part) on the web part, and then programatically set it in the Accept/Cancel logic of the editor part as needed.

Then, in the CreateChildControl of the webpart, use that property value to set the Title.

I think this will work for you - if I am understanding the question.

- Daniel





Re: SharePoint - Development and Programming How do I programatically set the "Title" value of a webpart from inside an editor part.

Dylan Ryan

Thanks for taking a stab at it, but what I am really looking for is how I might access the internal value the editor part has for setting the title(Appearance->Title[Textbox]).

I want to be able to set the editor parts textbox "Title"(under Appearance) to a specific value but then if the user wants to, they could change it.

Example:

1.User is editing webpart using editor part pane:

2.A drop down for a specific list the webpart points to is changed to "NewList"

3.The Textbox in the editor part "Title" under the apperance section is set to "NewList"

4.The user can then opt to change the "Title" textbox to thier own value "A User's Title" and save, or they could leave the value that was set in step 3.

Thank you,

Dylan





Re: SharePoint - Development and Programming How do I programatically set the "Title" value of a webpart from inside an editor part.

DanielMc

Ahhh. It sounds like you are looking for a Client-Side solution. Off the top of my head, I would say you need to inject a piece of clientside javascript (maybe during SyncChanges in the editor part) that will use the DOM to locate both the drop-down and the title textbox and fire a js event when the drop down changes that will also change the textbox. If this is on track, I will try to put something together later on that might help.

- Daniel





Re: SharePoint - Development and Programming How do I programatically set the "Title" value of a webpart from inside an editor part.

Dylan Ryan

I'm really hoping to figure out which server side variable I could access. when the user selects a specific list, i do a postback to get a bunch of dynamic data. During this time, it would be great if i could set or change this variable.

-Dylan





Re: SharePoint - Development and Programming How do I programatically set the "Title" value of a webpart from inside an editor part.

DanielMc

If you are posting back when the list is selected, you should be able to change the webpart's title then (on the webpart itself) and the Title box in the editor part should refresh to be that. Then, if the user changes it, it will update on the Apply.

I get the feeling you may have already tried something like this. If so, where (which event / method) did you put the "this.Title = " logic in

Daniel





Re: SharePoint - Development and Programming How do I programatically set the "Title" value of a webpart from inside an editor part.

Dylan Ryan

I tried this from within the editor part:

this.WebPartToEdit.Title = "the new title"

into my dropdown_OnSelectedIndexChanged() function

This will then correctly show up on the webpart as the title but after the "ok" or "apply" button is pressed, which syncs the editor part with the webpart, the old editor parts title will be written to the webpart.

What im guessing is the internal function along the lines of syncchanges(which is for setting the nonbrowsable values) is setting this value.

-Dylan