<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事件等都会有这样的问题,应该怎么解决这个问题?
<asp:ListItem>你好!</asp:ListItem>
<asp:ListItem>是的!</asp:ListItem>
</asp:DropDownList>当DropDownList1发生SelectedIndexChanged事件时,把它的值放到TEXTBOX中,
可是这个事件每次都会要刷一下页面,这个问题应该怎么解决!包括TEXTBOX的TextChanged事件等都会有这样的问题,应该怎么解决这个问题?
想要不刷新就使用ajax或JS
你可以用asp.net Ajax来解决不刷新的问题 http://ajax.asp.net/
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" />