Asp.Net碎知识

在aspx页面 获取值:
UserModel user=new UserModel();实例化
user.Address=context["txtAddress"];
如果前台不需要的字段,但是数据库中有:user.Money=0;
------------------加密加密加密加密加密加密加密加密加密加密加密加密加密加密加密加密加密加密加密加密------------------------------

MD5加密 放在一个Tool公共类库(别的项目也可以用)里就ok了
public string GetMd5Code(string str)
{
//MD5是抽象类 ,System.Security.Cryptograph.MD5 MD5:HashAlgo MD5继承哈希
MD5 md5=MD5.Create();
////////////////////.制定编码格式--Default
byte[] oldStr=system.Text.Encoding.Default.getBytes(str);//将传过来的str进行编码
byte[] md5str=md5.ComputerHash(oldStr);
StringBuilder sb=new StringBuilder();
for(int i=0;i<md5str.Lenght;i++)
{
sb.Append(md5str[i].ToString("x2"));//转换成16(x)进制,2保证加密后的密文长度一样
}
return sb.Tostring();
}

-----------------------------------------加密Ending----------------------------------------
绑定数据++++修改删除++++提示
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="list_table">
<tr>
<th width="100">序号</th>
<th width="100">标题</th>
<th width="100">内容</th>
<th>关键字</th>
<th>描述</th>
<th>添加时间</th>
<th>操作</th>
</tr>
<asp:Repeater ID="Repeater12" runat="server" OnItemCommand="Repeater12_ItemCommand">
<ItemTemplate>
<tr>
<td><%#Eval("ID") %></td>
<td><%#Eval("Title") %></td>
<td><%#Eval("Cont") %></td>
<td><%#Eval("Keys") %></td>
<td><%#Eval("Des") %></td>
<td><%#Eval("AddTime") %></td>
<td>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Del" CommandArgument='<%#Eval("ID") %>'>删除</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CommandName="Update" CommandArgument='<%#Eval("ID") %>'>修改</asp:LinkButton>

<asp:Label ID="Label1" runat="server" Text='<%#Eval("NewID") %>' Visible="false"></asp:Label>
<asp:LinkButton ID="LinkButton1" runat="server" CssClass="btn btn82 btn_del" CommandName="del" OnClientClick="return confirm('要删除吗?')">删除</asp:LinkButton>
&nbsp; &nbsp; &nbsp; &nbsp;
<asp:Label ID="Label2" runat="server" Text='<%#Eval("NewID") %>' Visible="false"></asp:Label>
<asp:LinkButton ID="LinkButton2" runat="server" CommandName="Update" CommandArgument='<%#Eval("NewID")%>'>修改</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>

if (e.CommandName == "Del")
{
//string strid = ((Label)e.Item.FindControl("Label1")).Text;
// int Id = Convert.ToInt32(strid);
int id = Convert.ToInt32(e.CommandArgument.ToString());
int result = BLL.UserBLL.DelUser(id);
if (result > 0)
{
// Response.Write("你已经删除了该用户");
Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script language=javascript>alert('你已经删除了该用户')</script>");
bindUserList();
}

}

--------------------------------------------------------------------------------------------------------------------------------------------

private int _age;
piblic int Age;
{
get {return _age;}
set {
if(value<0||value>100)
{
_age=18;
}
else
{
_age=value;
}
}
}


-------------------------------------------------------------------------------------------------------------------------------------------
隐藏传递修改的ID
<asp:HiddenField ID="hide" runat="server" />
int id = Convert.ToInt32(hide.Value);

修改::::::::::::
if (!IsPostBack)
{
if (Request.QueryString["NewsID"] != null)
{
hd_id.Value = Request.QueryString["NewsID"].ToString();
int id = Convert.ToInt32(Request.QueryString["NewsID"]);
NewsType();//将下拉列表中的值娶过来
GetSingNews(id);
}
}
---------------------------------------------------------------------------------------------------------------
弹出框Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script language=javascript>alert('请选择图片')</script>");
--------------------------------------------------------------------------------------------------------------------------------------------
配置数据库文件:
<connectionStrings>
<add name="str" connectionString="server=.;database=JinKeLi;Integrated Security=True "/>
</connectionStrings>
<appSettings>
<add key="sqlcon" value="server=.;database=JinKeLi;Integrated Security=True"/>
</appSettings>

