1. 打开新的窗口并传送参数:
传送参数:
response.write("<script>window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')</script>")

2.跳转到新页面

Response.Write("<script>window.location='http://www.51aspx.com/bizpulic/upmeb.aspx'</script>");

3.为按钮添加对话框

在aspx前台页面:

<asp:Button ID="btn1" runat="server" Text="按钮1" onclick="btn1_Click"  OnClientClick="return confirm('确认删除活动吗?')" />

在cs后台文件:

Button1.Attributes.Add("onclick","return confirm('确认?')");

button.attributes.add("onclick","if(confirm('are you sure...?')){return true;}else{return false;}")

4.删除文件

string filename ="20059595157517.jpg";
pub.util.DeleteFile(HttpContext.Current.Server.MapPath("../file/")+filename);

ASP.NET常用代码汇总的更多相关文章

  1. Asp.Net 常用代码-备用

    1.DropDownList 复制 //DropDownList DropDownList2.Items.Clear(); foreach (ListItem li in DropDownList1. ...

  2. asp.net 常用代码

    asp.net 下拉菜单选中 ddlCity.SelectedIndex = ddlCity.Items.IndexOf(ddlCity.Items.FindByValue(")); 关于. ...

  3. JQuery常用代码汇总

    获取<input />的value $("#id").val( ); 标签间的html $("#id").html('<tr><t ...

  4. PHP常用代码汇总

    Get与Post //POST if(isset( $_POST['add_gift'] )) { $game=trim( $_POST['game'] ); } //GET if(isset( $_ ...

  5. 原生JS常用代码汇总

    数组相关 var codes = new Array( ); //创建数组codes.length //数组长度 动态插入数组 codes.push(value);

  6. ASP.NET常用技巧方法代码断

    1. 打开新的窗口并传送参数:传送参数:response.write("<script>window.open('*.aspx?id="+this.DropDownLi ...

  7. Asp.net常用的三十多个代码(非常实用)

    1.//弹出对话框.点击转向指定页面 Response.Write("<script>window.alert('该会员没有提交申请,请重新提交!')</script> ...

  8. Asp.net常用的51个代码(非常实用)

    1.//弹出对话框.点击转向指定页面 Response.Write("<script>window.alert('该会员没有提交申请,请重新提交!')</script> ...

  9. (摘录)26个ASP.NET常用性能优化方法

    数据库访问性能优化 数据库的连接和关闭 访问数据库资源需要创建连接.打开连接和关闭连接几个操作.这些过程需要多次与数据库交换信息以通过身份验证,比较耗费服务器资源. ASP.NET中提供了连接池(Co ...

随机推荐

  1. ddl语句

  2. by which, in which, from which 语法区别

    (1)Here is Beijing,where I grow up.where其实也是指代北京,不过where是在北京的意思,也就是 in Beijing (2)Here is Beijing,in ...

  3. Eclipse 中使用 ctrl 无法追踪函数的问题

    Eclipse 中使用 ctrl 无法追踪函数的问题 Eclipse 项目中应该有 .buildpath , .project 两个文件,如果 Eclipse 中使用 ctrl 无法追踪函数, 第一步 ...

  4. iframe 跨域自适应 纯css解决方法

    <style type="text/css">body{background:#f00;}body, html,#ifm1{width:100%;height:100% ...

  5. 2015 ACM/ICPC Asia Regional Beijing Online

    时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 You must have seen the very famous movie series,"Mission ...

  6. DNS加速

    http://elingwange.iteye.com/blog/1563497 http://blog.csdn.net/lize1988/article/details/10404645 java ...

  7. (转)C#精确时间计时器

    原文地址:http://blog.sina.com.cn/s/blog_699d3f1b01012vgb.html 1 调用WIN API中的GetTickCount [DllImport(" ...

  8. List集合分组

    var ArticleList = new Services.Data.SearchService().GetArticleBaseList(ref param); IEnumerable<IG ...

  9. 简洁之美 -约瑟夫环的python 解法

    问题描述: 约瑟夫环问题:已知n个人(以编号1,2,3...n分别表示)围坐在一张圆桌周围.从编号为k的人开始报数,数到k的那个人出列:他的下一个人又从1开始报数,数到k的那个人又出列:依此规律重复下 ...

  10. 使用postman玩转接口测试

    (一)前言: 之前搞自动化接口测试,由于接口的特性,要验证接口返回xml中的数据,所以没找到合适的轮子,就自己用requests造了个轮子,用着也还行,不过就是case管理有些麻烦,近几天又回头看了看 ...