易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET程序中常用的三十三种代码

1. 打开新的窗口并传送参数:
  传送参数:
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>")
  接收参数:
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
  2.为按钮添加对话框
Button1.Attributes.Add("onclick","return confirm(’确认?’)");
button.attributes.add("onclick","if(confirm(’are you sure...?’)){return true;}else{return false;}")
  3.删除表格选定记录
int intEmpID = (int)MyDataGrid.DataKeys[e.Item.ItemIndex];
string deleteCmd = "DELETE from Employee where emp_id = " + intEmpID.ToString()
  4.删除表格记录警告
private void DataGrid_ItemCreated(Object sender,DataGridItemEventArgs e)
{
 switch(e.Item.ItemType)
 {
  case ListItemType.Item :
  case ListItemType.AlternatingItem :
  case ListItemType.EditItem:
   TableCell myTableCell;
   myTableCell = e.Item.Cells[14];
   LinkButton myDeleteButton ;
   myDeleteButton = (LinkButton)myTableCell.Controls[0];
   myDeleteButton.Attributes.Add("onclick","return confirm(’您是否确定要删除这条信息’);");
   break;
  default:
   break;
 }
}
  5.点击表格行链接另一页
private void grdCustomer_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
 //点击表格打开
 if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
  e.Item.Attributes.Add("onclick","window.open(’Default.aspx?id=" + e.Item.Cells[0].Text + "’);");
}
  双击表格连接到另一页
  在itemDataBind事件中
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
 string OrderItemID =e.item.cells[1].Text;
 ...
 e.item.Attributes.Add("ondblclick", "location.href=’../ShippedGrid.aspx?id=" + OrderItemID + "’");
}
  双击表格打开新一页
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingI


相关文档:

ASP.NET中前台javascript与后台代码调用

C#代码与javaScript函数的相互调用
问:
1.如何在JavaScript访问C#函数?
2.如何在JavaScript访问C#变量?
3.如何在C#中访问JavaScript的已有变量?
4.如何在C#中访问JavaScript函数?
问题1答案如下:
javaScript函数中执行C#代码中的函数:
方法一:1、首先建立一个按钮,在后台将调用或处理的内容写入button_click中 ......

ASP.NET中的图片上传

protected void Button3_Click(object sender, EventArgs e)
    {
        //定义变量,判断是否有图片上传
        bool fileIsValid = false;
        //如果有图片上传,判断其格式
&nbs ......

Asp.net页面中引用js文件无效的问题的解决方法

在BS项目中,某个aspx页面需要引用外部脚本文件,通过在页面head节<script language="" src="">方式引用指定的js之后,仍然无效。通过alert方式调试,发现是由于js文件编码与js文件内容不符。由于js文件中包含中文注释,所以需要设置js文件为可识别中文的gb2312编码。其方法在网上也讲述,以下为网摘内容:
 &n ......

Asp.net页面乱码五种解决办法

Asp.net页面乱码第一种解决方案:
在web.config中:
<globalization requestEncoding="gb2312" responseEncoding="gb2312" />
Asp.net页面乱码第二种解决方案:
<META http-equiv="content-type" content="text/html; charset=gb2312">
Asp.net页面乱码第三种解决方案:
下载文件时指定文件名,中文的文 ......

Apache run asp.net==>2.0以上的版本


以下内容,丛网上COPY过来的...
Apache是目前广泛使用的一种网络服务器程序,不仅在UNIX/LINUX平台上被大量使用,而且在Windows平台上也有许多站点放弃了IIS而转向Apache。.NET是微软推出的功能强大的开发技术,其目标就是与Java抗衡。ASP.NET非常适合于中小企业的Web应用,其性能较ASP3.0有了极大的提高。下面就介绍让Ap ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号