public static string constr = System.Configuration.ConfigurationSettings.AppSettings["sqlcon"];
---------------------------------------------------------------------------------------------------------------------------
验证码知识:
<script>
function getVCode() {
var vcode = document.getElementById("vcode");
vcode.src = "ValidateCode.ashx?i="+Math.random();
}
</script>


<p>
验证码:<input type="text" name="txtvcode" class="txt" />
<img src="ValidateCode.ashx" id="vcode" align="middle" alt="看不清,换一张" onclick="getVCode()" /><%--后台生成的图片--%>
<a href="javascript:getVCode()" class="hyz">换一张</a>
</p>
----------------------------------------------------------------------------------------------------------------------------------------
百度编辑器知识
<!-- 引用文件 顺序不能出错-->
<script type="text/javascript" src="../../ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="../../ueditor/ueditor.all.js"></script>
<link rel="stylesheet" href="../../ueditor/themes/default/dialogbase.css" />
<!-- 引用文件结束-->~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<tr style="500px; height:230px;">
<td class="td_right">内容页:</td>
<td class="" style="150px;height:80px;">
<textarea name="MyEditor" style=" 500px; height:200px;" id="MyEditor" runat="server" onblur="setUeditor()" cols="30" rows="10">
</textarea>
<script type="text/javascript">
<!-- new一个实体-->
var editor = new baidu.editor.ui.Editor();
editor.render("MyEditor");
function setUeditor() {
var myEditor = document.getElementById("MyEditor")
myEditor.value = editor.getContent();
}
</script>
<asp:Button ID="Btn_submit" runat="server" Text="输出editor的值" OnClick="Btn_submit_Click" />
<!-- Lable是显示文字-->
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</td>
</tr>
----------------------------------------------------------------------------------------------------------------------------------------------------------------
关于新闻类别的传递和修改,接受的方法
接受用: DropDownList1.SelectedValue = dt.Rows[0]["NewsType"].ToString();但是先绑定类型源
DropDownList1.SelectedItem.Text = dt.Rows[0]["ProName"].ToString();
获取值: DropDownList1.Text = DropDownList1.SelectedValue;

DropDownList1.Text = DropDownList1.SelectedValue;添加的时候用
-------------------------------------------------------------------------------------------------------------------------
从客户端(MyEditor="<p><img src="/uedito...")中检测到有潜在危险的 Request.Form 值。 ValidateRequest="false"
------------------------------------------------------------------------------------------------------------------------------------
public string GetImgType(string typeid)//将类型装换成文字
{
DataTable dt = database.GetDt("select * from tb_ImgageType where id="+typeid);
if (dt != null && dt.Rows.Count > 0)
{
return dt.Rows[0]["TypeName"].ToString();
}
else
{
return "";
}
}
------------------------------------------------------------------------------------------------------------------------------
将路径转换成图片
<td class="text-l"><img src='<%#Eval("ConfigLogo") %>' /></td>
---------------------------------------------------------------------------------------------------------------------------------
获取要修改的值:
public void GetUser(int id)
{
DataTable dt= BLL.UserBLL.GetUser(id);
if (dt != null && dt.Rows.Count > 0)
{
username.Text = dt.Rows[0]["UserName"].ToString();
pwd.Text = dt.Rows[0]["UserPwd"].ToString();
repwd.Text = dt.Rows[0]["UserPwd"].ToString();
}
}
----------------------------------------------------------------------------------
sqlparmeter 防止参数注入的另一种写法:
StringBuilder strSql = new StringBuilder();
strSql.Append("select Id,LoginId,LoginPwd,Name,Address,Phone,Mail,UserRoleId,UserStateId,Money from Users ");
strSql.Append(" where LoginId=@LoginId");
SqlParameter[] parameters = {
new SqlParameter("@LoginId", SqlDbType.NVarChar,50)
};
parameters[0].Value = loginid;
-----------------------------------------------------------------------------------------------------
转换:
model.Money=decimal.Parse(row["Money"].ToString());
-----------------------------------------------------------------------------------------------------
<span style="color:Red"><%=LoginIdMsg %></span>前台
public string LoginIdMsg { get; set; } 后台
LoginIdMsg = loginidmsg;
这样把后台要返回的数据,就可以在前台展示出来
--------------------------------------------------------------------------------------------------------
记住我:
<asp:CheckBox ID="cbAutoLogin" runat="server" />使我保持登录状态

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.Cookies["username"] != null && Request.Cookies["pwd"] != null)
{
this.username.Text = Request.Cookies["username"].Value;
this.pwd.Text = Request.Cookies["pwd"].Value;
}
}
}

