1. 打开新的窗口并传送参数:
JgKhrDx
/Lm~GmPt
传送参数: c VO-iPK
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>") [cznhIvyO
K{@xZ)
接收参数: 0_+
& [g}
string a = Request.QueryString("id"); 83'+q((<
string b = Request.QueryString("id1"); E?KPez
B|$o.$5
2.为按钮添加对话框 L{)t(H>O
Button1.Attributes.Add("onclick","return confirm(’确认?’)"); o.Y6(o
button.attributes.add("onclick","if(confirm(’are you sure...?’)){return true;}else{return false;}") NW3qs`$-(
)flm3G2u
3.删除表格选定记录 \awkt!Wa
int intEmpID = (int)MyDataGrid.DataKeys[e.Item.ItemIndex]; -Q?c'e
string deleteCmd = "DELETE from Employee where emp_id = " + intEmpID.ToString() \QF0(*!!
D Y4!RjJ47
4.删除表格记录警告 Gx}`_[-
private void DataGrid_ItemCreated(Object sender,DataGridItemEventArgs e) zOFHdd ,"g
{ n|DMj[uT
switch(e.Item.ItemType) T9]0/>
{ A8ef=ljM?
case ListItemType.Item : k4u/vn`&r
case ListItemType.AlternatingItem : qP##C&+#q
case ListItemType.EditItem: J65:MaS
TableCell myTableCell; Yl"CIgt
myTableCell = e.Item.Cells[14]; (aSuxl.Dq
LinkButton myDeleteButton ; c$BH`" <*
myDeleteButton = (LinkButton)myTableCell.Controls[0]; HJym|G>%?
myDeleteButton.Attributes.Add("onclick","return confirm(’您是否确定要删除这条信息’);"); BtKor6ba
break; Hy,""Py
default: 6Uq;]@k%
break; Zz/p'3?#
} 4(oU88z
;~d$OM
} :&:P4Y1
E
-%%Xx5D
5.点击表格行链接另一页 Sj|tR[SAoD
private void grdCustomer_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) EEK!'[<,sE
{ pYr+n9)^
//点击表格打开 .oTS7rYw
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) t)?K@{ 9
e.Item.Attributes.Add("onclick","window.open(’Default.aspx?id=" + e.Item.Cells[0].Text + "’);"); Y`4 LMK[]
} J=: \b
&y