_cuclife.com
当前位置:cuclife.com > IT > ASP.NET >

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;
}

}

文章来源:网络整理  本站编辑:兰特
上一篇:Server Application Unavailable的解决办法
下一篇:脏字典过滤:用正则表达式来过滤脏数据
评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)