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

ASP.NET¼¼ÇÉ£ºÊ¹ÓÃGridview°ó¶¨Êý¾Ý¿âÖеÄͼƬ

ʹÓÃGridview°ó¶¨Êý¾Ý¿âÖеÄͼƬ
×¢£º´ËϵÁмǼÔÚÎÒʵ¼Ê¿ª·¢ÖÐÓöµ½µÄÎÊÌâºÍÊÕ²ØһЩ¼¼ÇÉÎÄÕ¡£
ÎÒÃǶ¼ÖªµÀ£¬ÔÚGridviewÖв»ÄÜÖ±½ÓÈ¥°ó¶¨Êý¾Ý¿âÖеÄͼƬ£¬ÎÒÃÇ¿ÉÒÔÀûÓÃHttpHandlerºÜÈÝÒ×µÄÍê³ÉÕâ¸öÈÎÎñ£¬ÔÚÕâÀïÎҼǼһÏÂÕâ¸ö¹ý³Ì¡£
1.ÉÏ´«Í¼Æ¬´æ´¢µ½Êý¾Ý¿âÖÐ
ÔÚÊý¾Ý¿âÖд´½¨Ò»¸ö±í£¬Ìí¼ÓÒ»ÏÂ3¸ö×ֶΣº
²½ÖèÒ»£ºÔÚWebÒ³ÃæÖÐÍÏÒ»¸öFileUpload ¿Ø¼þ£¬Ò»¸öÎı¾¿òÓÃÓÚÊäÈëÃû³ÆºÍÌá½»ÉÏ´«°´Å¥
<asp:FileUpload ID="fuImage" runat="server" /><br />
<asp:TextBox ID="txtImageName" runat="server"/><br />
<asp:Button ID="btnUpload" runat="server" onClick="btnUpload_Click" Text="Upload" />
²½Öè¶þ£ºÔÚWeb.ConfigÎļþÄÚÅäÖÃÁ¬½Ó×Ö·û´®¡£
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;
AttachDbFilename=|DataDirectory|\Image.mdf;Integrated Security=True;
User Instance=True" providerName="System.Data.SqlClient"/>
²½ÖèÈý£º°ÑÏÂÃæµÄ´úÂ븴ÖƵ½ÉÏ´«°´Å¥Ê¼þÖС£
protected void btnUpload_Click(object sender, EventArgs e)
{
Stream imgStream = fuImage.PostedFile.InputStream;
int imgLen = fuImage.PostedFile.ContentLength;
string imgName = txtImageName.Text;
byte[] imgBinaryData = new byte[imgLen];
int n = imgStream.Read(imgBinaryData,0,imgLen);

//use the web.config to store the connection string
SqlConnection connection = new SqlConnection(ConfigurationManager.
ConnectionStrings["connectionString"].ConnectionString);
SqlCommand command = new SqlCommand("INSERT INTO Image (imagename,image)
VALUES ( @img_name, @img_data)", connection);

SqlParameter param0 = new SqlParameter("@img_name", SqlDbType.VarChar, 50);
param0.Value = imgName;
command.Parameters.Add(param0);

SqlParameter param1 = new SqlParameter("@img_data", SqlDbType.Image);
param1.Value = imgBinaryData;
command.Parameters.Add(param1);

connection.Open();
int numRowsAffected = command.ExecuteNonQuery();
connection.Close();
}
2.ÀûÓÃHttpHandler´ÓÊý¾Ý¿âÖжÁȡͼƬ
´´½¨Ò»¸öÃû


Ïà¹ØÎĵµ£º

Asp.net×Ô¶¨ÒåÑéÖ¤¿Ø¼þCustomValidator µÄʹÓ÷½·¨

javascript º¯Êý ºÍ CustomValidator¿Ø¼þÏà½áºÏʹÓÃ
<asp:TextBox ID="txtPwdPrompt" runat="server"></asp:TextBox>
<asp:CustomValidator id="CVPwdPrompt" runat="server" ClientValidationFunction="CheckPwd" ControlToValidate="txtPwdPrompt" ErrorMessage="<span style='font:12px'>ÌáʾÎÊÌ ......

asp.netʵÏÖα¾²Ì¬


webconfigα¾²Ì¬
<system.web>
<httpHandlers>
<add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter"/>
<add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter"/>
</httpHandlers>
</system.web> ......

Ó¦ÓÃASP.NET AJAXµÄ×¢ÒâÊÂÏî

 1. ¾µÍ·Ç¨áãÓ¦µ±Ó¦ÓÃʵʩ¾µÍ·Öض¨ÏòµÄResponse.Redirect¶ø²»ÊÇServer.Transfer£¬ÓÉÓÚServer.Transfer²»¸Ä±äIE¿Í»§¶ËURL£¬ÄÜÒÔÖÂASP.NET AJAX¿Í»§¶Ë½Å±¾·ÃÎÊ×ÊÔ´µÄʱ·Ö³öÏÖURL´í´¦¡£
¶þ.ÔÚ·þÎñÆ÷¶ËµÇ¼Ç½Å±¾ºÍÑÚ²Ø×Ö¶ÎÓ¦µ±Ê©ÓÃÖÖScriptManager£¬¶ø²»ÊÇPage.ClientScript¶ÔÏó£¬ÓÉÓÚPage.ClientScriptµÄ²½ÖèÊǽ«½Å±¾µÇ¼Ç ......

ASP.net Membership½ÇÉ«ÓëȨÏÞ¹ÜÀí(ת)

 
±¾ÎÄĿ¼£º
1.membership¼ò½é
2.membershipÔÚsql serverÖеÄÉèÖÃ
3.ÅäÖÃweb.config
4.´´½¨Óû§CreateUserWizard¿Ø¼þ
5.Óû§µÇ¼login¿Ø¼þ
6.ÏÔʾµ±Ç°Óû§µÄÃû³ÆLoginName¿Ø¼þ
7.¼ì²âÓû§µÄÉí·ÝÑé֤״̬µÄLoginStatus¿Ø¼þ
8.Ϊ²»Í¬Àà±ðÓû§³ÊÏÖ²»Í¬ÄÚÈݵÄLoginView¿Ø¼þ
9.¸ü¸ÄÃÜÂëµÄChangePassword¿Ø¼þ
10 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