Tuesday, March 03, 2009 by rain
本文以Adrotator控件使用的XML为例(新手可以先看一下Adrotator控件的用法),写出了一个广告管理程序。这个程序,飞刀用到的控件主要是DataGrid,可以说已经用到了DataGrid几乎全部功能,大家在关注XML的同时,可以同时学到DataGrid使用方法。
先将本例中使用的一些方法对大家说明一下:
DataSet主要是使用的ReadXml与WriteXml方法。它们的功能看名字就知道了,飞刀也不罗嗦了。
DataGrid中使用的了很多的方法和对象。比如分页使用AllowPaging属性,排序使用AllowSorting属性,本例中使用了所有DataGrid中的事件,比如OnItemCommand,OnEditCommand,OnCancelCommand, OnUpdateCommand等。
...
Posted in Asp.net Tutorials | Tags:
Tuesday, March 03, 2009 by rain
Learn a purpose:Learn the use of SESSION and COOKIE
The variable between each webpages is delivered and of user of a few records land information to want to use SESSION and COOKIE.Bother a a little bit a little in COOKIE is used to compare ASP in ASP.NET,Because we want to declare variable.
...
Posted in Asp.net Tutorials | Tags:
Tuesday, March 03, 2009 by rain
Although say the cent page of DATAGRID shows efficiency not very is tall,But after all,It is the most convenient cent page shows,Be being returned to making a visitors' book is quite simple and practical.Still have a significant demand to enabling the function that distribute a page,Can accuse in DATADRID only the ability below the circumstance that data source realized ICOLLECTION interface enables the function that distribute a page,And DATAREADER does not have this interface,Must use DATATABLE to replace so.
%26lt;script Runat=%26quot;server%26quot; Language=%26quot;c#%26quot;%26gt;Void Page_Load()
{String StrConnection="Provider=Microsoft.Jet.OleDb.4.0;Data Source=";StrConnection+=Server.MapPath("guestbook.mdb");
OleDbConnection ObjConnection=new OleDbConnection(strConnection);
OleDbDataAdapter ObjDataAdapter=new OleDbDataAdapter("select * From Guestbook" , objConnection);
DataSet ObjDataSet=new DataSet();ObjDataAdapter.Fill(objDataSet);DgrdMain.DataSource=objDataSet;DgrdMain.DataBind();
}Void DgrdMain_PageIndexChanged(Object Sender, dataGridPageChangedEventArgs E)
{DgrdMain.CurrentPageIndex = E.NewPageIndex;
DataBind();
}
%26lt;/script%26gt;
%26lt;html%26gt;
%26lt;body%26gt;
%26lt;asp:DAtaGridId="dgrdMain "Cellpadding="1 "Showheader="true "Borderwidth="0 "Allowpaging="true" enables the function that distribute a pageEach page of Pagesize="3" shows three recordsOnpageindexchanged="dgrdMain_pageindexchanged " calls the function of × page to be DgrdMain_PageIndexChanged()Runat="server "
/%26gt;
%26lt;/body%26gt;
%26lt;/html%26gt;
...
Posted in Asp.net Tutorials | Tags:
Tuesday, March 03, 2009 by rain
Learn a purpose:Preliminary control the use of DATAGRID
It is previously in ASP,We show big batch data often uses a loop to read the kind that takes record part,Code is inserted to show in form,Circular is %26lt;tr%26gt; ,If be minute of page,still need oneself to make,If sort is more complex,good in ASP.NET,All jobs can let DATAGRID do.
...
Posted in Asp.net Tutorials | Tags:
Tuesday, March 03, 2009 by rain
--------------------------------------------------------------------------------Dim ObjConnection As OleDbConnectionDim ObjCommand As OleDbCommandObjConnection=new OleDbConnection(Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath(strDb) )SQL statement " is here, objConnection)ObjConnection.Open()ObjDataReader=objCommand.ExecuteNoQuery()
...
Posted in Asp.net Tutorials | Tags:
Tuesday, March 03, 2009 by rain
Today we for DATAREADER:
String StrConnection="Provider=Microsoft.Jet.OleDb.4.0;Data Source=";StrConnection+=Server.MapPath(strDb);
OleDbConnection ObjConnection=new OleDbConnection(strConnection);
SQL statement " is here, objConnection);ObjConnection.Open();
OleDbDataReader ObjDataReader=objCommand.ExecuteReader();If(objDataReader.Read() )
{Oicq.Text=Convert.ToString(objDataReader["useroicq"]);Homesite.Text=Convert.ToString(objDataReader["usersite"]);Face.SelectedItem.Text=Convert.ToString(objDataReader["userface"]);
}
...
Posted in Asp.net Tutorials | Tags:
Tuesday, March 03, 2009 by rain
The join database that sees ACCESS above all is opened;
String StrConnection="Provider=Microsoft.Jet.OleDb.4.0;Data Source=";StrConnection+=Server.MapPath("*.mdb"); //* is the name of the database
OleDbConnection ObjConnection=new OleDbConnection(strConnection);ObjConnection.Open();
...
Posted in Asp.net Tutorials | Tags:
Tuesday, March 03, 2009 by rain
Learn a purpose:Master WEB to accuse use (two)
Above all I should explain,I these ten days of tutorials just also let everybody have a knowledge to ASP.NET just,I also jumped over a lot of things.There are a lot of people on the net in the tutorial that scolds me to write,Think whats learn ten days won't,The tutorial that saw me or what won't,I think them was to overestimate probably my tutorial.There are a lot of books outside,About ASP and ASP.NET,I see the book outside learn namely.Feel ASP and ASP.NET are not to learn after the hopes everybody can see me namely tutorial that I want to do won't the thing has confidence to learn it next.I want to learn or rely on oneself,The culpable place that each book also has him to write outside,The practice that the key still needs him increases exploration.
...
Posted in Asp.net Tutorials | Tags:
Tuesday, March 03, 2009 by rain
Learn a purpose:Master WEB to accuse use (one)
Probably you can ask,Why to need WEB to accuse?WEB accuses be like VB inside accuse,Can citing of the program anyplace,Revise all attribute,Had it cooperate ability to finish code to depart.Think,If return the HTML that is before to accuse,The content that we need to show a paragraph of database in certain place when us uses %26lt;%= %%26gt; only the code that such certainly will included a program in HTML piece,The purpose with respect to code of short of depart and interface.
Probably you still can ask,Why to want code to depart that?The reason is very simple,Not be the webpage stylist that each programmer is qualification,The set with webpage original stylist can be destroyed when if we need,amending code,It is no-go that,Program code and HTML code mix no-go also to programmer modification code together.Of course,Our webpage stylist also needs to learn WEB one a little bit to accuse the knowledge between.
Will introduce one by one below:
One, Label accuses:
Main attribute:
The text that place of Text label shows
Example:%26lt;asp:LAbel Id=%26quot;lblMessage%26quot; Text=%26quot;aaa%26quot; Runat=%26quot;server%26quot;/%26gt;
Those who need an attention is we cannot omit Runat="server" model of written characters,Still all WEB accuse should include it is among %26lt;form Runat=%26quot;server%26quot;%26gt;%26lt;/form%26gt;
A whole case sees below,In the Text attribute that Label revises inside the program,The indication that changes a webpage with this.
...
Posted in Asp.net Tutorials | Tags:
Tuesday, March 03, 2009 by rain
One, the definition is variable:String of String StrExample; ("aaa" )Character of Char ChrExample; ('a' )Bool BlnExample; Bool (True/false)
Date of DataTime DatExample; ("09/19/2002" )Int IntExample; is integral (32 have symbolic integer)Floating-point of Double DblExample; is counted (number of floating-point of 64 double precision)
Two, all sorts of operation:
Operation of = assignment
+ addition operation
- subtration operation
Operation of * multiplication
/ division operation
% takes modular operation
%26amp;%26amp;Logistic And
| | Logistic Or
! Logistic Not
Three, all sorts of structures:If(condition)
{
}Else
{
}
...
Posted in Asp.net Tutorials | Tags: