日期:2014-05-19  浏览次数:20562 次

讨教刷新问题!
<asp:DropDownList   ID= "DropDownList1 "   runat= "server "   Width= "337px "   AutoPostBack= "True ">
              <asp:ListItem> 你好! </asp:ListItem>
              <asp:ListItem> 是的! </asp:ListItem>
</asp:DropDownList>

当DropDownList1发生SelectedIndexChanged事件时,把它的值放到TEXTBOX中,
可是这个事件每次都会要刷一下页面,这个问题应该怎么解决!

包括TEXTBOX的TextChanged事件等都会有这样的问题,应该怎么解决这个问题?

------解决方案--------------------
是每次都会刷新,postback的
你可以用asp.net Ajax来解决不刷新的问题 http://ajax.asp.net/
------解决方案--------------------
<script language=javascript>
function dd()
{

var d=document.getElementById( "d ");
var t=document.getElementById( "t ");
t.value=d.value;
}


</script>
<title> 无标题页 </title>
</head>
<body>
<form id= "form1 " runat= "server ">
<div>

</div>
<asp:Button ID= "Button1 " runat= "server " Text= "Button " OnClick= "Button1_Click " />
<asp:Button ID= "Button2 " runat= "server " OnClick= "Button2_Click " Text= "Button " />


<select id= "d " style= "width: 73px " language= "javascript " onclick= "dd() ">
<option selected= "selected " value= "43 "> 43 </option>
<option value= "3 "> 53 </option>
<option value= "345 "> 534 </option>
<option value= "534 "> 53 </option>
</select>
<input id= "t " type= "text " />