UpdatePanel不能更新
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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 runat="server">
<title></title>
<link href="/CSS/Verson2.0/Common.css" rel="stylesheet" type="text/css" />
<link href="/CSS/Verson2.0/css.css" rel="stylesheet" type="text/css" />
<script src="/JavaScript/jquery-1.5.js" type="text/javascript"></script>
<style type="text/css">
.style1
{
width: 300px;
}
.style2
{
width: 138px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"
ChildrenAsTriggers="False">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
</Triggers>
<ContentTemplate>
<div id="i1" runat="server">
<table class="style1">
<tr>
<td>
<asp:TextBox ID="TextBox1" runat="server" Width="145px" AutoPostBack="True"></asp:TextBox>
</td>
<td class="style2">
<asp:DropDownList ID="DropDownList1" runat="server" Height="16px" Width="238px"
AutoPostBack="True" >
<asp:ListItem Text="没法定假期" Value="0"></asp:ListItem>
<asp:ListItem Text="有法定假期" Value="1"></asp:ListItem>
<asp:ListItem Text="没法定假期周末周日休息" Value="2"></asp:ListItem>
<asp:ListItem Text="有法定假期也周末周日休息" Value="3"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" Text="刷新2" Width="107px"
onclick="Button2_Click" />
</td>
<td class="style2">
<asp:DropDownList ID="DropDownList3" runat="server" Height="16px" Width="238px" AutoPostBack="True" >
<asp:ListItem Text="没法定假期" Value="0"></asp:ListItem>
<asp:ListItem Text="有法定假期" Value="1"></asp:ListItem>
<asp:ListItem Text="没法定假期周末周日休息" Value="2"></asp:ListItem>
<asp:ListItem Text="有法定假期也周末周日休息" Value="3"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<p> </p>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"
ChildrenAsTriggers="False">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
<ContentTemplate>
<div id="i2" runat="server">
<table class="style1">
<tr>
<td>
<asp:TextBox ID="TextBox2" runat="server" Width="147px" AutoPostBack="True"></asp:TextBox>
</td>
<td>
<asp:DropDownList Width="238px" ID="cdlGeneral" runat="server"
AutoPostBack="True" >
<asp:ListItem Text="没法定假期" Value="0"></asp:ListItem>
<asp:ListItem Text="有法定假期" Value="1"></asp:ListItem>
<asp:ListItem Text="没法定假期周末周日休息" Value="2"></asp:ListItem>
<asp:ListItem Text="有法定假期也周末周日休息" Value="3"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="刷新1"
Width="111px" />
</td>
<td>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
后台:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.Items[1].Selected = true;
DropDownList3.Items[1].Selected = true;
cdlGeneral.Items[1].Selected = true;
}
protected void Button1_Click(object sender, EventArgs e)
{
TextBox2.Text = DropDownList1.SelectedItem.Text;
UpdatePanel2.Update();
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = cdlGeneral.SelectedItem.Text;
UpdatePanel1.Update();
}
}
相关推荐
asp.net updatepanel 导致JS不能加载,而无法使用的解决方法
代码如下:[removed] var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_endRequest(function () { // re-bind your jquery events here $(document).ready(function () { //begin var span = $(“input[id*=’txtSpa
updatepanel中不能使用fileupload的弥补方法[IFrame方式]
直接使用FileUpload,服务端是无法找到上传文件的。updatepanel中不能使用fileupload的弥补方法[IFrame方式]
如何在UpdatePanel中调用JS客户端脚本
本文将介绍如何在UpdatePanel中调用JS客户端脚本,需要了解的朋友可以参考下
Asp.Net服务器发送HTTP标头后无法设置内容类型的问题解决
主要给大家介绍了Asp.Net服务器发送HTTP标头后无法设置内容类型问题的解决方法,文中介绍的非常详细,对大家具有一定的参考学习价值,需要的朋友们下面来一起看看吧。
UpdatePaneld的用法
下面介绍下updatePanel的触发器Trigger 了解数据库的人应该对触发器这个概念比较清楚,Trigger对于UpdatePanel来说也是很关键的 开始简单介绍了UpdatePanel的俩中触发器asyncPostBackTrigger和PostBackTrigger的作用 这里用例子大概在稍微深入地介绍下: ...........


