问题:我有一个主页,用于指示css,html,head,body内容,因此我不能使用浮动div技术,需要通过ajax / asp only路径。我能够在网上找到关于这个主题的所有内容都是人们在实现这个问题时遇到了问题但没有实际的工作示例代码。
我尝试使用jQuery based floating div menu关闭jtricks.com但是说明是针对html文件而不是asp.net文件,并导致页面加载错误。
<script type="text/javascript" src="specify script file URL here">
</script>
<div id="floatdiv" style="
position:absolute;
width:200px;height:50px;top:10px;right:10px;
padding:16px;background:#FFFFFF;
border:2px solid #2266AA;
z-index:100">
This is a floating javascript menu.
</div>
<script type="text/javascript">
floatingMenu.add('floatdiv',
{
// Represents distance from left or right browser window
// border depending upon property used. Only one should be
// specified.
// targetLeft: 0,
targetRight: 10,
// Represents distance from top or bottom browser window
// border depending upon property used. Only one should be
// specified.
targetTop: 10,
// targetBottom: 0,
// Uncomment one of those if you need centering on
// X- or Y- axis.
// centerX: true,
// centerY: true,
// Remove this one if you don't want snap effect
snap: true
});
</script>
请提供一些关于在TabContainer或DragPanel中通过Ajax使用浮动div的示例代码。
谢谢! :)
答案 0 :(得分:0)
为了使基于jquery的浮动div菜单工作,我在DynamicDataManager控件之后和ASP UpdatePanel中将div的代码放在ASP Content Main Section中:
<asp:Content ID="main" ContentPlaceHolderID="main" Runat="Server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<EditItemTemplate>
<div id="floatdiv" style="position:absolute; width:200px; height:50px; top:10px; right:10px; padding:16px;background:#FFFFFF; border:2px solid #080808; z-index:100">
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Update" Text="Update" style="right:25px; padding:25px" updateDisabled = "updateDisabled +1; if (updateDisabled == 1) {return true;} else {this.disabled=true;return false;};" />
<asp:LinkButton ID="LinkButton2" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
</div>
我还添加了一个禁用更新按钮,以防止人们在数据库中创建2个重复记录:
<asp:DynamicEntity runat="server" Mode="Edit" OnInit="DynamicEntity_Init"/>
<script language="javascript" type="text/javascript"> var updateDisabled = 0; </script>
<asp:LinkButton runat="server" CommandName="Update" Text="Update" OnClientClick="updateDisabled = updateDisabled +1; if (updateDisabled == 1) {return true;} else {this.disabled=true;return false;};" />
<asp:LinkButton runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
我将实际脚本放在ASP Content Main标签中但在更新面板之后:
<script type="text/javascript">
floatingMenu.add('floatdiv',
{
// Represents distance from left or right browser window
targetRight: 10,
// Represents distance from top or bottom browser window
targetTop: 10,
snap: true
});
</script>