protected void Button2_Click(object sender, EventArgs e)
{
Response.Cookies["username"].Expires = DateTime.Now.AddDays(-1);
Response.Cookies["pwd"].Expires=DateTime.Now.AddDays(-1);
if (cbAutoLogin.Checked)
{
Response.Cookies["username"].Expires=DateTime.Now.AddDays(7);
Response.Cookies["pwd"].Expires = DateTime.Now.AddDays(7);
}
Response.Cookies["username"].Value=this.username.Text.Trim();
Response.Cookies["pwd"].Value = this.pwd.Text.Trim();
}
--------------------------------------------------------------------------------------------------------
前台绑定后台的方法1:
前台:
<ul id="marquee1_1" class="pro-list">
<%foreach(Model.LinkModel linkmodel in linklist) { %>
<li><span"><a href="#"><img src=" <%=linkmodel.LinkPicture %>" width="178" height="146" /></a></span><span><a href="#">包膜控释肥试验田</a></span></li>
<% } %>
</ul>
后台:
public List<LinkModel> linklist { set; get; }
linklist = LinkBLL.GetLinkList();

前台绑定后台的方法2:
前台:
<li><a href="<%=linkUrlS0 %>"><img alt="中国农业信息网" src="<%=LinkPicture0 %>"width="141" height="40" /></a></li>
<li><a href="<%=LinkURLS1 %>"><img alt="中国农业信息网" src="<%=LinkPicture1 %>" width="141" height="40" /></a></li>
后台:
List<LinkModel> list = LinkBLL.GetLinkList();
LinkPicture0 = list[0].LinkPicture;
LinkPicture1 = list[1].LinkPicture;
linkUrlS0 = list[0].LinkURL;
LinkURLS1 = list[1].LinkURL;
public string LinkPicture0 { get; set; }
public string LinkPicture1 { get; set; }
前台绑定后台的方法3:
<td class="td-status" title="<%#Eval("ConfigAddress") %>"><%#Eval("ConfigAddress") %></td>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Session赋值,取值
登录的时候用--Session记录住用户名 Session["username"] = name; 赋值
<li>欢迎<%=Session["username"] %></li>

if(Session["name"]==null||Session["name"].Tostring()=="")
{
reposnse.Redicrt("Login");
}

关于Session记录登录用户的情况:
在其他页面程序进行 操作时,要判断是否在登录状态,只要在同一个作用域内,就可以引用Session了
-----------------------------------------------------------------------------------------------------------------------------------------------------------
更多,绑定到new列表中
------------------------------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------------------------------
格式化:
<%#Convert.ToDateTime(Eval("ID")).toString("YY-MMmm-dd")%>
<%# Eval("NewsTitle")%> 截取字符串的方法
---------------------------------------------------------------------------

