1. 打开新的窗口并传送参数: (" LQll9
(py]LBZ
传送参数: w0w G-R ?
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>") G'3qzBJ#
G9g1hie@%
接收参数: O"Ku1t!
string a = Request.QueryString("id"); il|1a8M2~
string b = Request.QueryString("id1"); *
#jsgj[
|
N0Z-|
2.为按钮添加对话框 0/S_e)U
Button1.Attributes.Add("onclick","return confirm(’确认?’)"); L}@c6fHG
button.attributes.add("onclick","if(confirm(’are you sure...?’)){return true;}else{return false;}") 3 "o"fl
s!n<}C
3.删除表格选定记录 (WJ${OW
int intEmpID = (int)MyDataGrid.DataKeys[e.Item.ItemIndex]; ?A(QyaKz
string deleteCmd = "DELETE from Employee where emp_id = " + intEmpID.ToString() nKW*Y}VO
x77l~=P+!
4.删除表格记录警告 fP.F`V_Y
private void DataGrid_ItemCreated(Object sender,DataGridItemEventArgs e) PV|uPuz
{ ^Ge+~o?x
switch(e.Item.ItemType) T] 2q?;N
{ :'#TCDlOb
case ListItemType.Item : ]-ZEWt6lsc
case ListItemType.AlternatingItem : UnI48Y
case ListItemType.EditItem: 7AYd!n&S
TableCell myTableCell; $O9^SB
myTableCell = e.Item.Cells[14]; Fx-8M!
LinkButton myDeleteButton ; !9Aaj<yxm
myDeleteButton = (LinkButton)myTableCell.Controls[0]; T&Lb<'f
myDeleteButton.Attributes.Add("onclick","return confirm(’您是否确定要删除这条信息’);"); ^i:`ZfA#
break; 8_T6_jL<
default: !\&