高分求助 ModalPopupExtender 的问题

ziyouren521125 2009-01-08 02:22:23
我想做一个留言回复的功能。
本来想做成QQ空间那种留言回复的来,但是自己技术有限。不知道怎么做成那样的。
有会的也可以说下。

下面说现在的问题。
现在功能是这样的。就是用ModalPopupExtender这个控件做了个回复的功能。
是点回复弹出一个层。背景变成灰色不可用状态。
但是我我把ModalPopupExtender放在datalist里面了。
代码如下:

<asp:DataList id="DataList1" runat="server" Width="760px" DataSourceID="SqlDataSource1" DataKeyField="id" OnItemCommand="DataList1_ItemCommand"><ItemTemplate>
<DIV class="line_5"> </DIV><asp:Button id="aaa" runat="server" Text="回 复" ></asp:Button> <cc1:PopupControlExtender id="PopupControlExtender1" runat="server" TargetControlID="aaa" PopupControlID="Layer2" BehaviorID="Button5" ></cc1:PopupControlExtender>
</ItemTemplate>
</asp:DataList>

<div id="ly" style="position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777;
z-index: 2; left: 0px; display: none;">
</div>
<!-- 浮层框架开始 -->
<div id="Layer2" align="center" style="position: absolute; z-index: 3; left: 50%; top: 50%;
background-color: #fff; display: none; left: 50%; top: 50%;" >
<table width="540" border="0" cellpadding="0" cellspacing="0" style="border: 0 solid #e7e3e7;
border-collapse: collapse; left: 50%; top: 50%;">
<tr>
<td style="background-color: #73A2d6; color: #fff; padding-left: 4px; padding-top: 2px;
font-weight: bold; font-size: 14px;" height="27" valign="middle">
[ 回 复 留 言 ]
</td>
</tr>
<tr>
<td height="130" align="center">
<asp:TextBox ID="TextBox1" runat="server" Rows="8" TextMode="MultiLine" Width="631px"></asp:TextBox> </td>
</tr>
</table><asp:Button ID="Button5" runat="server" Text="关 闭" />
                       
                      
 <input type="button" value=" 确定 " onclick="Lock_CheckForm(this);" id="Button1" runat="server" style="width: 59px" onserverclick="Button1_ServerClick"></div>



代码是上面的。
绑定后。点一个回复可以弹出层。但是点第二个就不能出来了。

麻烦看看,先谢了

分不够俺可以加
...全文
168 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
ziyouren521125 2009-01-09
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 yangshenghong 的回复:]
层里面还放服务器控件?
[/Quote]
为什么不能放?
yangshenghong 2009-01-09
  • 打赏
  • 举报
回复
层里面还放服务器控件?
ziyouren521125 2009-01-08
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 maple2008 的回复:]

4、贴的代码还是不完整,运行不起来,母版页,控件PopupControlExtender的代码没有。
[/Quote]
晕~~
不是把模板页也给你吧。
过河石头 2009-01-08
  • 打赏
  • 举报
回复

1、JS最好不要用这种方式取对象: document.all.ly , document.all.Layer2,
采用:document.getElementById("ly") 、document.getElementById("Layer2")

2、查查看前台的html源码,看是否有重复的 id

3、暂时把UpdatePanel去掉,把这个问题解决之后再加上,避免产生Js冲突。

4、贴的代码还是不完整,运行不起来,母版页,控件PopupControlExtender的代码没有。
ziyouren521125 2009-01-08
  • 打赏
  • 举报
回复
datalist里面的代码不知道怎么回事。不自动换行
ziyouren521125 2009-01-08
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 maple2008 的回复:]
贴全页面代码和控件代码,这样不好分析.
[/Quote]

全贴出来啊。代码理由点乱。其实上面的就是全副核心代码了。
贴出来看看吧

<%@ Page Language="C#" MasterPageFile="~/Master/DefaultNotRight.master" AutoEventWireup="true" CodeFile="TeacherLWList.aspx.cs" Inherits="Member_teacher_TeacherLWList" Title="Untitled Page" %>