<td class="td-status" title="<%#Eval("ConfigAddress") %>"><%#Eval("ConfigAddress") %></td>
<td title="<%#Eval("Desc") %>"> <%#SubStr(Eval("Desc").ToString(),1)%> </td> 在前台显示截取多长...... 要ToString() 因为传过来的都是object类型
public string SubStr(string str,int intlen)截取方法
{
if (str.Length > intlen)
{
string str1 = str.Substring(0, intlen) + "....";
return str1;
}
else
{
return str;
}
}
-------------------------------------------------------------------------------------------------------------------------------------
<p>
下一篇:
<asp:Repeater ID="rp_next" runat="server">
<ItemTemplate>
<a href="Product-detail.aspx?id=<%#Eval("ProID") %>"><%#Eval("Title") %></a>
</ItemTemplate>
</asp:Repeater>
</p>
<p>
上一篇:
<asp:Repeater ID="rp_pre" runat="server">
<ItemTemplate>
<a href="Product-detail.aspx?id=<%#Eval("ProID") %>"><%#Eval("Title") %></a>
</ItemTemplate>
</asp:Repeater>
</p>
if (!IsPostBack)
{
string s=Request.QueryString["id"].ToString();
DataTable dt_pre = ChiocePro(Convert.ToInt32(s), "pre");
DataTable dt_next = ChiocePro(Convert.ToInt32(s), "next");

rp_pre.DataSource = dt_pre;
rp_pre.DataBind();

rp_next.DataSource = dt_next;
rp_next.DataBind();
}
public static DataTable GetProductInfo(int pid,string str)
{
string strsql = "";

if (str=="pre")
{
strsql = " select top 1 ProID,title from Tb_Product where ProID<" + pid + " order by ProID DESC";
}
else if(str=="next")
{
strsql = " select top 1 ProID,title from Tb_Product where ProID>" + pid + " order by ProID Asc";
}
SqlConnection conn = new SqlConnection("server=.;database=JinKeLi;Integrated Security=True ");
conn.Open();
SqlDataAdapter sda = new SqlDataAdapter(strsql, conn);
DataSet ds = new DataSet();
sda.Fill(ds);
DataTable dt = new DataTable();
dt = ds.Tables[0];
return dt;
}
------------------------------------------------------------------------------------------------------
绑定+传值1:
<%=Convert.ToDateTime(MN.AddTime)%>
public NewsModel MN = new NewsModel();
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
string s=Request.QueryString["id"].ToString();
if (s != null)
{
int id = Convert.ToInt32(s);
DataTable dt= GetOneNew(id);
MN.AddTime =Convert.ToDateTime( dt.Rows[0]["AddTime"]);
}

}
}
绑定+传值2:
<%=ProductList[0].Content %>
public List<ProductModel> ProductList { set; get; }
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

if (s != null)
{
int id = Convert.ToInt32(s);
ProductList = ListNews(id);
}
}
}
---------------------------------------------------------------------------------------------------------------
性别:
<asp:RadioButton ID="RadioButton1" runat="server" GroupName="sex" Text="男" />
<asp:RadioButton ID="RadioButton2" runat="server" GroupName="sex" Text="女" />
<asp:Button ID="Button4" runat="server" onclick="Button4_Click" Text="性别" />
protected void Button4_Click(object sender, EventArgs e)
{
string s="";
if (RadioButton1.Checked)
{
s = RadioButton1.Text;
}
if (RadioButton2.Checked)
{
s = RadioButton2.Text;
}
Response.Write("<script>alert('你的性别是:" + s + "')</script>");
}
------------------------------------------------------------------------------------------------------------------
sqlparmeter的另外一种写法:

StringBuilder strSql=new StringBuilder();
strSql.Append("delete from Books ");
strSql.Append(" where ISBN=@ISBN and Id=@Id ");
SqlParameter[] parameters = {
new SqlParameter("@ISBN", SqlDbType.NVarChar,50),
new SqlParameter("@Id", SqlDbType.Int,4) };
parameters[0].Value = ISBN;
parameters[1].Value = Id;

int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
----------------------------------------------------------------------------------------------------------------------

获取用户输入的值
string name=context.request["txtName"];
string pwd=context.request["txtPwd"];
创建模板

string path=context.request["Login.html"];
string html=system.IO.File.MapPath(path);

string sql="select * from users where name=@name and pwd=@pwd";

SqlParsms[] sps={
new Sqlparams("@name",name),
new Sqlparams("@pwd",pwd)
}
int result=Convert.Into32( sqlhelper.ExectuScalar(sql,sps));

