Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Asp.NetÉú³É¾²Ì¬Ò³Ãæ

´ÓÊý¾Ý¿âÈ¡³öÊý¾ÝÈ»ºó¶¯Ì¬µÄÉú³Éhtml¾²Ì¬Ò³Ãæ¡£ÕâÖÖ¼¼ÊõÌرðÊÇÔÚÓµÓдóÁ¿Ò³ÃæµÄÍøÕ¾ÖÐÏÔµÄÌرðµÄÖØÒª
¾ßÌå²½ÖèÎÒÏêϸµÄдһÏÂ
1.½¨Á¢¾²Ì¬Ä£°åÒ³Ãæ¡£Ò²¾ÍÊǽ¨Á¢ÆðÄ£°åÒ³ÃæµÄ¼Ü¹¹
2.È»ºó´Óºǫ́Êý¾Ý¿âÖÐÌáÈ¡ÄÚÈÝ£¬½øÐÐÌæ»»
3.°ÑÌæ»»ºóµÄ×Ö·û´®Ð´ÈëÖÐ
ÎÒÒ²°´ÕÕÉÏÃæµÄ˳Ðò×öһϰÉ
Ê×ÏȽ¨Á¢Ò»¸öÄ£°åHtmlÈ¡ÃûModelHtml.htm.ÓÃÓÚ¾²Ì¬Ò³ÃæµÄ²¼¾Ö
<html>
<title></title>
<head></head>
<body>
<table>
<tr>
<td>ArticleTitle<td>
</tr>
<tr>
<td>ArticleContent</td>
</tr>
</table>
<body>
</html>

È»ºó¾ÍÒª´ÓÊý¾Ý¿âÖÐÌáÈ¡Êý¾ÝÁË
ÎÒÒª°ÑÊý¾Ý¿âÖеÄÄÚÈÝÓÃdatalist³ÊÏÖ³öÀ´
½¨Á¢Ò»¸öWebForm£¬È»ºó·ÅÖÃÒ»¸ödatalist¿Ø¼þ
<asp:DataList id="dlist" runat="server" >
<ItemTemplete>
<table>
<tr>
<td>ÎÄÕÂID£º</td><td><%# DataBinder.Eval(Container.DateItem,"ID")%></td>
<td>ÎÄÕ±êÌâ</td><td><%# DataBinder.Eval(Container.DataItem,"Articletitle")%></td>
<td><asp:LinkButton id="linkBtn" runat="server">ת»»¾²Ì¬Ò³Ãæ</td>
<tr>
<table>
</ItemTemplete>
</asp:DataList>

ǰ̨»ù±¾Íê³ÉÁË
ºǫ́µÄ´úÂëÈçÏÂ
 protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
SqlConnection con=new SqlConnection("Data Source=DADI-PC;Initial Catalog=db_test;Persist Security Info=True;User ID=sa;Password=sa");
string strSql = "select * from tb_test where ID='" + DataList1.DataKeys[e.Item.ItemIndex].ToString()+"'";
con.Open();
SqlCommand cmd = new SqlCommand(strSql, con);
SqlDataReader myReader = cmd.ExecuteReader();
myReader.Read();
if(myReader.HasRows)
{
WriteFile(myReader["ArticleTitle"].ToString(), myReader["ArticleContent"].ToString(), myReader["ID"].ToString());
Response.Write("<mce:script type="text/javascript">


Ïà¹ØÎĵµ£º

ѧϰASP.NET + MVC£¨ËÄ£©

Ò».ÕªÒª
¡¡¡¡±¾ÎĽ²½âÔÚActionÖÐÏòView´«µÝModelµÄ¼¸ÖÖ·½Ê½.ÒÔ¼°View»ñÈ¡ModelÒÔºóÈçºÎ±àдÏÔʾÂß¼­.»¹ÏêϸµÄ½éÉÜÁËASP.NET MVC¿ò¼ÜÌṩµÄHtml HelperÀàµÄʹÓü°ÈçºÎΪHtml HelperÀàÌí¼Ó×Ô¶¨ÒåÀ©Õ¹·½·¨.
¡¡¡¡¶þ.³ÐÉÏÆôÏÂ
¡¡¡¡ÉÏһƪÎÄÕÂÖÐÎÒÃÇѧϰÁËController´¦ÀíÒ»´ÎÇëÇóµÄÈ«¹ý³Ì.ÔÚControllerµÄActionÖÐ, »á´«µÝÊý¾Ý¸ ......

XPϲ¿Êðasp.net MVCÓ¦ÓóÌÐò


1.     
±£Ö¤xp»·¾³ÒѾ­°²×°ÓÐ.net framework 3.5 sp1¡¢asp.net mvc 1.0»ò2.0
2.     
ÓÉÓÚiis5.1Ö»ÓÐÒ»¸öĬÈÏÍøÕ¾£¬Òò´ËÏȽ«Ä¬ÈÏÍøÕ¾µÄÆäËûÎļþ·Åµ½ÆäËûλÖ㬽«ÏîÄ¿Îļþ¿½±´µ½Ä¬ÈÏÍøÕ¾ËùÔÚĿ¼£¨Ò»°ãÊÇ£ºC:\Inetpub\wwwroot£©£¬ÐÞ¸ÄÏàÓ¦µÄÁ¬½Ó×Ö·û´®¡£
3.  ......

ASP.NETÃæÊÔÌâ´óÈ«£¨¸½´ð°¸ ¾­µä°æ£©

1. ¼òÊö private¡¢ protected¡¢ public¡¢ internal ÐÞÊηûµÄ·ÃÎÊȨÏÞ¡£
´ð . private : ˽ÓгÉÔ±, ÔÚÀàµÄÄÚ²¿²Å¿ÉÒÔ·ÃÎÊ¡£
protected : ±£»¤³ÉÔ±£¬¸ÃÀàÄÚ²¿ºÍ¼Ì³ÐÀàÖпÉÒÔ·ÃÎÊ¡£
public : ¹«¹²³ÉÔ±£¬ÍêÈ«¹«¿ª£¬Ã»ÓзÃÎÊÏÞÖÆ¡£
internal: ÔÚͬһÃüÃû¿Õ¼äÄÚ¿ÉÒÔ·ÃÎÊ¡£
2 .ÁоÙASP.NET Ò³ÃæÖ®¼ä´«µÝÖµµÄ¼¸ÖÖ·½Ê½¡£
´ ......

vs2005н¨ÏîÄ¿ÖÐûÓÐASP.NET WEBÓ¦ÓóÌÐòµÄ½â¾ö·½·¨

ʹÓÃvs 2005,·¢ÏÖ¸ù±¾´ò²»¿ªÀÏʦ·¢¹ýÀ´µÄÔ´´úÂëPortal_Article.csprojÎļþ,ÉÏÍø²éÁËÒ»ÏÂ,ºÃ¶àÈ˶¼ËµÊÇÊÇÒòΪûÓиøvs
2005´ò²¹¶¡.ÎÒµÄн¨ÏîÄ¿Àï¸ù±¾Ã»ÓÐASP.NET WEBÓ¦ÓóÌÐò,¾­¹ýÒ»¸öÏÂÎçµÄŬÁ¦,ÖÕÓÚ×ܽá³öÁË,½â¾öÎÊÌâµÄ·½·¨.
1.ÏÈ´Ó΢ÈíÍøÕ¾ÏÂÔز¹¶¡.
     ÏÂÔصØÖ·1Ϊ£ºhttp://download.microso ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