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

ASP.netÁ¬½ÓExcel

Ê×ÏÈÌí¼ÓÃüÃû¿Õ¼ä
using System.Data.OleDb;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
strfile = Request.QueryString["filename"];//´ÓÆäËûÒ³Ãæ´«¹ýÀ´µÄÎļþ·¾¶
Excel(strfile);
}
}

private void Excel(string filepath)
{
try
{
Dataset ds = new DataSet();
string ConnStr = "Provider=Microsoft.Jet.OleDb.4.0;data source=" + filepath +
";Extended Properties='Excel 8.0; HDR=YES; IMEX=1'";//Á¬½ÓExcelµÄ×Ö·û´®
string query = "SELECT * from [student$]";//ExcelÖеıíÃû³Æ
OleDbCommand oleCommand = new OleDbCommand(query, new OleDbConnection(ConnStr));
OleDbDataAdapter oleAdapter = new OleDbDataAdapter(oleCommand);
oleAdapter.Fill(ds, "[student$]");
rowcount = ds.Tables[0].Rows.Count;
gridview1.DataSource = ds;
gridview1.DataBind();
lblmes.Text = "ÉÏ´«³É¹¦£¬Êý¾ÝÈçÏÂËùʾ£¬ÇëÈ·ÈÏ£º";//lblmesΪlabel£¬ÏÔʾÌáʾÐÅÏ¢
}
catch (OleDbException)
{
string filename = filepath.Substring(filepath.LastIndexOf('/') + 1);
lblmes.Text = "´íÎó£¡ÇëÈ·ÈÏÉÏ´«ÎļþÊÇ·ñÕýÈ·£¡µ±Ç°ÉÏ´«µÄÎļþΪ£º" + filename;
lbtnSure.Visible = false;
}
catch(Exception ee)
{
lblmes.Text = ee.Message;
}
}


Ïà¹ØÎĵµ£º

ASP.NET 2.0»º´æ

Ò»¡¢Ò³Êä³ö»º´æ
1.ÉèÖÃ ASP.NET
Ò³»º´æµÄÁ½ÖÖ·½Ê½
1.1
ÒÔÉùÃ÷·½Ê½ÉèÖà ASP.NET Ò³µÄ»º´æ
ÒÔÉùÃ÷·½Ê½ÉèÖà ASP.NET
Ò³µÄ»º´æµÄ·½·¨ÊÇÔÚÒ³ÖÐʹÓà @ OutputCache Ö¸ÁËüµÄ³£ÓÃÊôÐÔÈçÏ£º
³ÌÐò´úÂë
<%@ OutputCache Duration="" VaryByParam=""
VaryByControl="" VaryByHeader ......

asp.net Ò³Ãæ´«Öµ

Ö±½Ó»ñµÃÒ³Ãæ²ÎÊý£º
if(!IsPostBack) {   //ÅжÏÊÇ·ñÊǵÚÒ»´Î¼ÓÔØ´°Ìå
}
if(Page.PreviousPage!=null){                           // ÅжÏÉÏÒ»Ò³ÃæµÄ°´Å¥ÊÇ· ......

ÔÚ ASP.NET ÍøÒ³Öв»¾­¹ý»Ø·¢¶øʵÏÖ¿Í»§¶Ë»Øµ÷

ÔÚ ASP.NET ÍøÒ³Öв»¾­¹ý»Ø·¢¶øʵÏÖ¿Í»§¶Ë»Øµ÷
ÔÚ ASP.NET ÍøÒ³µÄĬÈÏÄ£ÐÍÖУ¬Óû§»áÓëÒ³½»»¥£¬µ¥»÷°´Å¥»òÖ´Ðе¼Ö»ط¢µÄһЩÆäËû²Ù×÷¡£´Ëʱ½«ÖØд´½¨Ò³¼°Æä¿Ø¼þ£¬²¢ÔÚ·þÎñÆ÷ÉÏÔËÐÐÒ³´úÂ룬ÇÒа汾µÄÒ³±»³ÊÏÖµ½ä¯ÀÀÆ÷¡£µ«ÊÇ£¬ÔÚÓÐЩÇé¿öÏ£¬ÐèÒª´Ó¿Í»§¶ËÔËÐзþÎñÆ÷´úÂ룬¶ø²»Ö´Ðлط¢¡£Èç¹ûÒ³ÖеĿͻ§¶Ë½Å±¾Î¬»¤Ò»Ð©×´Ì¬ ......

ÈçºÎÔÚ ASP.NET ÍøÒ³ÖÐʵÏֻص÷

ÈçºÎ£ºÔÚ ASP.NET ÍøÒ³ÖÐʵÏֻص÷
ÔÚ¿Í»§¶Ë»Øµ÷ÖУ¬¿Í»§¶Ë½Å±¾º¯Êý»áÏò ASP.NET ÍøÒ³·¢ËÍÇëÇ󣬸ÃÍøÒ³Ëæºó»áÔËÐÐÆäÕý³£ÉúÃüÖÜÆڵļò»¯°æ±¾ÒÔ´¦Àí¸Ã»Øµ÷¡£ÈôҪȷ±£»Øµ÷ʼþÔ´ÓÚÔ¤ÆÚµÄÓû§½çÃæ (UI)£¬¿ÉÒԶԻص÷½øÐÐÑéÖ¤¡£Ôڻص÷ÑéÖ¤ÖУ¬Ó¦ÏÈÔÚÍøÒ³³ÊÏÖ¹ý³ÌÖÐ×¢²áÒªÑéÖ¤µÄʼþ£¬È»ºóÔڻص÷¹ý³ÌÖжԸÃʼþ½øÐÐÑéÖ¤¡£Óйػص÷µ ......

.net½Ì³Ì:Asp.net ÖÐClientIDµÄÓ÷¨Ì½ÌÖ

¹ØÓÚClientIDµÄʹÓÃÎÒÓöµ½Ò»ÏÂÎÊÌ⣺
»ñÈ¡ÓÉ ASP.NET Éú³ÉµÄ·þÎñÆ÷¿Ø¼þ±êʶ·û¡£
ÎÊÌâÒ»£º Óû§¿Ø¼þµÄÒ³ÃæJavaScriptÖÐÐèҪʹÓÃAsp.netµÄ¿Ø¼þID£¬³öÏÖ²»Ò»Ö¡£
ÎÊÌâ¶þ£ºÄ¸°æÒ³µÄ×ÓÒ³ÃæJavaScriptÖÐÐèҪʹÓÃAsp.netµÄ¿Ø¼þID£¬³öÏÖ²»Ò»Ö¡£
½â¾ö°ì·¨£º
      document.getElementById("<% ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