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. quartz定时任务时间设置描述

    这些星号由左到右按顺序代表 : * * * * * * * 格式: [秒] [分] [小时] [日] [月] [周] [年] 序号 说明 是否必填 允许填写的值 允许的通配符 1 秒 是 0-59 , ...

  2. Redis使用详细教程(转)

    一.Redis基础部分: 1.redis介绍与安装比mysql快10倍以上 *****************redis适用场合**************** 1.取最新N个数据的操作 2.排行榜应 ...

  3. [Flex] Accordion系列-动态添加或删除Accordion容器中项目

    <?xml version="1.0" encoding="utf-8"?> <!--Flex中如何使用addChild()和removeCh ...

  4. js替换字符串中全部“-”

    alert("2014-03-22".replace('-','')); alert("2014-03-22".replace(/-/g,'')); 第一个运行 ...

  5. 解决WinForm(C#)中MDI子窗体最大化的问题

    “用MDI方式打开一个子窗口体后,总是不能最大化显示,明明子窗口体的WindowState设置为Maximized?”,相信有很多人会遇到这的样问题,请按下面的方法设置即可使MDI子窗体最大化: 1. ...

  6. Codeforces 519E A and B and Lecture Rooms [倍增法LCA]

    题意: 给你一棵有n个节点的树,给你m次询问,查询给两个点,问树上有多少个点到这两个点的距离是相等的.树上所有边的边权是1. 思路: 很容易想到通过记录dep和找到lca来找到两个点之间的距离,然后分 ...

  7. (medium)LeetCode 222.Count Complete Tree Nodes

    Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from W ...

  8. (转)C# Color类图示

    本文来源  http://www.cnblogs.com/lv8218218/archive/2010/12/20/1911746.html

  9. Rolling Cursor Invalidations with DBMS_STATS.AUTO_INVALIDATE (文档 ID 557661.1)

      Rolling Cursor Invalidations with DBMS_STATS.AUTO_INVALIDATE (文档 ID 557661.1) 转到底部 In this Documen ...

  10. CString.Format的详细用法(转)

    CString.Format的详细用法(转) 在MFC程序中,使用CString来处理字符串是一个很不错的选择.CString既可以处理Unicode标准的字符串,也可以处理ANSI标准的字符串.CS ...