if(result>0)
{
context.request.write("<script>alert('登陆成功')</script>");
context.requset.Redict.....
}
else
{
context.request.write("<script>alert('登录失败')</script>");
html=html.replace("@txtname",name).replace("$txtpwd","");
}
-------------------------------------------------------------------------------------------------------------------------
if (UserBLL.CheckUsers(mm) <= 0)
{
MessageBox.Show("用户不存在");
DialogResult qq = MessageBox.Show("确定注册吗", "不", MessageBoxButtons.YesNoCancel);
if (qq == DialogResult.Yes)
{
AddAdmin AAA = new AddAdmin();
AAA.Show();
this.Hide();
}
else
{
txtBoxUser.Text = "";
pwd = txtBoxPwd.Text = "";
}
return;
}
---------------------------------------------------------------------
ViewState用法:
<form action="Login.ashx" method="post">
<table style=" margin:150px auto">
<input type="hidden" name="ViewState" value="123" />
<tr><td colspan="2" style=" text-align:center"> 登录系统</td></tr>
<tr><td><label for="username">用户名:</label></td><td><input type="text" name="username" id="username" value="$name"/></td></tr>
<tr><td><label for="pwd">密码:</label></td><td><input type="text" name="pwd" id="pwd" value="$pwd" /></td></tr>
<tr><td colspan="2" style=" text-align:center"><input type="submit" value="登陆" id="btn1" /></td></tr>
</table>
</form>


string viewstate = context.Request["ViewState"];
bool IsPostBack = !string.IsNullOrEmpty(viewstate);
if (!IsPostBack)
{}
else
{
if()
{}
else
{
context.Response.Write("<script>alert('登陆失败!');</script>");
loginhtml = loginhtml.Replace("$name", name).Replace("$pwd","");
context.Response.Write(loginhtml);
}
}
-------------------------------------------------------------------
AccesssKey:
<!DOCTYPE html>
<html>
<body>

<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML 教程</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS 教程</a>

<p><b>注释:</b>请使用Alt + <i>accessKey</i> (或者 Shift + Alt + <i>accessKey</i>) 来访问带有指定快捷键的元素。</p>

</body>
</html>
-------------------------------------------------------------------------------------
性别知识点:
protected void Button3_Click(object sender, EventArgs e)
{
string s = "";
if (RadioButton1.Checked)
{
s = RadioButton1.Text;
}
if (RadioButton2.Checked)
{
s = RadioButton2.Text;
}
Response.Write("<script>alert('你的相别是" + s + "')</script>");
}
------------------------------------------------

public void InitDropDownList1()//下拉列表添加数据
{

//仅仅定义了一个方法,InitDropDownList1
//单个填
DropDownList1.Items.Add("141");
DropDownList1.Items.Add("142");
DropDownList1.Items.Add("143");

ListItem item1 = new ListItem("141", "1");
ListItem item2 = new ListItem("141", "1");
ListItem item3 = new ListItem("141", "1");
ListItem item4 = new ListItem("141", "1");

string[] items = { "141", "142", "143", "144" };
DropDownList1.DataSource = items;
DropDownList1.DataBind();//绑定数据

//绑定数据库中的某张表
string sql = "select * from Province";
DataSet da = sqlHelper.GetDataSet(sql);
DropDownList1.DataSource = da;
DropDownList1.DataTextField = "ProvinceName";//获取市区
DropDownList1.DataValueField = "ProvinceID";
DropDownList1.DataBind();

}
-----------------------------------------------------------------------------------
在线人数以及访问量:

1.在登录成功那里记录下来登录的用户

context.Session["user"]=name;

//修改Application对象的值之前,进行加锁处理,防止别人同时修改
context.Application.Lock();//此方法为application对象加锁,促进访问的同步
context.Application["onLine"] = Convert.ToInt32(context.Application["onLine"]) + 1;
//修改Application对象的值之后,进行解锁处理,以供别人修改
context.Application.UnLock();//此方法为application对象解锁
context.Response.Redirect("AddStudent.htm");
2.在查看页面写上:

protected void Page_Load(object sender, EventArgs e)
{
if (Session["user"] == null)
{
Response.Redirect("Login.ashx");
}
Response.Write("邀请"+Session["user"]+"加入,本团已有"+Application["onLine"]+"个团员"+"<br/>");
Response.Write(Session["user"] + "是本团的第" + Application["count"] + "个团员");
}
3.在全局变量那里写上:

