SharePoint 2007 设计技巧之避免编辑控制台脱离你的控制
当你正在处理母页并试图放弃使用默认母页所使用的复杂表格结构时,编辑控制台(比如WSSDesignConsole and PublishingConsole)可能会给你造成麻烦。
问题出现了,当你使用WSSDesignConsole and PublishingConsole的时候,由于WSSDesignConsole and PublishingConsole是用户控件,这意味着他们的接口是在母页之外的并做好了封装。实际上,WSSDesignConsole and PublishingConsole的接口内容是用<tr>标签进行嵌入的而不是我们想象中的<table>标签,结果这就导致了我们在母页上使用的时候,表格的元素被过早的结束了,我们的母页render出来后的实际效果可能跟我们当初设计的效果不吻合。
怎么解决这个问题呢?其实明白这个道理以后,解决起来也是很简单的。只要在控制台前后手动帮他嵌入需要的<table>标签,就可以很方便的解决这个问题,显示出我们所需要的效果了。下面就是一种解决办法的实例代码:
<!--- --- --- Edit Consoles --- --- --->
<!-- Edit console that appears in page Edit mode -->
<asp:ContentPlaceHolder ID="WSSDesignConsole" runat="server">
<table><wssuc:DesignModeConsole id="IdDesignModeConsole" runat="server"/></table>
</asp:ContentPlaceHolder>
<!-- Publishing console control -->
<asp:ContentPlaceHolder ID="SPNavigation" runat="server">
<table><SharePoint:DelegateControl runat="server" ControlId="PublishingConsole"
PrefixHtml="<tr><td colspan="4" id="mpdmconsole" class="ms-consolemptablerow">"
SuffixHtml="</td></tr>">
</SharePoint:DelegateControl></table>
</asp:ContentPlaceHolder>
<!--- --- --- End of Edit Consoles --- --- --->


浙公网安备 33010602011771号