ASP.NET(C#)·µ»ØÉÏÒ»Ò³(ºóÍË)´úÂë
2008-08-10 10:32
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState["BackUrl"] = Request.UrlReferrer.ToString();
}
}
/// <summary>
/// ·µ»Ø°´Å¥µã»÷ʼþ
/// </summary>
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect(ViewState["BackUrl"].ToString());
}
ÁíÒ»ÖÖ·½·¨
ÔÚC# Web³ÌÐòÖУ¬ÈçΪҳÃ水ťд·µ»ØÉÏÒ»Ò³´úÂë
this.RegisterClientScriptBlock("E", "<script language=javascript>history.go(-2);</script>");
ÆäÖУ¬history.go(-2)£¬ÒªÐ´Îª-2£¬ÒòÔÚ°´Å¥Ê¼þ´¥·¢Ç°£¬ÒÑË¢ÐÂÒ»´ÎÒ³Ã棬ËùÒÔÓ¦ÊÇ-2¡£
Response.Write("<script language=javascript>history.go(-2);</script>");
´Ë´¦Ò²ÒªÐ´Îª“-2”¡£¸úÖ±½Óд½Å±¾µÄÓÐËù²»Í¬¡£
......
ASP.NET(C#)·µ»ØÉÏÒ»Ò³(ºóÍË)´úÂë
2008-08-10 10:32
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState["BackUrl"] = Request.UrlReferrer.ToString();
}
}
/// <summary>
/// ·µ»Ø°´Å¥µã»÷ʼþ
/// </summary>
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect(ViewState["BackUrl"].ToString());
}
ÁíÒ»ÖÖ·½·¨
ÔÚC# Web³ÌÐòÖУ¬ÈçΪҳÃ水ťд·µ»ØÉÏÒ»Ò³´úÂë
this.RegisterClientScriptBlock("E", "<script language=javascript>history.go(-2);</script>");
ÆäÖУ¬history.go(-2)£¬ÒªÐ´Îª-2£¬ÒòÔÚ°´Å¥Ê¼þ´¥·¢Ç°£¬ÒÑË¢ÐÂÒ»´ÎÒ³Ã棬ËùÒÔÓ¦ÊÇ-2¡£
Response.Write("<script language=javascript>history.go(-2);</script>");
´Ë´¦Ò²ÒªÐ´Îª“-2”¡£¸úÖ±½Óд½Å±¾µÄÓÐËù²»Í¬¡£
......
×ܽáasp.net¿ª·¢³£Óõķ½·¨Ò»
using System;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.IO;
namespace MoneyWise
{
/// <summary>
/// utils µÄժҪ˵Ã÷¡£
/// </summary>
public class utils
{
private utils()
{
}
public static string ToBin(int source)
{
int t = source;
string ret = "";
for (int i = 0; i < 32; i++)
{
ret = ((t & 1) == 1 ? "1" : "0") + ret;
t >>= 1;
}
return ret;
}
public static bool CreateDirs(string path)
{
for (int i = 0; i < path.Length; i++)
{
if (path[i] == '\\' || path[i] == '/')
{
if (Directory.CreateDirectory(path.Substring(0, i)).Exists == false)
return false;
}
}
Directory.CreateDirectory(path);
return true;
}
public static void CopyDirectory(string SourceDirectory, string TargetDirectory)
{
if (SourceDirectory[SourceDirectory. ......
asp.net ¿ª·¢Öг£ÓõÄһЩ·½·¨×ܽáËäȻдµÄ²»ºÃ,µ«ºÜʵÓÃ
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Net;
using System.Text.RegularExpressions;
using System.Web.UI;
using System.Web.SessionState;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
namespace f.DBUtility
{
public static class Code
{
#region »ñÈ¡ÐÇÆÚ¼¸
/// <summary>
/// ·µ»ØÐÇÆÚ
/// </summary>
/// <returns></returns>
public static string GetWeek()
{
string wek = "";
int m = System.DateTime.Today.Month;
int y = System.DateTime.Today.Year;
int d = System.DateTime.Today.Day;
int weeks = getWeekDay(y, m, d);
switch (weeks)
{
case 1:
wek = "ÐÇÆÚÒ»";
break;
case 2:
wek = "Ð ......
asp.net¿ª·¢ÖУ¬Í¨³£ÐèÒª×öһЩ¿Í»§¶ËÑéÖ¤¡£µ±ÎÒÃÇĬÈÏÔÚÒ»¸öÒ³ÃæÖмӸöbutton¿Ø¼þʱ£¬Õâ¸öButton±»asp.net Êä³öΪһ¸öSubmit°´Å¥¡£ asp:Button ID=Button1 runat=server Text=Button on click=Button1_Click /
ÔÚ_doPostBack·½·¨ÄÚ£¬Í¨¹ýtheForm.submit()À´Ê¹Êý¾ÝÌá½»µ½·þÎñÆ÷¡£
ÕâÑùºÜÈÝÒ׿´³ö£¬Èç ¹ûÎÒÃÇÏëÒªÔÚÊý¾ÝÌá½»µ½·þÎñÆ÷¶ËÇ°×öЩÑéÖ¤µÄÊÂÇ飬¾ÍÒªÊ×ÏÈÔÚ_doPostBack֮ǰ×öЩ´¦Àí£¬²¢Ê¹Êý¾ÝÑéÖ¤Ö»ÓдﵽÁËÒªÇó ºó£¬²Å¿ÉÒÔµ÷ÓÃ_doPostBackʹÊý¾Ý»Ø´«¡£ÎÒÃÇÊ×ÏȸøButton¼ÓÒ»¸ö OnClientClickÊôÐÔ£¬¸øOnClientClick ÊôÐÔÖ¸¶¨Ò»¸öJS·½·¨Test():
<asp:Button ID="Button1" OnClientClick="test();" UseSubmitBehavior="false" runat="server" Text="Button" onclick="Button1_Click" />
JS´úÂëÈçÏ£º
1: function test()
2: {
3: alert("test");
4: return false ;
5: }
ÔÙ¿´Ò»Ï¾¹ý·þÎñ¶Ë½âÎöºóÊä³öµÄ¿Ø¼þHTML´úÂë:
<input type="button" name="Button1" value="Button" onclick="test();__doPostBack('Button1','')" id="Button1" />
ÎÒÃÇ¿´µ½test·½·¨Ö´ÐÐÊÇÔÚ_doPostBack֮ǰ£¬µ±ÎÒÃǵ㰴ťʱ£¬ Ò³Ãæ»áµ¯³ö test ¾¯¸æ£¬µ«Ê ......
ûÓÐ×ÐϸÑо¿¹ýViewState£¬×î½ü³öÏÖµÄÎÊÌâÈÃÈËÍ·Í´²»ÒÑ¡£
ViewState»áÔÚijЩÌض¨Çé¿öÏÂÏûʧ£¬ÇÒºÜÄѲ¶×½µ½¡£²éÁËһЩ¼¼ÊõÎÄÕ£¬¶¼ÊÇ˵ViewStateµÄ»úÖÆÊǽ«ÐÅÏ¢´æÔÚÒ³ÃæµÄhidden inputÀïÃ棬Ëƺõ²»¿ÉÄÜ´æÔÚÕâЩÎÊÌ⣬¸ø³öµÄÀíÓÉÎÞ·ÇÊÇÔÚij¸öµØ·½±»Ä³¸ö²»Ð¡ÐĵijÌÐòÔ±¸ø½ûµô»òÇå³ýµôÁË¡£µ«ÕÒÁ˺ܾÃҲûÕÒµ½Õâ¸öµØ·½......
Ò»¸öżȻµÄ»ú»á¿´µ½ÁËһƪ¹ØÓÚViewState»úÖƵÄÎÄÕ£¬µ±¿´µ½ÏÂÃæÕâ¶ÎÎÄ×Öʱ¶Ùʱ»íÈ»¿ªÀÊ
----------------------------ÎÒÊÇ·Ö¸îÏß-------------------------------------------------------------------------
ºÇºÇ£¬Óеġ£´ÓAPS.NET2.O¿ªÊ¼£¬Î¢ÈíΪÎÒÃÇÌṩÁË£¡¹ËÃû˼Ò壬Õâ¸öÀà¿ÉÒÔ½«VIEWSTATE´æ´¢ÔÚSessionÖУ¬¶ø²»ÊÇHidden InputÖС£Õâ¿ÉÒÔÓÃÓÚ´óÊýÁ¿¼¶µÄVIEWSTATE´¦Àí£¬ËüµÄʵÏÖÒ²Òì³£¼òµ¥
---ת×Ô“×ÔÓÉ·É” http://www.cnblogs.com/freeflying/archive/2010/01/03/1638264.html
----------------------------ÎÒÊÇ·Ö¸îÏß------------------------------------------------------------------- ......
default.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.IO;
namespace Web0531
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
db.dataBind(ListView1, "select * from exam order by id");
try
{
int PageSize = (int)Session["PageSize"]; // ±£Ö¤´ÓÐÞ¸ÄÒ³ÃæÄÜ·µ»Øµ½ÔÀ´µÄÒ³Ãæ
int StartRowIndex = (int)Session["StartRowIndex"];
((DataPager)ListView1.FindControl("DataPager1")).SetPageProperties(S ......
×ܼǼÊý:2672; ×ÜÒ³Êý:446; ÿҳ6 Ìõ;
Ê×Ò³ ÉÏÒ»Ò³ 1
[2] [3] [4] [5] [6] [7] [8] [9] [10] ÏÂÒ»Ò³ βҳ