<?xml version="1.0" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="css/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>intro to all Computer programming,how to,guide,examples, - Asp Tutorials</title><link>http://teachmeasp.net/</link><description>Asp tutorials,Php tutorials,jsp tutorials,Html tutorials,cgi tutorials,xml tutorials, examples,articles, resources,source code, and links - </description><generator>RainbowSoft Studio Z-Blog 1.8 Spirit Build 80722</generator><language>zh-CN</language><copyright>Copyright 2010 teachmeasp.net. Some Rights Reserved.</copyright><pubDate>Sun, 05 Sep 2010 19:27:52 +0800</pubDate><item><title>Contact ASP.Net(6 intimately)</title><author>a@b.com (rain)</author><link>http://teachmeasp.net/post/320.html</link><pubDate>Tue, 03 Mar 2009 09:37:52 +0800</pubDate><guid>http://teachmeasp.net/post/320.html</guid><description><![CDATA[Name a space about Namespace() use<br/><br/>We see in the program in front,I am commonly used %26lt;% @ Import Namespace= %26quot;System.Data%26quot; %%26gt; , this is to citing the Namespace that M$ offers for us, this and ASP are different,The ability after the Namespace that we must cite to be concerned with our operation first in ASP.net uses corresponding function.Actually spoken parts in an opera,A Namespace; is a component.This is about the advanced application of ASP.net,I am met retrospective is paragraphic tell.(should write there nevertheless,Time. . . . . . .. <br/><br/>Below me simple enumeration a few commonly used Namespace<br/><br/>%26lt;% @ Import Namespace= %26quot;System.Data%26quot; %%26gt;   When processing data, use<br/>%26lt;% @ Import Namespace= %26quot;System.Data.ADO%26quot; % %26gt; Use when use ADO.net;<br/>%26lt;% @ Import Namespace= %26quot;System.Data.SQL%26quot; %%26gt;  Database of SQL Server is special<br/>%26lt;% @ Import Namespace= %26quot;System.Data.XML%26quot; %%26gt;  Need not see processing XML be used<br/>%26lt;% @ Import Namespace= %26quot;System.IO%26quot; %%26gt;  Use when transaction file<br/>%26lt;% @ Import Namespace= %26quot;System.Web.Util%26quot; %%26gt;  The everybody when sending mail can be used<br/>%26lt;% @ Import Namespace= %26quot;System.Text%26quot; %%26gt;   When text codes, use<br/><br/>Those who handle database need east<br/><br/>Explained Namespace, we can discuss the application of the database formally.From above can see,We operate a database,We need to cite below two Namespace<br/><br/>%26lt;% @ Import Namespace= %26quot;System.Data%26quot; %%26gt;<br/>%26lt;% @ Import Namespace= %26quot;System.Data.SQL%26quot; %%26gt;<br/><br/>Actually System.Data.SQL can be replaced with System.Data.ADO,SQL is SQL Server special,ADO can support any databases (should exist on lead plane only corresponding drive went, be like Access, mysql, of Oracle and so on) , the database as a result of flying knife is SQL Server here, can use ADO originally,But think M$ comes out SQL independently alone,Why need not.Can bring how many profit as to it,Flying knife had not checked,It is a bit better to should compare ADO for certain to SQL Server.<br/><br/>No matter be ADO or SQL,They have a few main targets to be used at the operation<br/><br/>Connections  Concatenate to a database,In order to facilitate the application from the back (the Connections in similar ADO)<br/>Commands    The place of executive SQL statement<br/>DataReader   Read take the data content that after carrying out, returns<br/>DataSet         Store data,The function is powerful,We will be specific explain<br/>DataSetCommand Executive SQL statement, stock data DataSet<br/><br/>The may most fathomless inside this is DataSet, we are not in charge of him first,Take soft operation first<br/><br/>Connections(SQLConection or ADOConnection)<br/><br/>Its main task establishs a tie with database server namely<br/><br/>%26lt;% @ Page Language= %26quot;C#%26quot; %%26gt;<br/>%26lt;% @ Import Namespace= %26quot;System.Data%26quot; %%26gt;<br/>%26lt;% @ Import Namespace= %26quot;System.Data.SQL%26quot; %%26gt;<br/>%26lt;Script Language= %26quot;C#%26quot; Runat= %26quot;Server %26quot;%26gt;<br/>Public Void Page_Load(Object Src, eventArgs E)<br/>{<br/>    StringstrProvider= "server=localhost;uid=sa;pwd=;database=aspcn" ;<br/>    SQLConnection MyConnection=new SQLConnection(strProvider);<br/>}<br/>%26lt;/script%26gt;<br/><br/>We established a tie that the name is MyConnection above,Was like us to open a tie with ADODB.Connection in ASP. This coupling we are in Command perhaps will be used in DataSetCommand. <br/><br/>Its a few useful attribute and method have<br/><br/>ConnectionString is obtained or set the sentence of concatenate database<br/>What ConnectionTimeout is obtained or install concatenate database is the longest,Also be overtime time<br/>DataBase is obtained or the setting wants the database name that open on database server<br/>DataSource is obtained or install DSN, authority won't be new:)<br/>Password is obtained or install a password<br/>UserID is obtained or the setting lands a name<br/>State acquires the position that binds at present<br/>Open() opens tie<br/>Close() shuts coupling<br/>Clone() clone binds.(breathe out ah,Sheep is OK Connection I am OK also)<br/><br/><br/>The usage that we also see them through a trivial example:<br/>   SQLConnection MyConnection = New SQLConnection();<br/>   MyConnection.DataSource = "mySQLServer" ;<br/>   MyConnection.Password = "" ;<br/>   MyConnection.UserID = "sa" ;<br/>   MyConnection.ConnectionTimeout = 30;<br/>   MyConnection.Open();<br/>   MyConnection.Database = "northwind" ;<br/>   MyConnection.IsolationLevel = IsolationLevel.ReadCommitted<br/><br/>Commands(SQLCommand or ADOCommand)<br/><br/>We opened a tie in the program above,We use this here with respect to need, see example had compared: <br/><br/>%26lt;% @ Page Language= %26quot;C#%26quot; %%26gt;<br/>%26lt;% @ Import Namespace= %26quot;System.Data%26quot; %%26gt;<br/>%26lt;% @ Import Namespace= %26quot;System.Data.SQL%26quot; %%26gt;<br/>%26lt;Script Language= %26quot;C#%26quot; Runat= %26quot;Server%26quot; %26gt;<br/>Public Void Page_Load(Object Src, eventArgs E)<br/>{<br/>     StringstrProvider= "server=localhost;uid=sa;pwd=;database=aspcn" ;<br/>      String StrIndex= "select * From Aspcn Where Purview='webmaster'" ;<br/>      SQLConnection MyConnection=new SQLConnection(strProvider);<br/>      SQLCommand MyCommand = New SQLCommand(strIndex, myConnection);<br/>      MyConnection.Open();   / / open tie<br/>      MyCommand.ExecuteNonQuery();  / / executive SQL,But do not return any records<br/>      MyConnection.Close();<br/>}<br/>%26lt;/script%26gt;<br/><br/>Two parameter cited when we establish SQLCommand target in above example (StrIndex, myConnection) , from inside source program we also can see what StrIndex represents is executive SQL statement,MyConnection is the tie that we establish before. Next we are about to open MyConnnection first, carry out this SQL statement again next.We are carried out here those who use is ExecuteNonQuery() method,Do not return record volume so,Just return the record that suffers an effect several.<br/><br/>Such it is OK also to we are opened here and shut a database doing.<br/><br/>     StringstrProvider= "server=localhost;uid=sa;pwd=;database=aspcn" ;<br/>      String StrIndex= "select * From Aspcn Where Purview='webmaster'" ;<br/>      SQLConnection MyConnection=new SQLConnection(strProvider);<br/>      SQLCommand MyCommand = New SQLCommand(strIndex, myConnection);<br/>      MyCommand.ActiveConnection.Open();<br/>      MyCommand.ExecuteNonQuery();<br/>      MyCommand.ActiveConnection.Close();<br/><br/>Earnings result and foregoing same.Carry out statement of a SQL to have a lot of kinds of methods so.And still not merely two kinds,DataSetCommand learned at the back of us, law of that dozen of evolution is N planted:) this saw the demand of your habit and program with respect to need;)<br/><br/>We see the method with commonly used Command and property first<br/><br/>ActiveConnection is obtained or install coupling Connections<br/>The SQL statement that CommandText carries out or store process (StoredProcedure) name<br/>What CommandTimeout carries out is the longest<br/>The type that CommandType Command operates (StoredProcedure, text, tableDirect) three kinds, acquiescent Text<br/>Parameters operation stores use when the process<br/>Execute() carries out SQL statement or store process<br/>ExecuteNonQuery() is Alexandrine,Distinction depends on returning record volume<br/>Command of Clone() clone<br/><br/><br/>See a case likewise:<br/><br/><br/>   String MySelectQuery = "SELECT * FROM Categories ORDER BY CategoryID" ;<br/>  StringmyConnectString= "userid=sa;password=;database=northwind;server=mySQLServer" ;<br/>   SQLCommand MyCommand = New SQLCommand(mySelectQuery);<br/>   MyCommand.ActiveConnection = New SQLConnection(myConnectString);<br/>   MyCommand.CommandTimeout = 15;<br/>   MyCommand.CommandType = CommandType.Text;%26lt;/ FONT%26gt;<br/><br/><br/> <br/><br/>...]]></description><category>Asp Tutorials</category><comments>http://teachmeasp.net/post/320.html#comment</comments><wfw:comment>http://teachmeasp.net/</wfw:comment><wfw:commentRss>http://teachmeasp.net/feed.asp?cmt=320</wfw:commentRss><trackback:ping>http://teachmeasp.net/cmd.asp?act=tb&amp;id=320&amp;key=c286960f</trackback:ping></item><item><title>Handgrip hand teachs your use Java to write ASP package (3)</title><author>a@b.com (rain)</author><link>http://teachmeasp.net/post/311.html</link><pubDate>Tue, 03 Mar 2009 09:37:52 +0800</pubDate><guid>http://teachmeasp.net/post/311.html</guid><description><![CDATA[6, good program was written,The Project that nods tool column now,Click WayneStudio Properties (to be in most next) .Choose COM Classes,,In JavaASP' of the pitch on in Automatically Generate Type Library kind,And click 'OK' ,Pursue as follows. <br/></img>...]]></description><category>Asp Tutorials</category><comments>http://teachmeasp.net/post/311.html#comment</comments><wfw:comment>http://teachmeasp.net/</wfw:comment><wfw:commentRss>http://teachmeasp.net/feed.asp?cmt=311</wfw:commentRss><trackback:ping>http://teachmeasp.net/cmd.asp?act=tb&amp;id=311&amp;key=35c8ccb1</trackback:ping></item><item><title>Handgrip hand teachs your use Java to write ASP package (4)</title><author>a@b.com (rain)</author><link>http://teachmeasp.net/post/312.html</link><pubDate>Tue, 03 Mar 2009 09:37:52 +0800</pubDate><guid>http://teachmeasp.net/post/312.html</guid><description><![CDATA[Two, compile project Project: <br/><br/>　 　 is good,We should prepare to compile component of our Java COM eventually now.The Build/Build in clicking tool column,In the condition column below,You can see different condition message shows package is being registered and Type Library is being generated.After this,You can see Solution Update Succeeded of a successful information,Congratulation the first when you compiled you Java COM component that uses target of visit ASP interior.<br/><br/>Three, package is registered on long-range server<br/><br/>　 　 compiles component of a COM when your use Visual Studio,Its can automatic enrollment package and generate Type Library,But if you want to use your component on other server,So the component that if you want to register you on other machine,your component registers before you are using it,You can use following form below DOS condition:<br/><br/>　 　 C:\Regsvr32 WayneStudio.dll<br/><br/>Notice,Use the DLL file name after you are written and be being compiled to replace WayneStudio.dll. ...]]></description><category>Asp Tutorials</category><comments>http://teachmeasp.net/post/312.html#comment</comments><wfw:comment>http://teachmeasp.net/</wfw:comment><wfw:commentRss>http://teachmeasp.net/feed.asp?cmt=312</wfw:commentRss><trackback:ping>http://teachmeasp.net/cmd.asp?act=tb&amp;id=312&amp;key=e5abc7b1</trackback:ping></item><item><title>Handgrip hand teachs your use Java to write ASP package (5)</title><author>a@b.com (rain)</author><link>http://teachmeasp.net/post/313.html</link><pubDate>Tue, 03 Mar 2009 09:37:52 +0800</pubDate><guid>http://teachmeasp.net/post/313.html</guid><description><![CDATA[Four, the ASP page that founds to call package<br/><br/>We had compiled 　 　 package,And had registered it,The package that I consider to if why call us to just was registered in ASP program,introduce now.Open the ASP editor that likes to use most,Found a new ASP page.Entitle FirstCom.asp: <br/><br/>＜ ％ Option Explicit<br/>　 Response.Buffer = True<br/>　 Response.Expires = 0<br/>％ ＞<br/>＜ Html ＞<br/>＜ Head ＞<br/>＜ Title ＞ Title of your ／ of ＜ of component of the first Java COM ＞<br/>＞ of ＜ ／ Head<br/>＜ Body ＞<br/>＞ of B of ＜ of ＞ of 　 ＜ P Align= "center" Id= "com"<br/>Dim JavaASP of 　 ＜ ％<br/>　 　 Set JavaASP = Server.CreateObject("WayneStudio.JavaASP" )<br/>　 　 JavaASP.HelloWorld<br/>＞ of ％ of 　 Set JavaASP = Nothing<br/>＞ of ＜ ／ B<br/>＞ of ＜ ／ P<br/>＞ of ＜ ／ Body<br/>＞ of ＜ ／ Html<br/><br/>We are simple in the program code above 　 　 established target of a JavaASP from inside WayneStudio.JavaASP component,Next the methodological HelloWorld that we called it will show how to use Response method from inside package....]]></description><category>Asp Tutorials</category><comments>http://teachmeasp.net/post/313.html#comment</comments><wfw:comment>http://teachmeasp.net/</wfw:comment><wfw:commentRss>http://teachmeasp.net/feed.asp?cmt=313</wfw:commentRss><trackback:ping>http://teachmeasp.net/cmd.asp?act=tb&amp;id=313&amp;key=81f721d9</trackback:ping></item><item><title>Handgrip hand teachs your use Java to write ASP package (6)</title><author>a@b.com (rain)</author><link>http://teachmeasp.net/post/314.html</link><pubDate>Tue, 03 Mar 2009 09:37:52 +0800</pubDate><guid>http://teachmeasp.net/post/314.html</guid><description><![CDATA[Five, programming is indicative accord with (ProgID)<br/><br/>If 　 　 has used the friend of CreateObject method,Can know programming is indicative accord with (ProgID) ,It is,It is you to the parameter of Server.CreateObject,Namely the indicative accord with of the package that you consider to use.There was a problem now,The indicative accord with of the component that how you know to you are founded is what,How do you change it again?Be in very simple,In Visual J++ and Visual Basic,Your project (Project) the first part of the ProgID of the component that the name is you,For WayneStudio in name of the project in the article like,So ProgID with WayneStudio begin,Next your kind of the second part that the name is ProgID,Like JavaASP,So complete ProgID is WayneStudio.JavaASP<br/><br/>Six, brief summary<br/><br/>I had introduced 　 　 above how to use Java to found ASP COM component,The hope is helped somewhat to everybody.The article just cited a very simple case,The Response target that is used in ASP internal target only,What actually Java can come true is far more than these,As follows,I am a few listedder the method that calls ASP in-house boy or girl friend:<br/><br/>　 　 Response NewRes = AspContext.getResponse();<br/>　 　 Request NewReq = AspContext.getRequest();<br/>　 　 Server NewServer = AspContext.getServer();<br/>　 　 Session NewSession = AspContext.getSession();<br/>　 　 Application NewApplication = AspContext.getApplication();<br/><br/>The Java COM that 　 　 hopes everybody can consult the article finishs pron yourselves is written,The purpose of such articles was achieved. ...]]></description><category>Asp Tutorials</category><comments>http://teachmeasp.net/post/314.html#comment</comments><wfw:comment>http://teachmeasp.net/</wfw:comment><wfw:commentRss>http://teachmeasp.net/feed.asp?cmt=314</wfw:commentRss><trackback:ping>http://teachmeasp.net/cmd.asp?act=tb&amp;id=314&amp;key=31211eaf</trackback:ping></item><item><title>Contact ASP.Net(1 intimately)</title><author>a@b.com (rain)</author><link>http://teachmeasp.net/post/315.html</link><pubDate>Tue, 03 Mar 2009 09:37:52 +0800</pubDate><guid>http://teachmeasp.net/post/315.html</guid><description><![CDATA[ASP+ comes out fast half an year,Our site also made not little introduction,But fly today I just had the knife eventually mood will write the article about this ASP+ .Ah, allow authority kick one's heels.<br/><br/>    Above all I must declare,This tutorial applies to the person that has experience of regular network process designing,For instance Asp, php, cgi, jsp developer,If you are right,network process designing understands not at all,So you or the language that go learning to learn other first,Otherwise you meet the following article the place that a lot of look not to understand.Breathe out ah.<br/><br/>    We begin.<br/><br/>The moving environment of ASP+<br/><br/>    We should learn ASP+ ,Must do to debug an environment to come out first.The " that lets you loves gallinaceous " to support Asp+ , so you need the following requirement:<br/><br/>Windows 2000 Professional, windows 2000 Server, windows 2000 Advanced Server<br/><br/>NGWS<br/><br/>IE 5.5         <br/><br/>    The need that above is supportive ASP+ ,The possibility that everybody sees only at present Windows 2000 just has installation NGWS,NT,Windows 98, windows Me still supports Asp+ without method temporarily, won't old shell promises us to meet what support Asp+ on the platform of other in the following version,Everybody waits slowly.And not all still Window 2000 is OK,The version date of Windows 2000 if the ability of RC 3618 above goes (this is the circumstance when this write this article,It is OK to connect Win98 now) .The version that flying knife is Windows 2000 before me is too low,Must abandon an authorised edition,Bought D edition (it is the disaster that ASP+ causes completely) .<br/><br/>    NGWS is a chunk head,Those who have 111M is gigantic,Flying knife brother my kitten ran 5 hours just do it calm,Its download address is Http://download.microsoft.com/download/VisualStudioNET/Install/2204/NT5/EN-US/setup.exe Is hope M$ is richly,The bandwidth that downloads a site is big still,Download speed is OK still cough up.Everybody comes slowly.<br/><br/>    IE 5.5 is above had better do decide east east.This thing now have been flush:) ,Of D edition many,Breathe out ah,Cannot weigh D edition,Itself is free:)<br/><br/>The comparison of ASP+ and ASP<br/><br/>    The benefit that speaks of ASP+ ,That is very much.A few are lifted here the most apparent.<br/><br/>    Speed,ASP+ is after compiling, carry out,Be compiled when Aspx file first time is requested that is to say,The following request did not need to be compiled afresh.And ASP is language of explanatory sex script,Need to be compiled afresh every time,This kind of reason,Its speed cannot be compared with ASP+ .Do not cross ASP+ compile speed quite slow also,Debug on this locality machine,The rate that implements for the first time is very slow.After passing very fast,The mission that executes for the first time gives the administrator goes doing.We enjoy the following high rate:)<br/><br/>    Function,The function of ASP+ is extremely powerful,Can do us almost in network thinkable thing,Breathe out ah,Cite a simple case,Be a file then upload,In the times of ASP,This problem just can go through package only,But it is OK to need the following code only in ASP+ .An example is below: <br/><br/>%26lt;Html%26gt;<br/>%26lt;Head%26gt;<br/><br/>%26lt;Script Language= %26quot;C#%26quot; Runat= %26quot;server%26quot; %26gt;<br/><br/>Void Button1_Click(object Source, eventArgs E) {<br/><br/>If (Text1.Value=="" ) {<br/>Span1.InnerHtml = "Error: You Must Enter A File Name" ;<br/>Return;<br/>}<br/><br/>If (File1.PostedFile! = Null) {<br/>Try {<br/>File1.PostedFile.SaveAs("c:\\temp\\" +Text1.Value);<br/>Span1.InnerHtml = "File Uploaded Successfully To C:\\temp\\" +Text1.Value+ " On The Web Server" ;<br/>}<br/>Catch (Exception Exc) {<br/>Span1.InnerHtml = "Error Saving File C:\\temp\\" +Text1.Value+ "<br/>     "+ Exc.ToString();<br/>}<br/>}<br/>}<br/><br/><br/><br/>%26lt;/ Head%26gt;<br/>%26lt;Body%26gt;<br/><br/><br/><br/>HtmlInputFile Sample<br/><br/><br/>%26lt;Form Enctype= %26quot;multipart/form-data%26quot; Runat= %26quot;server%26quot; %26gt;<br/><br/>Select File To Upload: <br/><br/><br/><br/>Save As Filename (no Path) : %26lt;Input Id= %26quot;Text1%26quot; Type= %26quot;text%26quot; Runat= %26quot;server%26quot; %26gt;<br/><br/><br/><br/><br/>%26lt;Span Id=Span1 Style= "font: 8pt Verdana;%26quot; Runat= %26quot;server%26quot; /%26gt;<br/><br/><br/><br/><br/>%26lt;Input Type=button Id= %26quot;Button1%26quot; Value= %26quot;Upload%26quot; OnServerClick= %26quot;Button1_Click%26quot; Runat= %26quot;server%26quot; %26gt;<br/><br/>%26lt;/ Form%26gt;<br/><br/>%26lt;/ Body%26gt;<br/>%26lt;/ Html%26gt;<br/><br/>    Believe everybody can understand the process above,Not be too difficult.Looking to upload a file with ASP+ is so simple,Did not need what package at all,Breathe out ah,Have pity on the "aspcnUP that I wrote flying knife a long time to upload package " only,A painstaking effort was given to get finished by M$ .Our component also wants come off sentry duty,Alas,Lamentable ah.(Ground of flying knife pathos sings " wind to neigh,Easy water is cold,Hero is gone forever. . . . . . .. )<br/><br/>    The thing that ASP+ can do is far more than and such,Here just cites a small case, its more function introduces after us again,Breathe out ah.<br/><br/>    ASP+ still has one big advantage is structured process designing, his program language already can be added arbitrarily oneself,Support C# at present, VB, javaScript, breathe out ah,Everybody feels disappointed to supporting VBScript?!:) this is hasten of general trends place,Everybody also need not disappointed,I am the following the exemple Cheng of the article can be written with C# ,Breathe out ah,If you are loving at VB,You also can see stand originally about VB and C# grammar relative article,Of very easy begin.To C ＃ , authority may be newer,The program that does not pass us to see settle on face,Discover him or having a lot of places is us of easy begin.The combinative put oneself in another's position that my individual thinks it is C++ and VB and Java,Also may be the first pace of Java of M$ declare war, big housekeeping money became much can feel his benefit is much:)<br/><br/>    Write ASP+ program,You can feel is to writing VB or VC,Very much thought all comes from at VB,VC,The reason that may be M$.NET.The thinking that so we write a program needs a change,Should letting you already felt this oneself is to writing software,Not be the Asp program that writing a tradition.<br/><br/>    Return some a few functions as to ASP+ ,The article before our site also introduced,Breathe out ah,Everybody is checked check,We also can pass a program to understand later,Regrettablly,We serve the server of business to cannot use Asp+ , otherwise the character of the Asp+ that our meeting more understands.<br/><br/>    The problem that everybody cares another is,Whether to still support Asp of the Windows 2000 of NGWS, fear we had Aspx,Did not have Asp, the program previously played completely.Everybody need not worry about this problem at all,The M$ when NGWS is designed has considered,NGWS is likewise OK and analytic Asp, the patulous name of the file is.asp,The method that uses Asp then is analytic,If be.aspx,come with respect to use Asp+ analytic,So the Asp before you is won't submit an expense account.With a ha breath out,Everybody can be at ease.Such cough up is on the machine of flying knife.Aspx, asp can be used:)<br/><br/>    This arrives the first times here,Below one,We introduce,The grammar of Asp+ :) , authority is great sing the praises.<br/>...]]></description><category>Asp Tutorials</category><comments>http://teachmeasp.net/post/315.html#comment</comments><wfw:comment>http://teachmeasp.net/</wfw:comment><wfw:commentRss>http://teachmeasp.net/feed.asp?cmt=315</wfw:commentRss><trackback:ping>http://teachmeasp.net/cmd.asp?act=tb&amp;id=315&amp;key=4efadf7c</trackback:ping></item><item><title>Contact ASP.Net(2 intimately)</title><author>a@b.com (rain)</author><link>http://teachmeasp.net/post/316.html</link><pubDate>Tue, 03 Mar 2009 09:37:52 +0800</pubDate><guid>http://teachmeasp.net/post/316.html</guid><description><![CDATA[On one,We introduced ASP+ simply make up an environment, we talk about the grammar of ASP+ this. Had installed NGWS hind when you actually,The tutorial that the documentation that he takes is best study ASP+ ,Want you E article is enough good,And very good endurance,Learning ASP+ is not tickler. We these fellow also were to learn from here of a lot of,This article about ASP+ grammar,Great majority also comes from at M$ textual,Most regrettablly the server that is us cannot mount NGWS,Some example,Everybody cannot see executive result,Not quite good.Do not cross some places,I can show executive result come.We begin this one:)<br/><br/>    The suffixal name of an ASP+ page is ".ASPX" . It can contain elements of eight kinds of different syntactic mark buy. We will introduce these a few kinds of different grammar in this article,The use that and a case comes adduce indicates it.  <br/><br/>%26lt;% %%26gt;With%26lt;%= %%26gt;<br/><br/>Had used Asp,Had used, so everybody won't is opposite this label is new.Breathe out ah,A simple case is below.I think the result after he is carried out I am not written do not come out,Everybody also knows.This did not talk more,Ah.  <br/><br/>%26lt;% For (int I=0; I%26lt;8; I++ )<br/>   {<br/>%%26gt;<br/>      Hello World!    <br/>%26lt;% } %%26gt;<br/><br/>In the example above%26lt;The program between % %%26gt; will be carried out,The result that shows, %26lt;%= %26quot;Hello World%26quot; %%26gt; is equal to%26lt;% Response.Write (%26quot;Hello World%26quot; ) %%26gt;<br/><br/>Notice:In C# ,Be with semicolon (;) as separator,But we should notice a few things.<br/><br/>　<br/><br/>C# Code<br/>%26lt;% Response.Write(%26quot;Hello World%26quot; ); %%26gt; The semicolon here is must<br/>%26lt;%= %26quot;Hello World%26quot; ; %%26gt; Such writing can having a few little problems is,Indication result is "Response.Write(" Hello World ";); "<br/> Correct<br/><br/><br/><br/>The grammar of statement code:%26lt;% . . . Number = Subtract(number, 1); . . . %%26gt;<br/><br/>  Serious problem:ASP+ unlike ASP,In ASP can function states in be in area,But all in ASP+ function and variable must be in area statement.Otherwise,The mistake can appear when Aspx is compiled.  <br/><br/>ASP+ server end accuses a grammar<br/><br/>On the server accuse an use developer can page of dynamic generation HTML,Send a client (the JavaScript that arises like Netscape and IE place is different.The page that still common browser and WAP browse place to receive also is different) . The statement of their object also was to use label.But the label of they and other is different.Because of them the bag contains attribute of a "runat=server" .(Breathe out ah,This attribute we also had been used in ASP,Do not cross a function. . . ) .The example below demonstrated to accuse use method.<br/><br/>%26lt;Html%26gt;<br/><br/>%26lt;Script Language= %26quot;C#%26quot; Runat=server%26gt;<br/><br/>Void Page_Load(Object Sender, eventArgs E) {<br/>Message.Text = "Welcome To ASP+" ;<br/>}<br/><br/>%26lt;/ Script%26gt;<br/><br/>%26lt;Body%26gt;<br/><br/>%26lt;Asp:lAbel Id= %26quot;Message%26quot; Font-size=24 Runat=server/%26gt;<br/><br/>%26lt;/ Body%26gt;<br/><br/>%26lt;/ Html%26gt;<br/><br/><br/>We join ID to be "Message" in the source code above:<br/><br/><br/>%26lt;Asp:lAbel Id= %26quot;Message%26quot; Font-size=24 Runat= %26quot;server%26quot; /%26gt;<br/><br/><br/>Read the code above,Discover we are writing VB program,Breathe out ah,Build good framework first,Next another each go writing their incident to handle.This is the new idea that M$ gives us. <br/><br/><br/>Server of ASP+ Html accuses a grammar<br/><br/>HTML server accuses,The operation HTML element that makes developer program is changed.Server of a HTML accuses it is more than common HTML element only attribute of a "runat=server" .The example below is specific demonstrated HTML service to accuse usage.<br/><br/><br/>%26lt;Script Language= %26quot;C#%26quot; Runat=server%26gt;<br/>  Void Page_Load(Object Sender, eventArgs E) {<br/>    Message.InnerHtml = "Welcome To ASP+" ;<br/>  }<br/>%26lt;/ Script%26gt;<br/>. . .      <br/>%26lt;Span Id= "Message" Style= "font-size:24%26quot; Runat=server/%26gt;<br/><br/>The result that he carries out and the first result of the program are same<br/><br/><br/>Data is bound (Databinding) is syntactic%26lt;%# %%26gt;<br/><br/>Data binds a technology to make ASP+ developer can very image ground accuse the value connection of attribute and data container rises. In%26lt;The ability after the code inside this area has %#%%26gt; to be called in %26quot;DataBind%26quot; method only can be carried out.The use that the example below demonstrated it.<br/><br/><br/>  <br/>    Here Is A Value: <br/>  <br/><br/><br/>Make through this kind of method the name is "MyList" accuse a program to change,Called DataBind() method with respect to this at this moment.<br/>Void Page_Load(Object Sender, eventArgs E)<br/> {    ArrayList Items = New ArrayList();<br/>       Items.Add("One" );<br/>       Items.Add("Two" );<br/>       Items.Add("Three" );<br/>        MyList.DataSource = Items;<br/>        MyList.DataBind();<br/>}<br/>Object label is syntactic: %26lt;Object Runat= "server" /%26gt;<br/><br/>Object label grammar makes developer can use basic label to be able to state with give typical examples an object.As follows:<br/><br/>%26lt;Object Id= %26quot;items%26quot; Class= %26quot;System.Collections.ArrayList%26quot; Runat= %26quot;server%26quot; /%26gt;<br/><br/>This object can be built automatically when move,And the name is Items<br/>Void Page_Load(Object Sender, eventArgs E) {<br/>  Items.Add("One" );<br/>  Items.Add("Two" );<br/>  Items.Add("Three" );<br/>  . . . <br/>}<br/><br/><br/>Annotate grammar: <br/><br/>Annotate can make developer prevents code (include to accuse) carry out or cite.The example below demonstrated this syntactic application.  <br/><br/>%26lt;%- -<br/><br/>  %26lt;Asp:cAlendar Id= %26quot;MyCal%26quot; Runat=server/%26gt;<br/>    %26lt;% For (int I=0; I%26lt;45; I++) {%%26gt;<br/>             Hello World<br/>    %26lt;% } %%26gt;<br/>- - %%26gt;<br/><br/>SSI grammar: %26lt;- - #Include File= "Locaton.inc "- -%26gt;<br/><br/>The brother that has written the basiccest HTML won't be unfamiliar to him,Also do not want to be told more so:)<br/><br/>%26lt;! - - #Include File= "Header.inc "- - %26gt;<br/>. . . <br/>%26lt;! - - #Include File= "Footer.inc "- - %26gt;<br/><br/>    A below,We are specific in the future see HTML accuse accuse with the user<br/>...]]></description><category>Asp Tutorials</category><comments>http://teachmeasp.net/post/316.html#comment</comments><wfw:comment>http://teachmeasp.net/</wfw:comment><wfw:commentRss>http://teachmeasp.net/feed.asp?cmt=316</wfw:commentRss><trackback:ping>http://teachmeasp.net/cmd.asp?act=tb&amp;id=316&amp;key=6b103d08</trackback:ping></item><item><title>Contact ASP.Net(3 intimately)</title><author>a@b.com (rain)</author><link>http://teachmeasp.net/post/317.html</link><pubDate>Tue, 03 Mar 2009 09:37:52 +0800</pubDate><guid>http://teachmeasp.net/post/317.html</guid><description><![CDATA[Feel embarrassed,Very long did not write an article,Main reason is before paragraph time takes an exam,So busy that fly knife I faint the head gets lost,Have eventually between present tense redundant,Must carry the first stroke of a Chinese character to come again so (note:Without the pen,Return the home,Also do not have even computer,Be in only Internet bar dawdle) .But because answer in the home,Without computer,So my article also can be intermittent only the ground draws up come,Everybody excuses me please.<br/>The friend asks me recently,Where can learn ASP+ ,The documentation that I had said early to be taken in NGWS is best study manual,The demand as a result of NGWS is too high nevertheless,The volume that still has it (110M) problem,Have one part brother,Cannot mount it,I give you Http://www.aspnextgen.com/quickstart/aspplus/ of a site, the documentation above is NGWS of direct belt,And this site is completely by what Asp+ compose builds,The executive case that everybody can see Aspx directly,The place that I resent exclusively to our site now cannot carry out Aspx namely, the executive result that cannot see exemple Cheng to everybody.<br/>good did not say much word,We should look how to use Asp+ to accuse mediumly this.<br/>ASP+ accuses a cent mediumly to be two kinds,One kind is HTML accuses (HtmlControls) ,One kind is WEB accuses (WEBControls) , we are told this first tell simpler HTML to accuse.Another kind accuses leave below one to tell again:)  <br/><br/>HTML accuses,If just see the surface,Discovery and common HTML label do not have what different,Do not pass even if<br/><br/>%26lt;select%26gt;%26lt;a%26gt;<br/>These east east,Exclusive distinction is much at the back of of label a RunAt= "server" , we are actually right this RunAt= "Server" we are not unfamiliar also,Breathe out ah,In the Global.asa file of Asp we often see.But if be in Asp+ much this,So the property of program code also changed.Be like: <br/><br/>%26lt;select Id= %26quot;aspcn%26quot; %26gt;<br/>%26lt;option%26gt;ASP%26lt;/option%26gt;<br/>%26lt;option%26gt;JSP%26lt;/option%26gt;<br/>%26lt;option%26gt;PHP%26lt;/option%26gt;<br/>%26lt;/select%26gt;<br/><br/><br/>The Select above is a common HTML label nevertheless just,But if RunAt= "server" is added after Select,So everything changed.<br/><br/>%26lt;select Id= %26quot;aspcn%26quot; RunAt= %26quot;Server%26quot; %26gt;<br/>%26lt;option%26gt;ASP%26lt;/option%26gt;<br/>%26lt;option%26gt;JSP%26lt;/option%26gt;<br/>%26lt;option%26gt;PHP%26lt;/option%26gt;<br/>%26lt;/select%26gt;<br/><br/>So this is an Asp+ program,We can write ASPX program.Be like:<br/><br/>%26lt;% @ Import NameSpace= %26quot;System.Data%26quot; %%26gt;<br/>%26lt;Script Language= %26quot;c#%26quot; RunAt= %26quot;Server%26quot; %26gt;<br/>  Void Aspcn_onclick(Object Src, eventArgs E)<br/>  {<br/>    String SelectValue;<br/><br/>    If(Page.IsPostBack)<br/>    {<br/>        SelectValue=aspcn.SelectedItem.Value;<br/>        SelectItem.Text=selectValue;<br/>    }<br/><br/>  }<br/><br/>%26lt;/script%26gt;<br/>%26lt;html%26gt;<br/>  %26lt;head%26gt;%26lt;title%26gt;Select demonstrates program %26lt;/title%26gt;%26lt;/head%26gt;<br/>%26lt;body%26gt;<br/>Choose please:<br/>%26lt;form Runat= %26quot;server%26quot; %26gt;<br/>%26lt;select Id= %26quot;aspcn%26quot; RunAt= %26quot;Server%26quot; %26gt;<br/>    %26lt;option%26gt;ASP%26lt;/option%26gt;<br/>    %26lt;option%26gt;JSP%26lt;/option%26gt;<br/>    %26lt;option%26gt;PHP%26lt;/option%26gt;<br/>    %26lt;option%26gt;ASP+%26lt;/option%26gt;<br/>    %26lt;option%26gt;COM%26lt;/option%26gt;<br/>%26lt;/select%26gt;<br/>%26lt;asp: Bottun Text= %26quot; refers %26quot; OnClick= %26quot;aspcn_onclick%26quot; %26gt;<br/>%26lt;br%26gt;<br/>Your chosen Select list is: %26Lt;font Color=red%26gt;%26lt;asp: Of short duration of Label Id= "SelectItem" Text= " is not had "%26gt;%26lt;/font%26gt;<br/>%26lt;/form%26gt;<br/><br/><br/>A very simple Aspx case is above,Main purpose is to demonstrate Select HTML accuses usage. In the example above,Show as follows above all:<br/>Choose please: ASP JSP PHP ASP+ COM  <br/>Your chosen Select list is: 訷an ?br/><br/>After you click " to refer " to bolt,After you are met, arrive: (Those who assume we are chosen is PHP)<br/>Choose please: ASP JSP PHP ASP+ COM  <br/>Your chosen Select list is: PHP<br/><br/>From inside the example above we can see,What we basically operate is Aspcn_onclick subprogram,And this program is accuse by what the name is Sub those who arouse.(The Button here and Label all belong to WEB to accuse,We issue) of a retell, we accuse in the Select that Aspcn is to the name in Aspcn_onclick operation,We are very familiar also,Breathe out ah,very the JavaScript that carries like the client? ! The brother that believes to had used Javascript,Can understand a process certainly,Breathe out ah,We write server program to resemble is the program that writing client end,M$ rolls out.Net namely to achieve this result,Nevertheless this is a not quite good thing to abecedarian,Because not clear what abecedarian does originally,be a client upright what is a server,Write them together again now,Believe a lot of people want to do paste,So I suggest abecedarian still sees a few basises first at the beginning east east had better.<br/>The value that we use Aspcn.SelectedItem.Value to get Aspcn list,Be worth this those who pass a name to be SelectItem to accuse again through SelectItem.Text=selectValue next.The case that made us see.The program is very simple,We just let everybody an abecedarian understands here.<br/>Almost label of HTML of avery kind of adds last RunAt= "server" to be able to become HTML to accuse.Have specificly:<br/>HtmlAnchor         HtmlButton  HtmlForm   HtmlGenericControl<br/>HtmlImage          HtmlInputButton (Button)  HtmlInputButton (Reset)  HtmlInputButton (Submit)<br/>HtmlInputCheckBox  HtmlInputFile HtmlInputHidden  HtmlInputImage<br/>HtmlInputRadioButton HtmlInputText (Password)  HtmlInputText (Text) HtmlSelect<br/>HtmlTable      HtmlTableCell  HtmlTableRow  HtmlTextArea<br/><br/>I temporarily also cannot the usage them each specification,Ask everybody to already looked to that site that says above me oneself, the program is written to be about to use HTML adroitly to accuse after us accuse with Web.It is good to want E article only,Believe to do not have what problem,Breathe out ah,Do not count on flying knife my interpreter ah,My head is big,Everybody forgive I one life.<br/>What additionally we want to remind everybody is,Because we write ASP+ to use C# commonly, be in so name accuse when notice size is written,The meeting when be being compiled otherwise makes mistake.If the program is compiled,having again is when value carefully please make mistake information,Do not make mistake think of to ask immediately,Already thought oneself go wanting,Gains will be bigger.Breathe out ah,This one chapter arrives here,Below one is about to tell WEB to accuse.<br/>(say me first arranged cough up,Breathe out ah,Tell WEB to accuse hind,Retell Bind, it is a database next,It is Application and Session then, again later arrange again later)<br/>88,Wish everybody crosses a good Spring Festival:)...]]></description><category>Asp Tutorials</category><comments>http://teachmeasp.net/post/317.html#comment</comments><wfw:comment>http://teachmeasp.net/</wfw:comment><wfw:commentRss>http://teachmeasp.net/feed.asp?cmt=317</wfw:commentRss><trackback:ping>http://teachmeasp.net/cmd.asp?act=tb&amp;id=317&amp;key=766b0a78</trackback:ping></item><item><title>Asp.net advanced tutorial (five) - actual combat piece (in)</title><author>a@b.com (rain)</author><link>http://teachmeasp.net/post/377.html</link><pubDate>Tue, 03 Mar 2009 09:37:52 +0800</pubDate><guid>http://teachmeasp.net/post/377.html</guid><description><![CDATA[Asp.net advanced tutorial (five)---Actual combat piece (operation of combinative forum user talks about Asp.net to express odd test and verify) (in)<br/><br/>   Ready-made works,Be about to move real now,The implementation that lets us see an user register first.Had told in front,Asp.net can realize business logic and Html code depart,So let us see the bottom is how to come true,This file is the page share that the user registers below,Prototype is according to me the style of the site makes:<br/><br/>%26lt;%@Page Language= %26quot;c#%26quot; Codebehind= %26quot;Register.cs%26quot; AutoEventWireup= %26quot;false%26quot; Inherits= %26quot;bbs.Register%26quot; %%26gt;<br/>%26lt;%@Register Tagprefix= %26quot;My%26quot; Namespace= %26quot;bbs.uctrl%26quot; %%26gt;<br/>%26lt;html%26gt;%26lt;head%26gt;<br/>%26lt;TITLE%26gt; new user registers %26lt;/TITLE%26gt;<br/>%26lt;meta Name=vs_targetSchema Content= %26quot;HTML 4.0%26quot; %26gt;<br/>%26lt;link Rel= %26quot;stylesheet%26quot; Href= %26quot;images/style.css%26quot; %26gt;<br/>%26lt;META Http-equiv=Content-Type Content= %26quot;text/html; Charset=gb2312%26quot; %26gt;<br/>    %26lt;meta Name= %26quot;GENERATOR%26quot; Content= %26quot;Microsoft Visual Studio 7.0%26quot; %26gt;<br/>    %26lt;meta Name= %26quot;CODE_LANGUAGE%26quot; Content= %26quot;C#%26quot; %26gt;%26lt;/head%26gt;<br/>%26lt;script Language=javascript%26gt;<br/>  Function OnPreview()<br/>  {<br/>    DivPreview.innerHTML = Form1.txtSignature.value;<br/>  }<br/>%26lt;/script%26gt;<br/>  %26lt;body%26gt;<br/>    <br/>    %26lt;form Method= %26quot;post%26quot; Runat= %26quot;server%26quot; ID=Form1%26gt;<br/><br/>    %26lt;My:MYHead Id= %26quot;myHead1%26quot; Runat= %26quot;server%26quot; %26gt;%26lt;/MY:MYHEAD%26gt;<br/><br/>%26lt; ! ----------------------Form forms frame outside--------------------------------------%26gt;<br/>%26lt;table Width='722' Border='0' Cellspacing=0<br/>   Cellpadding='0' Align='center'%26gt;<br/>  %26lt;TBODY%26gt;<br/>   %26lt;tr%26gt;<br/>   %26lt; ! -------------------Left sets upright a line----------------------------------------------%26gt;<br/>     %26lt;td Bgcolor='#0097c0' Width='1'%26gt;<br/>       %26lt;img Src='http://www.knowsky.com/images/Shim.gif' Width=1%26gt;<br/>      %26lt;/td%26gt;<br/>      %26lt;td Width=720 Align=middle%26gt;%26lt;br%26gt;%26lt;br%26gt;%26lt;br%26gt;<br/>   %26lt; ! -------------------Left sets upright a line----------------------------------------------%26gt;<br/><br/><br/><br/>%26lt; ! --------------New user is registered begin----------------------------------------------%26gt;    <br/>    %26lt;table Width=600 Align=center Border=0 Cellpadding=4 Cellspacing=1<br/>        Id= %26quot;tblRegister%26quot; Class=cn Bgcolor=#000000 Runat=server%26gt;<br/>        %26lt;TBODY%26gt;<br/>        %26lt;tr Bgcolor=#ffffff%26gt;<br/>            %26lt;td Colspan=3%26gt;<br/>                %26lt;p Align=center%26gt; new user registers %26lt;/p%26gt;<br/>            %26lt;/td%26gt;<br/>        %26lt;/tr%26gt;<br/>        %26lt; ! --------------User name begins--------------------------------------------------------%26gt;<br/>        %26lt;tr Bgcolor=#ffffff%26gt;<br/>            %26lt;td Width=60%26gt;<br/>                User name<br/>            %26lt;/td%26gt;<br/>            %26lt;td Width=300%26gt;<br/>                %26lt;asp:TExtBox Id= %26quot;txtUserName%26quot; Maxlength=20 Columns=20 Runat= %26quot;server%26quot; %26gt;%26lt;/asp:TExtBox%26gt;<br/>                %26lt;font Color=red%26gt;*%26lt;/font%26gt;<br/>            %26lt;/td%26gt;<br/>            %26lt;td Width=240%26gt;<br/>                User pseudonym,4-20 character<br/>                %26lt;asp:rEquiredfieldvalidator Id= "reqUserName" Display=Dynamic<br/>                    Controltovalidate= %26quot;txtUserName%26quot; Runat=Server%26gt;<br/>                    Cannot be empty!<br/>                %26lt;/asp:rEquiredfieldvalidator%26gt;<br/>                %26lt;asp:rEgularexpressionvalidator Id= "regUserName" Display=Dynamic<br/>                    Controltovalidate= "txtUserName" Runat=Server Validationexpression= "[^']{4, 20}%26quot; %26gt;<br/>                    User name is illegal!<br/>                %26lt;/asp:rEgularexpressionvalidator%26gt;                        <br/>                %26lt;asp:cUstomvalidator Id= "cusUserName" Controltovalidate= "txtUserName "<br/>                    Onservervalidate= %26quot;ValidUser%26quot; Display=Dynamic Runat=Server%26gt;<br/>                    This user already existed.<br/>                %26lt;/asp:cUstomvalidator%26gt;                <br/>            %26lt;/td%26gt;<br/>        %26lt;/tr%26gt;<br/>        %26lt; ! --------------User name ends--------------------------------------------------------%26gt;<br/><br/>        %26lt; ! --------------User code begins--------------------------------------------------------%26gt;<br/>        %26lt;tr Bgcolor=#ffffff%26gt;<br/>            %26lt;td Width=60%26gt;<br/>                Password<br/>            %26lt;/td%26gt;<br/>            %26lt;td Width=300%26gt;<br/>                %26lt;asp:TExtBox Id= "txtPassword" Maxlength=10 Columns=10<br/>                    Textmode=Password Runat=server%26gt;%26lt;/asp:TExtBox%26gt;<br/>                %26lt;font Color=red%26gt;*%26lt;/font%26gt;<br/>            %26lt;/td%26gt;<br/>            %26lt;td Width=240%26gt;<br/>                User code,4-10 character<br/>                %26lt;asp:rEquiredfieldvalidator Id=Requiredfieldvalidator1 Display=Dynamic<br/>                    Controltovalidate= %26quot;txtPassword%26quot; Runat=Server%26gt;<br/>                    Cannot be empty!<br/>                %26lt;/asp:rEquiredfieldvalidator%26gt;<br/>                %26lt;asp:rEgularexpressionvalidator Id=Regularexpressionvalidator1 Display=Dynamic<br/>                    Controltovalidate= "txtPassword" Runat=Server Validationexpression= "[^']{4, 10}%26quot; %26gt;<br/>                    The password is illegal!<br/>                %26lt;/asp:rEgularexpressionvalidator%26gt;                                        <br/>            %26lt;/td%26gt;<br/>        %26lt;/tr%26gt;<br/>        %26lt; ! --------------User code ends--------------------------------------------------------%26gt;<br/>        <br/>        %26lt; ! --------------Password of test and verify begins--------------------------------------------------------%26gt;<br/>        %26lt;tr Bgcolor=#ffffff%26gt;<br/>            %26lt;td Width=60%26gt;<br/>                Password of test and verify<br/>            %26lt;/td%26gt;<br/>            %26lt;td Width=300%26gt;<br/>                %26lt;asp:TExtBox Id=txtPassword1 Maxlength=10 Columns=10<br/>                     Textmode=Password Runat=server%26gt;%26lt;/asp:TExtBox%26gt;<br/>                %26lt;font Color=red%26gt;*%26lt;/font%26gt;<br/>            %26lt;/td%26gt;<br/>            %26lt;td Width=240%26gt;<br/>                Input a password again.<br/>                %26lt;asp:cOmparevalidator Id= "comPassword" Display=Dynamic<br/>                 Controltocompare= %26quot;txtPassword%26quot; Controltovalidate= %26quot;txtPassword1%26quot; Runat=Server%26gt;<br/>                    The password that types twice is different!<br/>                %26lt;/asp:cOmparevalidator%26gt;<br/>            %26lt;/td%26gt;<br/>        %26lt;/tr%26gt;<br/>        %26lt; ! --------------Password of test and verify ends--------------------------------------------------------%26gt;<br/><br/>        %26lt; ! --------------Email begins--------------------------------------------------------%26gt;<br/>        %26lt;tr Bgcolor=#ffffff%26gt;<br/>            %26lt;td Width=60%26gt;<br/>                Email<br/>            %26lt;/td%26gt;<br/>            %26lt;td Width=300%26gt;<br/>                %26lt;asp:TExtBox Id= %26quot;txtEmail%26quot; Maxlength=100 Columns=30 Runat=server%26gt;%26lt;/asp:TExtBox%26gt;<br/>            %26lt;/td%26gt;<br/>            %26lt;td Width=240%26gt;<br/>                Your email address,You need not be filled,But do not fill why please.<br/>                %26lt;asp:rEgularexpressionvalidator Id= "regEmail" Display=Dynamic<br/>                    Controltovalidate= %26quot;txtEmail%26quot; Validationexpression= %26quot;[^']*%26quot; Runat=Server%26gt;<br/>                    Illegal character<br/>                    %26lt;/asp:rEgularexpressionvalidator%26gt;<br/>            %26lt;/td%26gt;<br/>        %26lt;/tr%26gt;<br/>        %26lt; ! --------------Email ends--------------------------------------------------------%26gt;<br/><br/>        %26lt; ! --------------Individual homepage begins--------------------------------------------------------%26gt;<br/>        %26lt;tr Bgcolor=#ffffff%26gt;<br/>            %26lt;td Width=60%26gt;<br/>                Individual homepage<br/>            %26lt;/td%26gt;<br/>            %26lt;td Width=300%26gt;<br/>                %26lt;asp:TExtBox Id= %26quot;txtHomepage%26quot; Maxlength=150 Columns=30 Runat=server%26gt;%26lt;/asp:TExtBox%26gt;<br/>            %26lt;/td%26gt;<br/>            %26lt;td Width=240%26gt;<br/>                Your homepage,You need not be filled,But do not fill why please.<br/>                %26lt;asp:rEgularexpressionvalidator Id= "regHomepage" Display=Dynamic<br/>                    Controltovalidate= %26quot;txtHomepage%26quot; Validationexpression= %26quot;[^']*%26quot; Runat=Server%26gt;<br/>                Illegal character.<br/>                %26lt;/asp:rEgularexpressionvalidator%26gt;<br/>            %26lt;/td%26gt;<br/>        %26lt;/tr%26gt;<br/>        %26lt; ! --------------Individual homepage ends--------------------------------------------------------%26gt;<br/><br/>        %26lt; ! --------------Autograph begins--------------------------------------------------------%26gt;<br/>        %26lt;tr Bgcolor=#ffffff%26gt;<br/>            %26lt;td Width=60%26gt;<br/>                Autograph<br/>            %26lt;/td%26gt;<br/>            %26lt;td Width=300%26gt;<br/>                %26lt;asp:TExtBox Id= %26quot;txtSignature%26quot; Maxlength=150 Columns=30 Rows=6 Textmode=MultiLine Runat=server%26gt;%26lt;/asp:TExtBox%26gt;<br/>            %26lt;/td%26gt;<br/>            %26lt;td Width=240 Valign=top%26gt;<br/>                %26lt;div Id= %26quot;divPreview%26quot; %26gt;<br/>                The sign one's name that you can make yourself,Do not exceed 255 character,Cannot use Script.%26lt;br%26gt;%26lt;br%26gt;<br/>                %26lt;/div%26gt;%26lt;br%26gt;<br/>                <br/>                %26lt;input Type=button Id= %26quot;btnPreview%26quot; Value= %26quot; previews %26quot; Onclick= %26quot;OnPreview()%26quot; %26gt;%26lt;br%26gt;<br/>                %26lt;asp:rEgularexpressionvalidator Id=Regularexpressionvalidator2 Display=Dynamic<br/>                    Controltovalidate= "txtSignature" Validationexpression= "[^']{0, 255}%26quot; Runat=Server%26gt;<br/>                Use illegal character or exceed 255 character.<br/>                %26lt;/asp:rEgularexpressionvalidator%26gt;<br/>            %26lt;/td%26gt;<br/>        %26lt;/tr%26gt;<br/>        %26lt; ! --------------Autograph ends--------------------------------------------------------%26gt;<br/>        <br/>        %26lt;tr Bgcolor=#ffffff%26gt;<br/>            %26lt;td Colspan=3 Align=center%26gt;<br/>                %26lt;asp:bUtton Id= "btnSubmit" Text= " affirms " Onclick= %26quot;OnSubmit%26quot; Runat=Server%26gt;%26lt;/asp:bUtton%26gt;<br/>            %26lt;/td%26gt;<br/>        %26lt;/tr%26gt;<br/>    %26lt;/table%26gt;%26lt;br%26gt;%26lt;br%26gt;%26lt;br%26gt;<br/>%26lt; ! ----------------------------------New user registers an end----------------------%26gt;<br/><br/>   %26lt; ! -------------------Right sets upright a line----------------------------------------------%26gt;<br/>     %26lt;td Bgcolor='#0097c0' Width='1'%26gt;<br/>       %26lt;img Src='http://www.knowsky.com/images/Shim.gif' Width=1%26gt;<br/>      %26lt;/td%26gt;<br/>   %26lt; ! -------------------Right sets upright a line----------------------------------------------%26gt;<br/>    %26lt;/tr%26gt;<br/>    <br/>    %26lt; ! -------------------Below horizontal line----------------------------------------------%26gt;<br/>    %26lt;tr%26gt;<br/>     %26lt;td Colspan=3 Height=1 Bgcolor=#0097c0%26gt;%26lt;img Src='http://www.knowsky.com/images/Shim.gif'width=1 Height=1%26gt;%26lt;/td%26gt;    <br/>    %26lt;/tr%26gt;<br/>    %26lt; ! -------------------Below horizontal line----------------------------------------------%26gt;<br/>%26lt;/table%26gt;<br/><br/>    %26lt;My:bOttom Id= %26quot;myBottom%26quot; Runat= %26quot;server%26quot; %26gt;%26lt;/My:bOttom%26gt;<br/>    %26lt;/form%26gt;<br/>  %26lt;/BODY%26gt;%26lt;/HTML%26gt;<br/><br/>%26lt; ! --------------------The file ends---------------------------------%26gt;<br/><br/>    How,Look to be familiar with very much,Besides the page two first are reached below the Webcontrol that Runat=server takes in Webform,Mix common Html is same?Notice page head the first medium Codebehind= "Register.cs" ,It appoints the code file at the back of this page is Register.cs,This is a kind of mechanism that Asp.net provides,It can conceal business logic in as homonymic as.aspx Cs file,And when moving compile this Cs document first,Such not only can improve moving efficiency,Also make code is concealed,The problem that source leak place creates as a result of systematic flaw in avoiding Asp.So,This code file that includes business logic is what kind of?This file is below:<br/>Namespace Bbs<br/>{<br/>    Using System;<br/>    Using System.Collections;<br/>    Using System.ComponentModel;<br/>    Using System.Data.SQL;<br/>    Using System.Drawing;<br/>    Using System.Web;<br/>    Using System.Web.SessionState;<br/>    Using System.Web.UI;<br/>    Using System.Web.UI.WebControls;<br/>    Using System.Web.UI.HtmlControls;<br/>    Using Bbs.uctrl;<br/>    / / Using Bbs.MyClass;<br/>    Using MyOwnClass;<br/><br/>    / / / %26lt;summary%26gt;<br/>    / / /   Summary Description For Register. <br/>    / / / %26lt;/summary%26gt;<br/>    Public Class Register: System.Web.UI.Page<br/>    {<br/>        Protected System.Web.UI.WebControls.Button BtnSubmit;<br/>        Protected System.Web.UI.WebControls.TextBox TxtHomepage;<br/>        Protected System.Web.UI.WebControls.TextBox TxtEmail;<br/>        Protected System.Web.UI.WebControls.CompareValidator ComPassword;<br/>        Protected System.Web.UI.WebControls.TextBox TxtPassword1;<br/>        Protected System.Web.UI.WebControls.RegularExpressionValidator Regularexpressionvalidator1;<br/>        Protected System.Web.UI.WebControls.RequiredFieldValidator Requiredfieldvalidator1;<br/>        Protected System.Web.UI.WebControls.TextBox TxtPassword;<br/>        Protected System.Web.UI.WebControls.CustomValidator CusUserName;<br/>        Protected System.Web.UI.WebControls.RegularExpressionValidator RegUserName;<br/>        Protected System.Web.UI.WebControls.RequiredFieldValidator ReqUserName;<br/>        Protected System.Web.UI.WebControls.Label LblMessage;<br/>        Protected System.Web.UI.WebControls.TextBox TxtUserName;<br/>        Public MyHead MyHead1;<br/><br/>        / / tectonic function<br/>        Public Register()<br/>        {<br/>            Page.Init += New System.EventHandler(Page_Init);<br/>        }<br/><br/>        Protected Void Page_Load(object Sender, eventArgs E)<br/>        {<br/>            If (! IsPostBack)<br/>            {<br/>                / /<br/>                / / Evals True First Time Browser Hits The Page<br/>                / /<br/>            }<br/>        }<br/><br/>        Protected Void Page_Init(object Sender, eventArgs E)<br/>        {<br/>            / /<br/>            / / CODEGEN: This Call Is Required By The ASP+ Windows Form Designer. <br/>            / /<br/>            InitializeComponent();<br/>            This.myHead1.Position = 2;<br/>        }<br/><br/>        / / / %26lt;summary%26gt;<br/>        / / /   Required Method For Designer Support - Do Not Modify<br/>        / / /   The Contents Of This Method With The Code Editor. <br/>        / / / %26lt;/summary%26gt;<br/>        Private Void InitializeComponent()<br/>        {<br/>            This.Load += New System.EventHandler (this.Page_Load);<br/>        }<br/><br/>        / / whether does the user that monitor exist<br/>        Public Bool ValidUser(Object Sender, string Value)<br/>        {<br/>            BBSUser MyUser = New BBSUser() ;<br/>            Bool BExists;<br/>            Try<br/>            {<br/>                BExists = MyUser.GetUser(this.txtUserName.Text) ;            <br/>            }<br/>            Catch(Exception E)       / / if appear unusual<br/>            {<br/>#if DEBUG<br/>                Response.Write (e.Message) ;<br/>                Return False;<br/>#endif<br/>                Server.Transfer("error.aspx" ) ;<br/>                <br/>            }    <br/>                <br/>            Return! BExists;            <br/>        }<br/><br/>        / / refer pushbutton to click<br/>        Public Void OnSubmit(Object Sender, eventArgs E)<br/>        {<br/>            If (Page.IsValid)<br/>            {<br/>                / / data put in storage<br/>                Try<br/>                {<br/>                    BBSUser MyUser = New BBSUser() ;<br/>                    If(! MyUser.GetUser(txtUserName.Text) )<br/>                    {<br/>                        MyUser.CreateUser(BBSUser.CreateType.Create, txtUserName.Text, txtPassword.Text, <br/>                                        TxtEmail.Text, txtHomepage.Text, "" ) ;<br/>                    }<br/>                }<br/>                Catch(Exception Exp)<br/>                {<br/>#if DEBUG<br/>                    Response.Write (" appears unusual:"+ Exp.Message) ;<br/>                    Return;<br/>#endif//DEBUG<br/>                    Server.Transfer("error.aspx" ) ;<br/>                }<br/>            }<br/>        }<br/><br/>                    <br/>    }<br/><br/>}<br/><br/>   What?Still look at look familiar?Right,Mix in front I define that kind about the same?Be,Original Asp.net regards this page as namely an object,That code that notices kind of definition:Public Class Register: System.Web.UI.Page,In front you are understandable,It is to define target of a Register,That: 篩stem.Web.UI.Page of 腟 of adept of lotus root Zhu is what meaning?It shows this Regsiter kind it is System.Web.UI.Page kind derive kind (subclass) ,That is to say Register kind besides him member variable, attribute, method,Successive still System.Web.UI.Page kind all and communal (Public) or protection (Protected) member variable, attribute and method.Understood these,You can set your mind at to sit to study code,Had done below prepare about expressing the study of content of odd test and verify.<br/><br/><br/>...]]></description><category>Asp Tutorials</category><comments>http://teachmeasp.net/post/377.html#comment</comments><wfw:comment>http://teachmeasp.net/</wfw:comment><wfw:commentRss>http://teachmeasp.net/feed.asp?cmt=377</wfw:commentRss><trackback:ping>http://teachmeasp.net/cmd.asp?act=tb&amp;id=377&amp;key=d54e58bc</trackback:ping></item><item><title>Contact ASP.Net(5 intimately)</title><author>a@b.com (rain)</author><link>http://teachmeasp.net/post/319.html</link><pubDate>Tue, 03 Mar 2009 09:37:52 +0800</pubDate><guid>http://teachmeasp.net/post/319.html</guid><description><![CDATA[We basically are this one to should tell DataBind,This is very important in ASP.net east east,Almost all accusing an operation that needs it to dominate data.Also can say the data core that is ASP.net.<br/><br/>We see a simple case first:<br/><br/>%26lt;% @ Page Language= %26quot;C#%26quot; %%26gt;<br/>%26lt;% @ Import Namespace= %26quot;System.Data%26quot; %%26gt;<br/>%26lt;Script Language= %26quot;C#%26quot; Runat= %26quot;Server%26quot; %26gt;<br/>Public Void Page_Load(Object Src, eventArgs E)<br/>{<br/>   / / build an array above all<br/>   ArrayList Arr=new ArrayList();<br/>   " ); of Arr.Add(" flying knife<br/>   Arr.Add("Zsir" );<br/>   " ); of Arr.Add(" gale<br/>   " ); of Arr.Add(" flummery<br/>   Arr.Add(" inferior " ); of a person of extraordinary powers<br/><br/>   / / bind array DropDownList to accuse go up<br/>   DDL.DataSource = Arr;<br/>   DDL.DataBind();<br/>}<br/>%26lt;/script%26gt;<br/>%26lt;html%26gt;<br/>%26lt;head%26gt;<br/>%26lt;title%26gt;%26lt;/title%26gt;<br/>%26lt;/head%26gt;<br/>%26lt;body%26gt;<br/>%26lt;asp:DRopDownList Id= %26quot;DDL%26quot; Runat= %26quot;server%26quot; /%26gt;<br/>%26lt;/body%26gt;<br/>%26lt;/html%26gt;<br/><br/>Final indication is: <br/><br/>   Flummery of gale of flying knife Zsir inferior a person of extraordinary powers<br/><br/>We can see in code we built a DropDownList,But he does not have %26lt;asp:LIstItem%26gt; attribute, and the option that we still can see we list from inside final indication.<br/><br/>We are here with the result of DataBind,In Page_Load method we built an array (ArrayList) , bound DropDownList to accuse through DataBind method in,Make DropDownList final data shows:) ,How to have certain perceptual knowledge to Bind.We begin to explain formally below<br/><br/>Actually DataBind() ,Can be opposite not only accuse undertake binding,And still can be opposite the attribute in the page,The method undertakes binding,Whole even page can be bound.For instance,Call Page.DataBind() method to perhaps use DataBind() directly,So whole page will be bound,All data are completely under surveillance.The example below,We come to use DataBind method bind DropDownList,Obtain among them data<br/><br/>%26lt;% @ Page Language= %26quot;C#%26quot; %%26gt;<br/>%26lt;% @ Import Namespace= %26quot;System.Data%26quot; %%26gt;<br/>%26lt;Script Language= %26quot;C#%26quot; Runat= %26quot;Server%26quot; %26gt;<br/>Public Void Sub_Click(Object Sender, eventArgs E)<br/>{<br/>Page.DataBind();<br/>}<br/>%26lt;/script%26gt;<br/>%26lt;html%26gt;<br/>%26lt;head%26gt;<br/>%26lt;title%26gt;%26lt;/title%26gt;<br/>%26lt;/head%26gt;<br/>%26lt;body%26gt;<br/>%26lt;form Runat=server%26gt;<br/>  %26lt;asp:DRopDownList Id= %26quot;DDL%26quot; Runat= %26quot;server%26quot; %26gt;<br/>  %26lt;asp:LIstItem%26gt;ASP technology %26lt;/asp:LIstItem%26gt;<br/>  %26lt;asp:L%26lt;/asp:L of IstItem Selected%26gt;ASP.Net technologyIstItem%26gt;<br/>  %26lt;asp:LIstItem%26gt;JSP technology %26lt;/asp:LIstItem%26gt;<br/>  %26lt;asp:LIstItem%26gt;PHP technology %26lt;/asp:LIstItem%26gt;<br/>  %26lt;asp:L%26lt;/asp:L of IstItem%26gt; component technologyIstItem%26gt;<br/>  %26lt;/asp:DRopDownList%26gt;<br/>%26lt;br%26gt;<br/>What you choose now is: %26Area of Lt;font Color=red%26gt;%26lt;%# DDL.SelectedItem.Text %%26gt;%26lt;/font%26gt;<br/>%26lt;br%26gt;<br/>%26lt;asp:BUtton Id= %26quot;sub%26quot; Text= %26quot; refers %26quot; Type= %26quot;submit%26quot; Runat=server OnClick= %26quot;sub_Click%26quot; /%26gt;<br/>%26lt;/form%26gt;<br/>%26lt;/body%26gt;<br/>%26lt;/html%26gt;<br/><br/>After carrying out,We choose JSP technology we click " to refer " pushbutton, seeing a case is: <br/><br/>  Technology of component of technology of PHP of technology of JSP of technology of ASP technology ASP.Net<br/>What you choose now is: JSP technology division<br/> <br/><br/><br/><br/><br/><br/>We see,Of that red [JSP technology] , we accuse without use what,But he however can correct indication our choice result,This is the result that binds,Notice %26lt;%# DDL.SelectedItem.Text %%26gt; this word,Be it let us obtain the data that bind.It looks the %26lt;%= that is familiar with like us. . . %%26gt; this statement,Their use method photograph is about the same,It is %26lt;%= only. . . %%26gt; is call when the program is carried out,%26lt;%# . . . %%26gt; is be called after DataBind() method.The figure that we often still can see him after,Breathe out ah.<br/><br/>Receive Bind accuse,Have DropDownList commonly, dataList, dataGrid, listBox of these gather property accuse,And what be bound basically is ArrayList(array) , hashtable(breaths out rare watch) , ) of DataView(data view, dataReader these four,Later we are OK check the number is entered,Won't appear what DataTable is bound is wrong:)<br/><br/>Tell Bind,Cannot say DataBinder.Eval() method. <br/><br/>We are using DataBind, acquisition data,The system can be its acquiesce String (string) ,This is right we at ordinary times output shows offerred huge to go to the lavatory,But we are not need String kind every time,Sometimes we need Boolean, these Int32 types.Right now we needed to transform a type.What everybody thinks of the likelihood first most is String.Format method,This is best,But usage is too irritated.So had better not such.We can use DataBinder.Eval() method,His format is: <br/><br/>DataBinder.Eval(Container.DataItem, "The type " of changeover, "Format " )<br/><br/>" of format of the last " is optional,Need not be in charge of him commonly,Container.DataItem is the data that bind, "Changing what type " points to is Integer, string, boolean this kind of thing. <br/><br/>Had it,Our processing data is more convenient<br/><br/>We see a case finally,About DataView bind,Breathe out ah,Often use DropDownList irritated,Use DataGrid this, in this example we can see how refine becomes " table "<br/><br/>%26lt;% @ Page Language= %26quot;C#%26quot; %%26gt;<br/>%26lt;% @ Import Namespace= %26quot;System.Data%26quot; %%26gt;<br/>%26lt;Script Language= %26quot;C#%26quot; Runat= %26quot;Server%26quot; %26gt;<br/>Public Void Page_Load(Object Src, eventArgs E)<br/>{<br/>Int I;<br/>/ / build watch data<br/>DataTable Dt=new DataTable();<br/>DataRow Dr;<br/>/ / establish Column precedent,Can the type of demonstrate exemple, what use here is acquiescent String<br/>" )); of number of Dt.Columns.Add(new DataColumn("<br/>Name of user of Dt.Columns.Add(new DataColumn(" " ));<br/>For(i=1;i%26lt;8;i++ )<br/>{<br/>Dr=dt.NewRow();<br/>Dr[0]=Int32.ToString(i);<br/>Dr[1]= "aspcn" +Int32.ToString(i);<br/>Dt.Rows.Add(dr);<br/>}<br/>/ / bind<br/>DG1.DataSource = New DataView(dt);<br/>DG1.DataBind();<br/><br/><br/>}<br/>%26lt;/script%26gt;<br/>%26lt;html%26gt;<br/>%26lt;head%26gt;<br/>%26lt;title%26gt;%26lt;/title%26gt;<br/>%26lt;/head%26gt;<br/>%26lt;body%26gt;<br/>%26lt;asp:DAtaGrid Id= %26quot;DG1%26quot; Runat=server Align=center HeaderStyle-BackColor= %26quot;#aaaadd%26quot; /%26gt;<br/><br/>%26lt;/body%26gt;<br/>%26lt;/html%26gt;<br/><br/>The case that we see is: Number User name  <br/>1 Aspcn1  <br/>2 Aspcn2  <br/>3 Aspcn3  <br/>4 Aspcn4  <br/>5 Aspcn5  <br/>6 Aspcn6  <br/>7 Aspcn7  <br/><br/><br/>About this program I did not say more,There is a specification in the program, just should notice of Bind is DataView here,Not be DataTable,This is a mistake that often makes:)<br/><br/>Told to our foundation,Everybody wants great go be familiar with Web to accuse,Otherwise later of not know what is said:)<br/><br/>From the back,We will spend a few sections to talk,Of the database call. <br/><br/> <br/>...]]></description><category>Asp Tutorials</category><comments>http://teachmeasp.net/post/319.html#comment</comments><wfw:comment>http://teachmeasp.net/</wfw:comment><wfw:commentRss>http://teachmeasp.net/feed.asp?cmt=319</wfw:commentRss><trackback:ping>http://teachmeasp.net/cmd.asp?act=tb&amp;id=319&amp;key=3f2008a1</trackback:ping></item></channel></rss>
