|
Home > Archive > Microsoft Content Management Server > September 2004 > save new page [2]
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| bill tie 2004-09-24, 2:48 am |
|
As suggested we downloaded Stefan's "Save new Page without Name prompt".
OK, that effectively knocked the pop-up window out of commission and provided
data necessary to "complete" the save.
Now. We'd like to up the ante and be friendly to authors, as well as,
readers by creating a sensible name and display name of the page.
In contrast to "CmsPosting_Creating", "CmsPosting_Created" implies the
creation process is completed. We tortured "CmsPosting_Created" to no avail.
It didn't do a thing for us.
Well, next we tried "CmsPosting_Changed". Again, "changed" implies the
changing is over, so we should be able to make our modifications. We got
something out of it but not much.
Our template has three custom HTML placeholders on it.
1. The following piece of code met with no complaints:
public void CmsPosting_Changed( Object sender, ChangedEventArgs e )
{
Posting newPage = e.Target as Posting;
}
2. This piece threw the method into recursion:
public void CmsPosting_Changed( Object sender, ChangedEventArgs e )
{
Posting newPage = e.Target as Posting;
newPage.DisplayName = "foo";
}
3. The next variation elicited an error saying the last placeholder in the
template could not be saved.
public void CmsPosting_Changed( Object sender, ChangedEventArgs e )
{
Posting newPage = e.Target as Posting;
Response.Write(newPage.DisplayName.ToString());
}
The objective is to read the contents of one of the placeholders and use it
for the name and display name of the posting.
We'll be immensely grateful if somebody helps us out of the predicament.
| |
| Stefan [MSFT] 2004-09-24, 2:48 am |
| Hi Bill,
to break the recursion just check if the DisplayName is already set to the
value you like it to be.
If not set it. Otherwise skip the change:
> public void CmsPosting_Changed( Object sender, ChangedEventArgs e )
> {
> Posting newPage = e.Target as Posting;
> if (newPage.DisplayName != "foo")
> newPage.DisplayName = "foo";
> }
>
But I would suggest not to use a placeholder object but to implement this
method for what you are doing:
http://blogs.msdn.com/stefan_gossne.../25/119613.aspx
Cheers,
Stefan.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver
MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------
"bill tie" <billtie@discussions.microsoft.com> wrote in message
news:DEB363BD-D861-46B5-92D9-4B8DEC22B676@microsoft.com...
>
> As suggested we downloaded Stefan's "Save new Page without Name prompt".
> OK, that effectively knocked the pop-up window out of commission and
provided
> data necessary to "complete" the save.
>
> Now. We'd like to up the ante and be friendly to authors, as well as,
> readers by creating a sensible name and display name of the page.
>
> In contrast to "CmsPosting_Creating", "CmsPosting_Created" implies the
> creation process is completed. We tortured "CmsPosting_Created" to no
avail.
> It didn't do a thing for us.
>
> Well, next we tried "CmsPosting_Changed". Again, "changed" implies the
> changing is over, so we should be able to make our modifications. We got
> something out of it but not much.
>
> Our template has three custom HTML placeholders on it.
>
> 1. The following piece of code met with no complaints:
>
> public void CmsPosting_Changed( Object sender, ChangedEventArgs e )
> {
> Posting newPage = e.Target as Posting;
> }
>
>
> 2. This piece threw the method into recursion:
>
> public void CmsPosting_Changed( Object sender, ChangedEventArgs e )
> {
> Posting newPage = e.Target as Posting;
> newPage.DisplayName = "foo";
> }
>
>
> 3. The next variation elicited an error saying the last placeholder in the
> template could not be saved.
>
> public void CmsPosting_Changed( Object sender, ChangedEventArgs e )
> {
> Posting newPage = e.Target as Posting;
> Response.Write(newPage.DisplayName.ToString());
> }
>
>
> The objective is to read the contents of one of the placeholders and use
it
> for the name and display name of the posting.
>
> We'll be immensely grateful if somebody helps us out of the predicament.
>
| |
| bill tie 2004-09-24, 8:48 pm |
|
Stefan,
Thank you for a useful tip in your blog.
|
|
|
|
|