In most WSS pages, the "Site Operations" menu in the upper-right corner has an edit webpage menu item. With this menu item, you can enable the design mode of the current page, modify or add a webpart.
However, it is strange that all form pages (pages used for creating, editing, and viewing list items) do not support page design.
We can see that the "Edit webpage" menu item on the form page does not exist?
Search for SKD and find the following sentence:
Although you can add Web parts to the display, edit, and new forms for list items
(Dispform. aspx, editform. aspx, and newform. aspx), doing so is not recommended or
Supported in Windows SharePoint Services. Adding web parts to list view pages
(Allitems. aspx) is supported.
Not Supported ???
It's just not supported, but not why.
What should we do if our customer needs change and sometimes we need to add something to these pages?
We can use sharepointdesigner. Use SPD to open the page to be modified, including adding a webpart.
However, you must remember that you can do anything, but do not deleteListformwebpart. If you delete it, the page you modified will crash.
Oh, this may be the reason. Therefore, WSS does not allow users to directly edit the webpart of these form pages on the page. If the user accidentally deletes the listformwebpart, it is not impossible to go back to Heaven.
Dangerous, this articleArticleIt seems that I should not continue writing down ~
However, for the purpose of exploring technology, we should continue. After all, normal users on the editing page will not do this.
You can edit it with SPD. What else can you do to make the "Edit webpage" menu appear directly on the page, we don't need to use the SPD guy for every operation. The SPD brother's business model is a bit strange: every time you use it to change a page, it will "leave" the page and leave it in the database to generate the unghost effect. The page running efficiency in the database is a little lower than that of the original page.
Refelector is used to study the base class of form pages: Microsoft. Sharepoint. webpartpages. webpartpage. No value is found.
Continue to study the menu control class: Microsoft. Sharepoint. webcontrols. siteactions. Haha, I found a way: Protected Override Void Createchildcontrols ()
{
Base . Createchildcontrols ();
Base . Menutemplatecontrol. largeiconmode = True ;
Base . Menucontrol. hovercellactivecssclass = " MS-siteactionsmenuhover " ;
Base . Menucontrol. hovercellinactivecssclass = "" ;
Base . Menucontrol. arrowimageurl = " /_ Layouts/images/whitearrow.gif " ;
Menuitemtemplate menuitem= Base. Getmenuitem ("Menuitem_editpage");
If (Menuitem ! = Null )
{
While(!This. Showeditpagemenuitem)
{
Menuitem. Visible= False;
Break;
}
}
Base . Menucontrol. ID = " Siteactionsmenu " ;
Base . Menucontrol. useshortid = True ;
}
When siteactions is loaded Obtain the menu item whose ID is menuitem_editpage and set whether to display it according to the conditions.
Depressing, Showeditpagemenuitem'sCodeThe Decompilation fails. Why do we need to hide it.
But it doesn't matter. We just need to make this code "not found" Click the "Edit webpage" menu item.
To help the SPD brothers, open the dashboard page of the current site and find this Code: < SharePoint: menuitemtemplate Runat = "Server" ID = "Menuitem_editpage"
Text = "<% $ Resources: WSS, siteactions_editpage %>"
Description = "<% $ Resources: WSS, siteactions_editpagedescription %>"
Imageurl = "/_ Layouts/images/actionseditpage.gif"
Menugroupid = "100"
Sequence = "200"
Clientonclicknavigateurl = "Javascript: msolayout_changelayoutmode (false );"
/>
SetID= "Menuitem_editpage" can be changed to another name.
< SharePoint: menuitemtemplate Runat = "Server" ID = "Menuitem_editpage2"
Text = "<% $ Resources: WSS, siteactions_editpage %>"
Description = "<% $ Resources: WSS, siteactions_editpagedescription %>"
Imageurl = "/_ Layouts/images/actionseditpage.gif"
Menugroupid = "100"
Sequence = "200"
Clientonclicknavigateurl = "Javascript: msolayout_changelayoutmode (false );"
/>
OK. Now you can view all the form pages:
In the future, we no longer need to bother the SPD brothers to modify the form page.
Finally, I would like to remind you not to delete listformwebpart (that is, the editing control we see). If you use SPD to modify the page,
You can set the vsibile attribute of the corresponding webpartzone to false. If you design it on the page, you can set the listformwebpartClose".
Check, select "close", do not select "delete", or click the cross!
Postscript:
Later, we found a simpler method. You only need to add a parameter to the URL of the page to enable the editing mode:& Amp; displaymode = Design
For example:
Http: // jyserver: 81/lists/WF2/dispform. aspx? Id = 1 & source = http % 3A % 2f % 2 fjyserver % 3a81% 2 flists % 2fwf2% 2 fallitems % 2 easpx& Amp; displaymode = Design