asp net中的服务器按钮方式提交数据
2011-06-18 17:35
239 查看
在aspx页面中:
<div>
关键字:
<asp:TextBox ID="txtsearchKey" runat="server"></asp:TextBox>
<asp:ImageButton ImageUrl="~/manage/images/btn_search.gif" ID="btnSearch" runat="server" OnClick="btnSearch_Click" />
</div>
点击ImageButton按钮就会触发服务器事件,在aspx.cs中代码如下:
protected void btnSearch_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("ProductManage.aspx?searchkey=" + Server.UrlEncode(txtsearchKey.Text));
}
就是执行btnSearch_Click里面的方法,Response.Redirect形式跳转,Server.UrlEncode是对用户输入的监控,这样就会更加安全。
让我们一起说:
It is so easy!
<div>
关键字:
<asp:TextBox ID="txtsearchKey" runat="server"></asp:TextBox>
<asp:ImageButton ImageUrl="~/manage/images/btn_search.gif" ID="btnSearch" runat="server" OnClick="btnSearch_Click" />
</div>
点击ImageButton按钮就会触发服务器事件,在aspx.cs中代码如下:
protected void btnSearch_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("ProductManage.aspx?searchkey=" + Server.UrlEncode(txtsearchKey.Text));
}
就是执行btnSearch_Click里面的方法,Response.Redirect形式跳转,Server.UrlEncode是对用户输入的监控,这样就会更加安全。
让我们一起说:
It is so easy!
相关文章推荐
- Android提交数据到服务器的两种方式四种方法
- Android应用开发中,会经常要提交数据到服务器和从服务器得到数据,本文主要是给出了利用http协议采用HttpClient方式向服务器提交数据的方法。
- 表单向服务器提交数据有几种方式?这些方式有什么区别?
- android 以httpclient方式把数据提交到服务器
- post方式模拟表单向服务器提交数据
- 表单中多个请求参数名字相同,服务器到底获取的是哪个请求参数的值,表单的action和get和post提交方式的关系以及提交数据的不同点
- HttpClient使用post方式模拟表单提交数据到服务器并下载服务器文件
- HttpURLconnection使用POST方式提交JSON数据给服务器
- Android提交数据到服务器的两种方式四种方法
- 采用post的方式提交数据(无服务器) →采用get方式提交数据到服务器
- android-----提交数据到服务器的4中方式
- Android之使用HTTP协议的Get/Post方式向服务器提交数据
- Android提交数据到服务器的两种方式四种方法
- Android提交数据到服务器的两种方式四种方法
- Android之使用HTTP协议的Get/Post方式向服务器提交数据
- Android提交数据到服务器的两种方式四种方法
- [android] 采用GET方式提交数据到服务器
- Android笔记 get方式提交数据到服务器 避免乱码 demo
- (3)自定义服务器,用户提交数据两种方式get,post区别
- Android提交数据到服务器的两种方式四种方法