我爱Aspx >> Asp.Net >> 初学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 + "');");
Ҷƪл˵?
从COM组件调用.NET组件编程实战[04-21]
缓存 ASP.NET 页的某些部分[04-21]
c#教程第一讲 开始.net探索之旅[04-21]
.net课件之多线程[04-21]
五子棋.NET源码下载[04-21]
跟我一起学.net资料(二)[04-21]
跟我一起学习.net资料(一)[04-21]
我的学习作品之酒店 管理系统 (V..[04-21]
Visual C#.NET编程精粹150例[03-18]
最优化ASP.NET ——面向对象开发..[03-18]
从前之前,后来以后[04-21]
世界上最遥远的距离[04-21]
在来三张[04-21]
从COM组件调用.NET组件编程实战[04-21]
乱画的一大堆哈哈[04-21]
我住的那栋楼下[04-21]
雨中漫步—瞬间的浪漫[04-21]
一辈子的幸福[04-21]
感悟[04-21]
鱼和水,我和你……[04-21]