易截截图软件、单文件、免安装、纯绿色、仅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.AlternatingItem)
{
 string orderItemID =e.item.cells[1].Text;
 ...
 e.item.Attributes.Add("ondblclick", "open('..


相关文档:

ASP.NET的ACCESS数据库操作类

//private string datapatch = ConfigurationSettings.AppSettings["acessconn"];//数据库地址 
private string datapatch = "db/global.asa";//数据库地址 
/// 
/// 取得dataset 
// 
/// 查询语句 
/// 
public DataSet GetDataSet(string Commandtext) 
{&nbs ......

ASP.NET服务器控件使用之GridView

1         ASP.NET 服务器控件GridView使用
本教程不介绍服务器端控件的呈现,事件处理,状态等理论知识,只介绍服务器端控件的使用操作,如果您对服务器控件的知识感兴趣,请参阅《ASP.NET服务器控件高级编程》
阅读本文时最好和 文档 《ASP.NET服务器控件使用之Grid ......

asp.net中substring用法


substring
public String substring(int beginIndex)返回一个新的字符串,它是此字符串的一个子字符串。该子字符串始于指定索引处的字符,一直到此字符串末尾。
例如:
"unhappy".substring(2) returns "happy"
"Harbison".substring(3) returns "bison"
"emptiness".substring(9) returns "" (an empty string)
� ......

ASP.NET的母版知识摘要


母版页面
-- 新建一母版页面
-- 在适当位置加入代码:
<asp:ContentPlaceHolder ID="ContentPlaceHolder3" runat="server">
...这之间的内容如果没有Content内容,将会得到显示;
...如果有Content内容,将会被Content内容替换掉
</asp:ContentPlaceHolder>
Content页面
-- 新建一WEB窗体
-- 在适当 ......

ASP.NET MVC介绍

The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications. The ASP.NET MVC framework is ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号