<%@ Register Assembly="YYControls" Namespace="YYControls" TagPrefix="yyc" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<asp:UpdatePanel id="UpdatePanel1" runat="server">
<contenttemplate>
<asp:DataList id="DataList1" runat="server" Width="760px" DataSourceID="SqlDataSource1" DataKeyField="id" OnItemCommand="DataList1_ItemCommand"><ItemTemplate>
<DIV class="line_5"><TABLE style="WIDTH: 100%"><TBODY><TR><TD style="WIDTH: 410px; HEIGHT: 20px"><asp:Label id="Label1" runat="server" Text='<%# Bind("SName") %>'></asp:Label>
<asp:Label id="Label2" runat="server" Text='<%# Bind("LWContent","问: {0}") %>'></asp:Label></TD>
<TD style="WIDTH: 152px; HEIGHT: 20px"><asp:Label id="Label3" runat="server" Text='<%# Bind("LWTime","[ {0} ]") %>'></asp:Label></TD></TR>
<TR><TD style="WIDTH: 410px; COLOR: #999999; HEIGHT: 21px"><asp:Label id="Label4" runat="server" Text='<%# Bind("RevertContent","答: {0}") %>'>
</asp:Label></TD><TD style="WIDTH: 152px; COLOR: #999999; HEIGHT: 21px">
<asp:Label id="Label5" runat="server" Text='<%# Bind("RevertTime","[ {0} ]") %>' ForeColor="#999999"></asp:Label> </TD></TR>
<TR><TD style="DISPLAY: none; WIDTH: 410px; HEIGHT: 26px"><asp:TextBox id="TextBox2" runat="server" Text='<%# Bind("Id") %>'></asp:TextBox></TD>
<TD style="HEIGHT: 26px"><asp:TextBox id="TextBox3" runat="server" Text='<%# Bind("Id") %>'></asp:TextBox></TD>
<TD style="HEIGHT: 26px"><asp:Button id="Button2" onclick="Button2_Click" runat="server" Text="回 复" OnClientClick="locking()" ValidationGroup="delete" CommandArgument="aaa" OnCommand="Button2_Command"></asp:Button>
<asp:LinkButton id="LinkButton1" runat="server" OnClientClick="locking()" CommandArgument='<%# Bind("Id") %>' OnCommand="LinkButton1_Command">回复</asp:LinkButton>
<INPUT id="Button3" onclick="return locking()" type=button value="button" /><A onclick="locking()" href="#">aaaaaa</A></TD></TR></TBODY></TABLE></DIV>
<asp:Button id="aaa" runat="server" Text="Button" __designer:wfdid="w95"></asp:Button>
<cc1:ModalPopupExtender id="ModalPopupExtender1" runat="server" TargetControlID="aaa" BackgroundCssClass="bg" PopupControlID="Layer2" Enabled="True" BehaviorID="Button5" CancelControlID="Button5" DropShadow="true">
</cc1:ModalPopupExtender> <cc1:PopupControlExtender id="PopupControlExtender1" runat="server"></cc1:PopupControlExtender>
</ItemTemplate>
</asp:DataList>    
</contenttemplate>

</asp:UpdatePanel>
<div id="ly" style="position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777;
z-index: 2; left: 0px; display: none;">
</div>
<!-- 浮层框架开始 -->
<div id="Layer2" align="center" style="position: absolute; z-index: 3; left: 50%; top: 50%;
background-color: #fff; display: none; left: 50%; top: 50%;" >
<table width="540" border="0" cellpadding="0" cellspacing="0" style="border: 0 solid #e7e3e7;
border-collapse: collapse; left: 50%; top: 50%;">
<tr>
<td style="background-color: #73A2d6; color: #fff; padding-left: 4px; padding-top: 2px;
font-weight: bold; font-size: 14px;" height="27" valign="middle">
[ 回 复 留 言 ]
</td>
</tr>
<tr>
<td height="130" align="center">
<asp:TextBox ID="TextBox1" runat="server" Rows="8" TextMode="MultiLine" Width="631px"></asp:TextBox> </td>
</tr>
</table><asp:Button ID="Button5" runat="server" Text="关 闭" />
                       
                      
 <input type="button" value=" 确定 " onclick="Lock_CheckForm(this);" id="Button1" runat="server" style="width: 59px" onserverclick="Button1_ServerClick"></div>
<!-- 浮层框架结束 -->
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:LoreMart %>"
SelectCommand="SELECT [Id], [TNname],[SName], [LWContent], [LWTime], [LWState], [RevertContent], [RevertTime], [StudentId], [TeacherId] FROM [TeacherLWInfo] WHERE ([TeacherId] = @TeacherId)">
<SelectParameters>
<asp:SessionParameter Name="TeacherId" SessionField="TeacherId" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
 
<script>
function locking(){
document.all.ly.style.display="block";
document.all.ly.style.width=document.body.clientWidth;
document.all.ly.style.height=document.body.clientHeight;
document.all.Layer2.style.display='block';
}
function Lock_CheckForm(theForm){
document.all.ly.style.display='none';document.all.Layer2.style.display='none';
return false;
}

</script>


</asp:Content>



glt3260053 2009-01-08
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 maple2008 的回复:]
贴全页面代码和控件代码,这样不好分析.
[/Quote]
呵呵!同意!顺带相互学习
过河石头 2009-01-08
  • 打赏
  • 举报
回复
贴全页面代码和控件代码,这样不好分析.

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