protected void Application_Start(object sender, EventArgs e)
{
Application["onLine"] = 0;
Application["count"] = 0;
}

protected void Session_Start(object sender, EventArgs e)
{

//修改Application对象的值之前,进行加锁处理,防止别人同时修改
Application.Lock();//此方法为application对象加锁,促进访问的同步
Application["count"] = Convert.ToInt32(Application["count"]) + 1;
//修改Application对象的值之后,进行解锁处理,以供别人修改
Application.UnLock();//此方法为application对象解锁

}
......
protected void Session_End(object sender, EventArgs e)
{

//修改Application对象的值之前,进行加锁处理,防止别人同时修改
Application.Lock();//此方法为application对象加锁,促进访问的同步
Application["onLine"] = Convert.ToInt32(Application["onLine"]) - 1;
//修改Application对象的值之后,进行解锁处理,以供别人修改
Application.UnLock();//此方法为application对象解锁
}

<form action='hello.ashx'>
姓名:<input type='text' name='username' /> <input type='submit' value='提交' />
</form>
所有的表单都是提交的以name为key,以value为值的内容
条件运算符
表达式为:表达式1?表达式2:表达式3
先求解表达式1,
若其值为真(非0)则将表达式2的值作为整个表达式的取值,
否则(表达式1的值为0)将表达式3的值作为整个表达式的取值。

html的name和id可以类比身份证的姓名和身份证编号
编号id具有唯一性,一个id只出现一次。
名称name具备可重复性,可以多次出现。
在css中两者都具备识别html元素的作用,name用点号.表示,id用井号#
一般name用于通用多次出现元素的样式定义,id用于唯一性元素样式定义。

在表单当中,由于有些控件具备多元素特性,例如radio checkbox等,使用id不便于表单数据的提交,此外浏览器会根据name来设定发送到服务器的request,因此在表单当中,用name来提交数据。

当然,在实际的html中,也完全可以不用id,用单独的class也可以起到代替id的作用。但是在js中,是无法通过class直接后去html元素的, 定义id便于相关操作。

inherit是继承父类的属性,一般用于字体、颜色、背景等
auto是按情况自适应,一般用于高度、宽度、外边距和内边距等关于长度的属性
现在一般常用的属性都支持inherit,用的不多,auto自适应长度用的比较多。如{ margin:0 auto}加上这个属性的元素只要定义了宽度就会相对于他的父元素自居中。
Visual Studio Ultimate 2013 KEY(密钥):BWG7X-J98B3-W34RT-33B3R-JVYW9

Visual Studio Premium 2013 KEY(密钥):FBJVC-3CMTX-D8DVP-RTQCT-92494

Visual Studio Professional 2013 KEY(密钥): XDM3T-W3T3V-MGJWK-8BFVD-GVPKY

Team Foundation Server 2013 KEY(密钥):MHG9J-HHHX9-WWPQP-D8T7H-7KCQG
----------------------------------------------------------------------
IsPostBack 是Page类有一个bool类型的属性,用来判断针对当前Form的请求是第一次还是非第一次,IsPostBack=false时表示是第一次请求,当IsPostBack=true时,表示是非第一次请求。因

为第一次请求的时候会执行Page_Load,在非第一次请求的时候也会执行Page_Load。为什么对同一个Form有多次请求呢?asp.net中引入了服务器端事件,支持服务器端事件的控件,会发出对当前Form的请求,这样在很多情形下我们就需要区别是否是对这个Form的第一次请求。

二、IsPostBack结论

1、对于使用Server.Transfer进行进行迁移时迁移到的页面其IsPostBack=false 每次刷新页面都是第一次加载页面;

2. Post方式如果Request中没有请求值,即Request.Form =null则IsPostBack=false;Get方式如果Request中没有请求值,即Request.QueryString =null则IsPostBack=false。
-------------------------------------------------------
自动生成属性Ctrl+R+E
jQuery提供了is()方法可以很方便的判断元素是否可见,是否隐藏,是否选中。
jquery中可以通过xx.is(':checked')判断checkbox,radiobutton是否是选中状态

原文地址:https://www.cnblogs.com/ZkbFighting/p/8145366.html