asp.net ajax 的一个问题,高手请进... 我想实现 像迅雷看看那样,在播放电影的情况下 点击 左侧的“喜剧” 便可以在页面上长生一个层 ,而且这个层肯定接受了一个参数 所以层中才会显示 “喜剧“的内容。我初步设想用 asp.net ajax中的 modalPopup 扩展框,可是发现无法传递参数进去,谢谢大家帮帮我改如何做? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用datalist里嵌套GridView也可以啊,不过要配合脚本,默认隐藏GridView,点击以后触发脚本方法,展开GridView。 不知道迅雷的界面是怎样的。不过,我从来不使用asp.net ajax toolkit,我不太愿意用它(如果真的需要很好的客户端编程我建议你使用asp.net的<asp:Silverlight>控件并且使用silverlight编程)。下面我贴一个以前在csdn上贴过的demo,你可以在你的ajax enabled网站上创建一个aspx,然后把下面的内容覆盖到aspx上,看看结果<%@ Page Language="C#" %><script runat="server"> protected void Button2_Click(object sender, EventArgs e) { this.TextBox1.Text = this.TextBox3.Text + " 被后台处理"; this.TextBox2.Text = DateTime.Now.ToLongTimeString() + " 被后台处理"; this.Label2.Text = this.DropDownList2.SelectedValue; UpdatePanel3.Update(); this.Panel1.Visible = false; } protected void Button1_Click(object sender, EventArgs e) { this.Panel1.Visible = true; this.Label3.Text = TextBox4.Text; } protected void 省修改了(object sender, EventArgs e) { this.DropDownList2.Items.Clear(); switch (this.DropDownList1.SelectedValue) { case "北京": this.DropDownList2.Items.Add("小张"); this.DropDownList2.Items.Add("老王"); this.DropDownList2.Items.Add("狗剩"); this.DropDownList2.Items.Add("浑沌"); this.DropDownList2.Items.Add("甜甜"); break; case "上海": this.DropDownList2.Items.Add("柠檬"); this.DropDownList2.Items.Add("城隍庙"); this.DropDownList2.Items.Add("外滩"); break; } }</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <title>演示半透明遮罩以及UpdatePanel刷新方法</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> 请输入姓名: <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox><br /> <asp:Panel ID="Panel1" runat="server" Visible="false" Style="position: absolute"> <asp:Table ID="Table1" runat="server" BackImageUrl="http://img2.3lian.com/img2007/19/14/004.jpg" Height="531px" Width="850px" Style="filter: Alpha(opacity=75)"> <asp:TableRow> <asp:TableCell VerticalAlign="Middle" HorizontalAlign="Center"> <asp:Label ID="Label3" runat="server" Text="Label" EnableViewState="false" Font-Size="XX-Large" Font-Bold="true"></asp:Label> <br /> <br /> <asp:UpdatePanel ID="UpdatePanel4" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="省修改了"> <asp:ListItem></asp:ListItem> <asp:ListItem>北京</asp:ListItem> <asp:ListItem>上海</asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="DropDownList2" runat="server"> </asp:DropDownList> </ContentTemplate> </asp:UpdatePanel> <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> <asp:Button ID="Button2" runat="server" Text="测试2" OnClick="Button2_Click" /> </asp:TableCell></asp:TableRow> </asp:Table> <asp:Label ID="Label1" runat="server" Text="Labeladfasdfa"></asp:Label> </asp:Panel> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /> </Triggers> </asp:UpdatePanel> </td> </tr> <tr> <td> <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"> <ContentTemplate> 这里显示返回的结果:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br /> 这里显示返回的结果:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" /> </Triggers> </asp:UpdatePanel> <br /> <br /> <br /> <br /> <br /> <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="Label2" runat="server" Font-Size="XX-Large" ForeColor="Red"></asp:Label> </ContentTemplate> </asp:UpdatePanel> <br /> <asp:Image ID="Image1" runat="server" ImageUrl="http://pic.hjsm.tom.com/post02/9.jpg" /> <br /> <br /> <br /> <br /> <br /> <br /> <asp:Button ID="Button1" runat="server" Text="测试1" OnClick="Button1_Click" /> </td> </tr> </table> </form></body></html>看看如何编程处理事件,相信你会在第一时间写出实用的程序,以后再慢慢改进。 什么叫发现"无法传递参数进去"?页面加一个ModalPopupExtender加一个Panel,Panel中放GridView或DataList,GridView或DataList的数据来自" 点击 左侧的“喜剧”的id,这路子很正宗呵,哪来什么"无法传递参数进去"!!! xmlReader.NodeType case语句后面的属性值 有中文的解释吗? 页面传递参数加密的问题? asp.net开发网站与二级域名的问题 discuz问题 关于FreeTextBox3.0中imagegallery控件不能创件的问题!!! 那个第三方控件最好用? 关于Global.asax的奇怪的问题 一个这样的问题 多表更新用什么对象啊?急用!!! 如何在asp.net中实现与word2000的交互使用。 抽取试题显示试题加载进度 aspx中如何访问剪切板
protected void Button2_Click(object sender, EventArgs e)
{
this.TextBox1.Text = this.TextBox3.Text + " 被后台处理";
this.TextBox2.Text = DateTime.Now.ToLongTimeString() + " 被后台处理";
this.Label2.Text = this.DropDownList2.SelectedValue;
UpdatePanel3.Update();
this.Panel1.Visible = false;
} protected void Button1_Click(object sender, EventArgs e)
{
this.Panel1.Visible = true;
this.Label3.Text = TextBox4.Text;
} protected void 省修改了(object sender, EventArgs e)
{
this.DropDownList2.Items.Clear();
switch (this.DropDownList1.SelectedValue)
{
case "北京":
this.DropDownList2.Items.Add("小张");
this.DropDownList2.Items.Add("老王");
this.DropDownList2.Items.Add("狗剩");
this.DropDownList2.Items.Add("浑沌");
this.DropDownList2.Items.Add("甜甜");
break;
case "上海":
this.DropDownList2.Items.Add("柠檬");
this.DropDownList2.Items.Add("城隍庙");
this.DropDownList2.Items.Add("外滩");
break;
}
}</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>演示半透明遮罩以及UpdatePanel刷新方法</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
请输入姓名:
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox><br />
<asp:Panel ID="Panel1" runat="server" Visible="false" Style="position: absolute">
<asp:Table ID="Table1" runat="server" BackImageUrl="http://img2.3lian.com/img2007/19/14/004.jpg"
Height="531px" Width="850px" Style="filter: Alpha(opacity=75)">
<asp:TableRow>
<asp:TableCell VerticalAlign="Middle" HorizontalAlign="Center">
<asp:Label ID="Label3" runat="server" Text="Label" EnableViewState="false" Font-Size="XX-Large"
Font-Bold="true"></asp:Label>
<br />
<br />
<asp:UpdatePanel ID="UpdatePanel4" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="省修改了">
<asp:ListItem></asp:ListItem>
<asp:ListItem>北京</asp:ListItem>
<asp:ListItem>上海</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="DropDownList2" runat="server">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:Button ID="Button2" runat="server" Text="测试2" OnClick="Button2_Click" />
</asp:TableCell></asp:TableRow>
</asp:Table>
<asp:Label ID="Label1" runat="server" Text="Labeladfasdfa"></asp:Label>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
这里显示返回的结果:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
这里显示返回的结果:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<br />
<br />
<br />
<br />
<br />
<asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label2" runat="server" Font-Size="XX-Large" ForeColor="Red"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<asp:Image ID="Image1" runat="server" ImageUrl="http://pic.hjsm.tom.com/post02/9.jpg" />
<br />
<br />
<br />
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="测试1" OnClick="Button1_Click" />
</td>
</tr>
</table>
</form>
</body>
</html>
看看如何编程处理事件,相信你会在第一时间写出实用的程序,以后再慢慢改进。
页面加一个ModalPopupExtender
加一个Panel,Panel中放GridView或DataList,
GridView或DataList的数据来自" 点击 左侧的“喜剧”的id,
这路子很正宗呵,哪来什么"无法传递参数进去"!!!