一.Response对象的Write方法与JavaScript脚本语言的结合使用.(page_51)
弹出提示对话框.
Response.Write("<script>alert('你好!');</script>");
2.关闭窗口
Response.Write("<script>window.opener=null;window.close();script>");
二.获取客户端IP地址.(page_54)
1. 通过Request的userHosaddress属性.
texBox1.Text=Request.userHosaddress;
2.通过Request的ServerVariabes属性
TexBox1.Text=Request.ServerVariabes["REMOTE_ADDR"];
三.获取当前页面的路径
Response.Redirect(Request.CurrentExecutionFilePath);
四.如何解决Response.Redirect方法传递汉字丢失或乱码问题?(page_66)
传值之前.
String 如何解决Response.Redirect方法传递汉字丢失或乱码问题?");
Response.Redirect("a.aspx?name"+name);
接收时
String name"]);
五.打开新窗口并关闭父窗口.(page_81)
Response.Write("<script language='javascript'>window.open('NewPage.aspx','','width=335,height=219');window.opener=null;window.close();</script>");
六.打开Outlook.
把Hyperlink控件的NavigateUrl属性值设置为:mailto:htx206@163.com
七.设为首页.
把Linkbutton按扭的OnClientClick属性设为:this.style.behavior='url(#default#homepage)';this.sethomepage('http://www.baidu.com')
八.添加到收藏夹.
把Button控件的OnClientClick属性值为:window.external.addFavorite('http://www.baidu.com','百度')
九.DropDownList的方法(page_95).
1.获取DropDownList控件的索引号和标题.
int Index=DropDownList.SelectedIndex;
string text=DropDownList.SelectedItem;
2.向DropDownList控件的下拉列表框中添加列表项.
DropDownList.Items.Add(new LIstItem("asp.net","0"));
DropDownList.Items.Add(string);
3.删除选择的DropDownList控件的列表项.
ListItem ltem=DropDownList1.Selectedlitem;
DripDownlist1.ltems.Remove(ltem);
4.清除所有DripDownlist控件的列表项.
DripDownlist1.Items.Clear();
5.获取DripDownlist控件包含的列表项数.
int count=DripDownlist.Items.count;