??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲日本va在线观看,亚洲中文字幕无码一区二区三区,亚洲一区二区视频在线观看http://www.tkk7.com/Microhelp/category/1816.html君子博学而日参省乎己Q则智明而行无过也?/description>zh-cnTue, 13 May 2008 05:57:18 GMTTue, 13 May 2008 05:57:18 GMT60在asp.net中xmlHttp.responseText的返回值全部是html代码,怎样才能只返回我Response.write的内?/title><link>http://www.tkk7.com/Microhelp/articles/200144.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Tue, 13 May 2008 02:35:00 GMT</pubDate><guid>http://www.tkk7.com/Microhelp/articles/200144.html</guid><wfw:comment>http://www.tkk7.com/Microhelp/comments/200144.html</wfw:comment><comments>http://www.tkk7.com/Microhelp/articles/200144.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/Microhelp/comments/commentRss/200144.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Microhelp/services/trackbacks/200144.html</trackback:ping><description><![CDATA[<p>今天在看ASP.NET AJAXE序设计的时候做W一个例子,用XMLHttpRequest对象异步发送请求,在aspx面的pageload面处理之后用Response.WriteҎq回处理之后的倹{在面上用var isValid = xmlHttp.responseText 获得response的内容的时候,发现内容后面跟了很多html的内宏V我只想获得我response的内宏V处理方法ؓQ在aspx面上删除除了第一句也是<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="FMT.test" %>之外的所有内宏V或者像原来的例子一L接写在页面里面,不要把写在分开的cs文g里。例如:<br /> <br /> </p> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img id="Codehighlighter1_2_22_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2_22_Open_Text.style.display='none'; Codehighlighter1_2_22_Closed_Image.style.display='inline'; Codehighlighter1_2_22_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_2_22_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_2_22_Closed_Text.style.display='none'; Codehighlighter1_2_22_Open_Image.style.display='inline'; Codehighlighter1_2_22_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" alt="" /><span style="color: #000000; background-color: #ffff00"><%</span><span id="Codehighlighter1_2_22_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_2_22_Open_Text"><span style="color: #000000; background-color: #f5f5f5">@ Page Language</span><span style="color: #000000; background-color: #f5f5f5">=</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">C#</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5"> </span></span><span style="color: #000000; background-color: #ffff00">%></span><span style="color: #000000"><br /> <img id="Codehighlighter1_49_524_Open_Image" onclick="this.style.display='none'; Codehighlighter1_49_524_Open_Text.style.display='none'; Codehighlighter1_49_524_Closed_Image.style.display='inline'; Codehighlighter1_49_524_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_49_524_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_49_524_Closed_Text.style.display='none'; Codehighlighter1_49_524_Open_Image.style.display='inline'; Codehighlighter1_49_524_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" alt="" /></span><span style="color: #0000ff"><</span><span style="color: #800000">script </span><span style="color: #ff0000">runat</span><span style="color: #0000ff">="server"</span><span style="color: #0000ff">></span><span id="Codehighlighter1_49_524_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_49_524_Open_Text"><span style="color: #000000; background-color: #f5f5f5"><br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />    protected </span><span style="color: #0000ff; background-color: #f5f5f5">void</span><span style="color: #000000; background-color: #f5f5f5"> Page_Load(object sender, EventArgs e)<br /> <img id="Codehighlighter1_111_523_Open_Image" onclick="this.style.display='none'; Codehighlighter1_111_523_Open_Text.style.display='none'; Codehighlighter1_111_523_Closed_Image.style.display='inline'; Codehighlighter1_111_523_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_111_523_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_111_523_Closed_Text.style.display='none'; Codehighlighter1_111_523_Open_Image.style.display='inline'; Codehighlighter1_111_523_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />    </span><span id="Codehighlighter1_111_523_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_111_523_Open_Text"><span style="color: #000000; background-color: #f5f5f5">{<br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        </span><span style="color: #008000; background-color: #f5f5f5">//</span><span style="color: #008000; background-color: #f5f5f5"> get the candidate user name.</span><span style="color: #008000; background-color: #f5f5f5"><br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000; background-color: #f5f5f5">        string candidateUserName </span><span style="color: #000000; background-color: #f5f5f5">=</span><span style="color: #000000; background-color: #f5f5f5"> Request[</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">UserName</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">];<br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        </span><span style="color: #008000; background-color: #f5f5f5">//</span><span style="color: #008000; background-color: #f5f5f5"> validate</span><span style="color: #008000; background-color: #f5f5f5"><br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000; background-color: #f5f5f5">        bool isValid </span><span style="color: #000000; background-color: #f5f5f5">=</span><span style="color: #000000; background-color: #f5f5f5"> </span><span style="color: #0000ff; background-color: #f5f5f5">false</span><span style="color: #000000; background-color: #f5f5f5">;<br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        </span><span style="color: #0000ff; background-color: #f5f5f5">if</span><span style="color: #000000; background-color: #f5f5f5"> (candidateUserName.ToLower() </span><span style="color: #000000; background-color: #f5f5f5">!=</span><span style="color: #000000; background-color: #f5f5f5"> </span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">dflying</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">)<br /> <img id="Codehighlighter1_330_368_Open_Image" onclick="this.style.display='none'; Codehighlighter1_330_368_Open_Text.style.display='none'; Codehighlighter1_330_368_Closed_Image.style.display='inline'; Codehighlighter1_330_368_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_330_368_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_330_368_Closed_Text.style.display='none'; Codehighlighter1_330_368_Open_Image.style.display='inline'; Codehighlighter1_330_368_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />        </span><span id="Codehighlighter1_330_368_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_330_368_Open_Text"><span style="color: #000000; background-color: #f5f5f5">{<br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            isValid </span><span style="color: #000000; background-color: #f5f5f5">=</span><span style="color: #000000; background-color: #f5f5f5"> </span><span style="color: #0000ff; background-color: #f5f5f5">true</span><span style="color: #000000; background-color: #f5f5f5">;<br /> <img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />        }</span></span><span style="color: #000000; background-color: #f5f5f5"><br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        </span><span style="color: #008000; background-color: #f5f5f5">//</span><span style="color: #008000; background-color: #f5f5f5"> send out result</span><span style="color: #008000; background-color: #f5f5f5"><br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000; background-color: #f5f5f5">        Response.Clear();<br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        Response.Write(isValid </span><span style="color: #000000; background-color: #f5f5f5">?</span><span style="color: #000000; background-color: #f5f5f5"> </span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">true</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5"> : </span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">false</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">);<br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        Response.Flush();<br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" alt="" />    }</span></span><span style="color: #000000; background-color: #f5f5f5"><br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span></span><span style="color: #0000ff"></</span><span style="color: #800000">script</span><span style="color: #0000ff">></span><span style="color: #000000"><br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span></div> <img src ="http://www.tkk7.com/Microhelp/aggbug/200144.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Microhelp/" target="_blank">Microhelp</a> 2008-05-13 10:35 <a href="http://www.tkk7.com/Microhelp/articles/200144.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用Visual Studio.net调试javascript最方便的方?http://www.tkk7.com/Microhelp/articles/200042.htmlMicrohelpMicrohelpMon, 12 May 2008 08:22:00 GMThttp://www.tkk7.com/Microhelp/articles/200042.htmlhttp://www.tkk7.com/Microhelp/comments/200042.htmlhttp://www.tkk7.com/Microhelp/articles/200042.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/200042.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/200042.html  好久不上来写东西了,前一阵子发现一个用VS.net调试javascript的简便方法,比v以前附加IEq程的做法方便多了,做法如下Q首先在IE选项-》高U,禁止脚本调试去掉。然后在需要调试的面的脚本中加上debugger; 然后q行q个面Q就会在q里停下来,下一步怎么做大家应该很熟悉了吧Q?br /> 例如Q?br /> function BtnSubmit_Click()
{
    var aaa;
    aaa='aaa';
    debugger;   //q行到这会停下来
    alert(aaa);
 
}

Microhelp 2008-05-12 16:22 发表评论
]]>
Vs2005中用Ajax(?http://www.tkk7.com/Microhelp/articles/147114.htmlMicrohelpMicrohelpFri, 21 Sep 2007 06:53:00 GMThttp://www.tkk7.com/Microhelp/articles/147114.htmlhttp://www.tkk7.com/Microhelp/comments/147114.htmlhttp://www.tkk7.com/Microhelp/articles/147114.html#Feedback2http://www.tkk7.com/Microhelp/comments/commentRss/147114.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/147114.html阅读全文

Microhelp 2007-09-21 14:53 发表评论
]]>
WebService中如何用soapheaderhttp://www.tkk7.com/Microhelp/articles/26307.htmlMicrohelpMicrohelpMon, 02 Jan 2006 01:57:00 GMThttp://www.tkk7.com/Microhelp/articles/26307.htmlhttp://www.tkk7.com/Microhelp/comments/26307.htmlhttp://www.tkk7.com/Microhelp/articles/26307.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/26307.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/26307.html1. 首先需要在服务中定义一个从 SOAPHeader z的类,表示传入 SOAP 标头的数?
public class SecurityHeader: System.Web.Services.Protocols.SoapHeader
 {
     public string userName;
     public string passWord;
     public string key;

     public SecurityHeader()
     {
     }
 }
2. SecurityHeadercM为webservicecȝ一个属性公开,q在WebMethod里用SecurityHeader
    q样允许客户用这个SoapHeader了?BR>public class Map : System.Web.Services.WebService
 {
      public SecurityHeader keyHeader;
      public Map()
      {
      }

       [WebMethod,SoapHeader("keyHeader")]
      public string HelloWorld()
      {
          //q里我们可以获得客户传来的header值按需要做验证{处?BR>           string keyValue = keyHeader.key ;
           return keyValue;
      }
}

客户端用SoapHeader的方法如下(调用之前先声明webreference MapClientQ:
  MapService.MapClient.SecurityHeader header = new MapService.MapClient.SecurityHeader();
   header.userName = "userName";
   header.passWord = "passWord";
   header.key = "Hello,this is a key....";

   MapClient.Map testClient = new MapService.MapClient.Map();
   testClient.SecurityHeaderValue = header;
   testClient.Credentials = System.Net.CredentialCache.DefaultCredentials;
   string ss = testClient.HelloWorld();



Microhelp 2006-01-02 09:57 发表评论
]]>
RSS是什?/title><link>http://www.tkk7.com/Microhelp/articles/22511.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Mon, 05 Dec 2005 02:40:00 GMT</pubDate><guid>http://www.tkk7.com/Microhelp/articles/22511.html</guid><wfw:comment>http://www.tkk7.com/Microhelp/comments/22511.html</wfw:comment><comments>http://www.tkk7.com/Microhelp/articles/22511.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/Microhelp/comments/commentRss/22511.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Microhelp/services/trackbacks/22511.html</trackback:ping><description><![CDATA[■ 名词解释<BR><BR>  RSS是什么?听说q的不在数Q但能说得清、玩得{的的不多。RSSI竟代表什么呢Q比较普遍的有两U说法,一U是“Rich Site Summary?丰富站点摘要)或“RDF Site Summary?RDF站点摘要)Q另一U是“Really Simple Syndication?真正易聚??BR><BR>  ■ 链接<BR><BR>  RSS之前世今生发源与标准之争<BR><BR>  ?997q_|景公司(Netscape)设计开发出最初的RSS 0.90版本<BR><BR>  ?000q_软g公司UserLand接手RSS 0.91版本的发展,q将其发展ؓ博客写作的基软gQ陆l推Z0.92?.93?.94版本<BR><BR>  ?001q_一个第三方Q非商业l织RSS重新定义为“RDF Site Summary”,q发布RSS 1.0<BR><BR>  ?002q_UserLand公司又将RSS再定义ؓ“Really Simple Syndication”,q发布RSS 2.0<BR><BR>  ?003q_RSS分化为RSS 0.9xQ?.0和RSS 1.0两个阵营QRSSq今没有一个统一的标?BR><BR>  ?005q_微Y甌XML文g(RSS生成文g)标准专利遭拒<BR><img src ="http://www.tkk7.com/Microhelp/aggbug/22511.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Microhelp/" target="_blank">Microhelp</a> 2005-12-05 10:40 <a href="http://www.tkk7.com/Microhelp/articles/22511.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用户控g与服务器控g(?http://www.tkk7.com/Microhelp/articles/19168.htmlMicrohelpMicrohelpThu, 10 Nov 2005 07:33:00 GMThttp://www.tkk7.com/Microhelp/articles/19168.htmlhttp://www.tkk7.com/Microhelp/comments/19168.htmlhttp://www.tkk7.com/Microhelp/articles/19168.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/19168.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/19168.html阅读全文

Microhelp 2005-11-10 15:33 发表评论
]]>
用户控g与服务器控g(一)http://www.tkk7.com/Microhelp/articles/19166.htmlMicrohelpMicrohelpThu, 10 Nov 2005 07:31:00 GMThttp://www.tkk7.com/Microhelp/articles/19166.htmlhttp://www.tkk7.com/Microhelp/comments/19166.htmlhttp://www.tkk7.com/Microhelp/articles/19166.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/19166.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/19166.html用户控g与服务器控g

用户控gl承?SPAN lang=EN-US>System.Web.UI.UserControlc?SPAN lang=EN-US>,保存?SPAN lang=EN-US>ascx文g.创徏Ҏ参见: http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpguide/html/cpconwebformsusercontrols.asp

服务器控件承于Controlc?SPAN lang=EN-US>, 保存?SPAN lang=EN-US>CS文g. 创徏Ҏ参见: http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpguide/html/cpconwebformscontroldevelopmentbasics.asp

 

复合控g与用h?/SPAN>

下表汇M复合控g与用h件之间的差异。有兛_作用h件的详细信息Q请参见 Web H体用户控g?/SPAN>

复合控g

用户控g

创作的最短设计时支持?/SPAN>

创作的完全设计时支持。在可视化设计器中,创作用户控g与创?/SPAN> ASP.NET “Web H体?/SPAN>)没有差别?/SPAN>

以目标ؓ公共语言q行库的面向对象的编E语aQ如 C# ?/SPAN> Visual Basic .NETQ是用编E方式创作的?/SPAN>

使用 ASP.NET 语法和脚本块(或代码隐藏页Q声明性地创作的?/SPAN>

注意   用于创作脚本块的语言是针对公paq行库的面向对象的语aQ如 C#?/SPAN>Visual Basic .NET ?/SPAN> JScript .NETQ但?/SPAN> ASP.NET |架会向开发h员隐藏许多编E细节?/SPAN>

作ؓE序?/SPAN> (.dll) ~译和保持的?/SPAN>

另存为带?/SPAN> .ascx 扩展名的文本文gQ带有可选的代码隐藏文gQ?/SPAN>

非常适于创作一般的可重新发布的控g?/SPAN>

适合应用E序特定的功能?/SPAN>

设计时宿M使用时的完全设计时支持。可以将复合控gd到可视化设计器的工具ƈ拖放到页上?/SPAN>

设计器中的最用支持?/SPAN>



Microhelp 2005-11-10 15:31 发表评论
]]>
用户控g与服务器控g(?http://www.tkk7.com/Microhelp/articles/19167.htmlMicrohelpMicrohelpThu, 10 Nov 2005 07:31:00 GMThttp://www.tkk7.com/Microhelp/articles/19167.htmlhttp://www.tkk7.com/Microhelp/comments/19167.htmlhttp://www.tkk7.com/Microhelp/articles/19167.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/19167.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/19167.html阅读全文

Microhelp 2005-11-10 15:31 发表评论
]]>
ASP.NET配置文gWeb.confighttp://www.tkk7.com/Microhelp/articles/17839.htmlMicrohelpMicrohelpWed, 02 Nov 2005 08:39:00 GMThttp://www.tkk7.com/Microhelp/articles/17839.htmlhttp://www.tkk7.com/Microhelp/comments/17839.htmlhttp://www.tkk7.com/Microhelp/articles/17839.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/17839.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/17839.html

ASP.NET配置文gWeb.config

《长城在Uѝ?/FONT> 2005-1-19 17:06:04


    ?WATERSWEA  一、认识Web.config文g

  Web.config文g是一个XML文本文gQ它用来储存 ASP.NET Web 应用E序的配|信息(如最常用的设|ASP.NET Web 应用E序的n份验证方式)Q它可以出现在应用程序的每一个目录中。当你通过VB.NET新徏一个Web应用E序后,默认情况下会在根目录自动创徏一个默认的
Web.config文gQ包括默认的配置讄Q所有的子目录都l承它的配置讄。如果你想修改子目录的配|设|,你可以在该子目录下新Z个Web.config文g。它可以提供除从父目录承的配置信息以外的配|信息,也可以重写或修改父目录中定义的设|?BR>
  在运行时对Web.config文g的修改不需要重启服务就可以生效Q注Q<processModelQ?节例外)。当然Web.config文g是可以扩展的。你可以自定义新配置参数q编写配|节处理E序以对它们q行处理?

  二、web.config配置文gQ默认的配置讄Q以下所有的代码都应该位?BR>
QconfigurationQ?BR>Qsystem.webQ?/TD>

  ?BR>
Q?system.webQ?BR>Q?configurationQ?/TD>

  之间Q出于学习的目的下面的示例都省略了这DXML标记

  1、<authenticationQ??BR>
  作用Q配|?ASP.NET w䆾验证支持QؓWindows、Forms、PassPort、None四种Q。该元素只能在计机、站Ҏ应用E序U别声明。<authenticationQ?元素必需与<authorizationQ?节配合用?BR>
  CZQ?BR>
  以下CZ为基于窗体(FormsQ的w䆾验证配置站点Q当没有登陆的用戯问需要n份验证的|页Q网自动蟩转到登陆|页?BR>
Qauthentication mode="Forms" Q?
Qforms loginUrl="logon.aspx" name=".FormsAuthCookie"/Q?BR>
Q?authenticationQ?/TD>

  其中元素loginUrl表示登陆|页的名Uͼname表示Cookie名称

  2、<authorizationQ??BR>
  作用Q控制对 URL 资源的客L讉KQ如允许匿名用户讉KQ。此元素可以在Q何别(计算机、站炏V应用程序、子目录或页Q上声明。必需与<authenticationQ?节配合用?BR>
  CZQ以下示例禁止匿名用L讉K

QauthorizationQ?BR> Qdeny users="?"/Q?BR>Q?authorizationQ?/TD>

  注:你可以用user.identity.name来获取已l过验证的当前的用户名;可以使用
web.Security.FormsAuthentication.RedirectFromLoginPageҎ已验证的用户重定向到用户刚才请求的面.具体的实例请参?

  Forms验证 http://www.fanvb.net/websample/dataauth.aspx

  3、<compilationQ节

  作用Q配|?ASP.NET 使用的所有编译设|。默认的debug属性ؓ“True?在程序编译完成交付用之后应其设ؓTrueQWeb.config文g中有详细说明Q此处省略示例)

  4、<customErrorsQ?

  作用Qؓ ASP.NET 应用E序提供有关自定义错误信息的信息。它不适用?XML Web services 中发生的错误?BR>
  CZQ当发生错误Ӟ网蟩转到自定义的错误面?BR>
QcustomErrors defaultRedirect="ErrorPage.aspx" mode="RemoteOnly"Q?BR>Q?customErrorsQ?/TD>

  其中元素defaultRedirect表示自定义的错误|页的名U。mode元素表示Q对不在本地 Web 服务器上q行的用hC定义(友好?信息?BR>
  5、<httpRuntimeQ节

  作用Q配|?ASP.NET HTTP q行库设|。该节可以在计算机、站炏V应用程序和子目录别声明?BR>
  CZQ控制用户上传文件最大ؓ4MQ最长时间ؓ60U,最多请求数?00

QhttpRuntime maxRequestLength="4096" executionTimeout="60" appRequestQueueLimit="100"/Q?/TD>

  6?QpagesQ?BR>
  作用Q标识特定于늚配置讄Q如是否启用会话状态、视囄态,是否用L输入{)。<pagesQ可以在计算机、站炏V应用程序和子目录别声明?BR>
  CZQ不用户在览器输入的内容中是否存在潜在的危险数据Q注Q该w认是,如果你用了不检,一要对用户的输入进行编码或验证)Q在从客L回发|检查加密的视图状态,以验证视囄态是否已在客L被篡攏V?注:该项默认是不验证Q?BR>
Qpages buffer="true" enableViewStateMac="true" validateRequest="false"/Q?/TD>

  7、<sessionStateQ?BR>
  作用Qؓ当前应用E序配置会话状态设|(如设|是否启用会话状态,会话状态保存位|)?BR>
  CZQ?BR>
QsessionState mode="InProc" cookieless="true" timeout="20"/Q?BR>Q?sessionStateQ?/TD>

  注:

  mode="InProc"表示Q在本地储存会话状态(你也可以选择储存在远E服务器或SAL服务器中或不启用会话状态)

  cookieless="true"表示Q如果用h览器不支持Cookie时启用会话状?默认为FalseQ?BR>
  timeout="20"表示Q会话可以处于空闲状态的分钟?BR>
  8、<traceQ?BR>
  作用Q配|?ASP.NET 跟踪服务Q主要用来程序测试判断哪里出错?BR>
  CZQ以下ؓWeb.config中的默认配置Q?BR>
Qtrace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" /Q?/TD>

  注:

  enabled="false"表示不启用跟t;requestLimit="10"表示指定在服务器上存储的跟踪h的数?

  pageOutput="false"表示只能通过跟踪实用工具讉K跟踪输出Q?BR>
  traceMode="SortByTime"表示以处理跟t的序来显Ct信?BR>
  localOnly="true" 表示跟踪查看?(trace.axd) 只用于宿?Web 服务?BR>
  三、自定义Web.config文g配置?BR>
  自定义Web.config文g配置节过E分Z步?BR>
  一是在在配|文仉?QconfigSectionsQ??Q?configSectionsQ标C间声明配|节的名U和处理该节中配|数据的 .NET Framework cȝ名称?BR>
  二是?QconfigSectionsQ?区域之后为声明的节做实际的配|设|?BR>
  CZQ创Z个节存储数据库连接字W串

QconfigurationQ?BR> QconfigSectionsQ?BR> Qsection name="appSettings" type="System.Configuration.NameValueFileSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/Q?BR>Q?configSectionsQ?BR>
 QappSettingsQ?BR>  Qadd key="scon" value="server=a;database=northwind;uid=sa;pwd=123"/Q?BR> Q?appSettingsQ?BR>
 Qsystem.webQ?BR>  ......
 Q?system.webQ?BR>Q?configurationQ?

  四、访问Web.config文g

  你可以通过使用ConfigurationSettings.AppSettings 静态字W串集合来访?Web.config 文gCZQ获取上面例子中建立的连接字W串?BR>
Dim sconstr As String = ConfigurationSettings.AppSettings("SconStr")
Dim scon = New SqlConnection(sconstr)


Microhelp 2005-11-02 16:39 发表评论
]]>
水晶报表的用(二)http://www.tkk7.com/Microhelp/articles/14062.htmlMicrohelpMicrohelpMon, 26 Sep 2005 01:50:00 GMThttp://www.tkk7.com/Microhelp/articles/14062.htmlhttp://www.tkk7.com/Microhelp/comments/14062.htmlhttp://www.tkk7.com/Microhelp/articles/14062.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/14062.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/14062.html导出Q?BR>//********************************************
//
//File Name:     WebExportReport.sln
//Created:       May 17, 2002
//Author ID:     CHO
//Purpose:       This sample application demonstrates how to export your report
//               to the following formats:
//
//               - Rich Text Format (RTF)
//               - Microsoft Word Format (DOC)
//               - Portable Document Format (PDF)
//               - Microsoft Excel (XLS)
//               - Crystal Report (RPT)
//               - HTML 3.2 (HTML)
//               - HTML 4.0 (DHTML) 
//
//********************************************

using System;
using System.IO;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Data.OleDb;

namespace WebExportReport
{
 /// <summary>
 /// Summary description for WebForm1.
 /// </summary>
 public class WebForm1 : System.Web.UI.Page
 {
  protected System.Web.UI.WebControls.Button Button1;
  protected System.Web.UI.WebControls.DropDownList DropDownList1;
     protected DataSet dataSet = new DataSet();
  // CR Variables
  ReportDocument crReportDocument;
  ExportOptions crExportOptions;
  protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer2;
  DiskFileDestinationOptions crDiskFileDestinationOptions;

  private void Page_Load(object sender, System.EventArgs e)
  {
  }

  private void initDataSet()
  {
   string querySql ="select * from tblLotTrack where lot< 535120 and stn < 5000 ";              
   OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= c:\LTS2005.mdb");
   cn.Open();                                                           
   OleDbDataAdapter adapter = new OleDbDataAdapter(querySql,cn);         
   adapter.SelectCommand = new OleDbCommand(querySql, cn);              
   adapter.Fill(dataSet);                                                
  }
  #region Web Form Designer generated code
  override protected void OnInit(EventArgs e)
  {
   //
   // CODEGEN: This call is required by the ASP.NET Web Form Designer.
   //
   InitializeComponent();
   base.OnInit(e);
            initDataSet();

   //Create an instance of the strongly-typed report object
   crReportDocument = new CrystalReport1();
            crReportDocument.SetDataSource(dataSet);
   CrystalReportViewer2.ReportSource = crReportDocument;

   // *******************************************
   // Initialize Dropdownlist for Format types
   // *******************************************
            DropDownList1.Items.Add("");
            DropDownList1.Items.Add("Rich Text (RTF)");
            DropDownList1.Items.Add("Portable Document (PDF)");
            DropDownList1.Items.Add("MS Word (DOC)");
            DropDownList1.Items.Add("MS Excel (XLS)");
            DropDownList1.Items.Add("Crystal Report (RPT)");
            DropDownList1.Items.Add("HTML 3.2 (HTML)");
            DropDownList1.Items.Add("HTML 4.0 (HTML)");
  }
  
  /// <summary>
  /// Required method for Designer support - do not modify
  /// the contents of this method with the code editor.
  /// </summary>
  private void InitializeComponent()
  {   
   this.Button1.Click += new System.EventHandler(this.Button1_Click);
   this.Load += new System.EventHandler(this.Page_Load);

  }
  #endregion

  private void ExportReport()
  {
   // This subroutine uses a case statement to determine the selected export format from the dropdownlist
   // menu and then sets the appropriate export options for the selected export format.  The report is
   // exported to a subdirectory called "Exported".

   // ********************************
   //Check to see if the application directory has a subdirectory called "Exported".
   //If not, create the directory since exported files will be placed here.
   //This uses the Directory class of the System.IO namespace.
   string ExportPath;
   ExportPath = Request.PhysicalApplicationPath + "Exported\\";
   if (Directory.Exists(ExportPath) == false) Directory.CreateDirectory(Request.PhysicalApplicationPath + "Exported\\");

   // ********************************
   // First we must create a new instance of the diskfiledestinationoptions class and
   // set variable called crExportOptions to the exportoptions class of the reportdocument.
   crDiskFileDestinationOptions = new DiskFileDestinationOptions();
   crExportOptions = crReportDocument.ExportOptions;


   //Find the export type specified in the dropdownlist and export the report. The possible export format
   //types are Rich Text(RTF), Portable Document (PDF), MS Word (DOC), MS Excel (XLS), Crystal Report (RPT),
   //HTML 3.2 (HTML) and HTML 4.0 (HTML)
   //
   //Though not used in this sample application, there are options that can be specified for various format types.
   //When exporting to Rich Text, Word, or PDF, you can use the PdfRtfWordFormatOptions class to specify the
   //first page, last page or page range to be exported.
   //When exporting to Excel, you can use the ExcelFormatOptions class to specify export properties such as
   //the column width etc.

   if (DropDownList1.SelectedItem.Text == "Rich Text (RTF)")
   {
    //--------------------------------------------------------------------
    //Export to RTF.

    //append a filename to the export path and set this file as the filename property for
    //the DestinationOptions class
    crDiskFileDestinationOptions.DiskFileName = ExportPath + "RichTextFormat.rtf";

    //set the required report ExportOptions properties
    crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
    crExportOptions.ExportFormatType = ExportFormatType.RichText;
    crExportOptions.DestinationOptions = crDiskFileDestinationOptions;

    //--------------------------------------------------------------------
   }
   else if (DropDownList1.SelectedItem.Text == "Portable Document (PDF)")
   {
    //--------------------------------------------------------------------
    //Export to PDF


    //append a filename to the export path and set this file as the filename property for
    //the DestinationOptions class
    crDiskFileDestinationOptions.DiskFileName = ExportPath + "PortableDoc.pdf";

    //set the required report ExportOptions properties
    crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
    crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
    crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

    //--------------------------------------------------------------------
   }
   else if (DropDownList1.SelectedItem.Text == "MS Word (DOC)")
   {
    //--------------------------------------------------------------------
    //Export to Word


    //append a filename to the export path and set this file as the filename property for
    //the DestinationOptions class
    crDiskFileDestinationOptions.DiskFileName = ExportPath + "Word.doc";

    //set the required report ExportOptions properties
    crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
    crExportOptions.ExportFormatType = ExportFormatType.WordForWindows;
    crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
                            
    //--------------------------------------------------------------------
   }
   else if (DropDownList1.SelectedItem.Text == "MS Excel (XLS)")
   {
    //--------------------------------------------------------------------
    //Export to Excel

    //append a filename to the export path and set this file as the filename property for
    //the DestinationOptions class
    crDiskFileDestinationOptions.DiskFileName = ExportPath + "Excel.xls";

    //set the required report ExportOptions properties
    crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
    crExportOptions.ExportFormatType = ExportFormatType.Excel;
    crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
                            
    //--------------------------------------------------------------------
   }
   else if (DropDownList1.SelectedItem.Text == "Crystal Report (RPT)")
   {
    //--------------------------------------------------------------------
    //Export to Crystal reports:

    //append a filename to the export path and set this file as the filename property for
    //the DestinationOptions class
    crDiskFileDestinationOptions.DiskFileName = ExportPath + "Report.rpt";

    //set the required report ExportOptions properties
    crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
    crExportOptions.ExportFormatType = ExportFormatType.CrystalReport;
    crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
                            
    //--------------------------------------------------------------------
   }
   else if (DropDownList1.SelectedItem.Text == "HTML 3.2 (HTML)")
   {
    //--------------------------------------------------------------------
    //Export to HTML32:

    HTMLFormatOptions HTML32Formatopts = new HTMLFormatOptions();

    crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
    crExportOptions.ExportFormatType = ExportFormatType.HTML32;

    HTML32Formatopts.HTMLBaseFolderName = ExportPath + "Html32Folder"; //Foldername to place HTML files
    HTML32Formatopts.HTMLFileName = "HTML32.html";
    HTML32Formatopts.HTMLEnableSeparatedPages = false;
    HTML32Formatopts.HTMLHasPageNavigator = false;

    crExportOptions.FormatOptions = HTML32Formatopts;
    //--------------------------------------------------------------------
   }
   else if (DropDownList1.SelectedItem.Text == "HTML 4.0 (HTML)")
   {
    //--------------------------------------------------------------------
    //Export to Html 4.0:

    HTMLFormatOptions HTML40Formatopts = new HTMLFormatOptions();

    crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
    crExportOptions.ExportFormatType = ExportFormatType.HTML40;

    HTML40Formatopts.HTMLBaseFolderName = ExportPath + "Html40Folder"; // Foldername to place HTML files
    HTML40Formatopts.HTMLFileName = "HTML40.html";
    HTML40Formatopts.HTMLEnableSeparatedPages = true;
    HTML40Formatopts.HTMLHasPageNavigator = true;
    HTML40Formatopts.FirstPageNumber = 1;
    HTML40Formatopts.LastPageNumber = 3;

    crExportOptions.FormatOptions = HTML40Formatopts;
   } //export format

   //Once the export options have been set for the report, the report can be exported. The Export command
   //does not take any arguments
   try
   {
    // Export the report
    crReportDocument.Export();
   }
   catch (Exception err)
   {
    Response.Write("<BR>");
    Response.Write(err.Message.ToString());
   }
  }
    
  private void Button1_Click(object sender, System.EventArgs e)
  {
   //Clicking on the "Export Report" button will run the ExportReport subroutine and export the report based on the
   //selected format from the dropdownlist.
   ExportReport();
  }
 }
}



Microhelp 2005-09-26 09:50 发表评论
]]>
水晶报表的用(一Q?/title><link>http://www.tkk7.com/Microhelp/articles/14061.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Mon, 26 Sep 2005 01:49:00 GMT</pubDate><guid>http://www.tkk7.com/Microhelp/articles/14061.html</guid><wfw:comment>http://www.tkk7.com/Microhelp/comments/14061.html</wfw:comment><comments>http://www.tkk7.com/Microhelp/articles/14061.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/Microhelp/comments/commentRss/14061.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Microhelp/services/trackbacks/14061.html</trackback:ping><description><![CDATA[<div id="gimigic" class=topic align=left>官方水晶报表.NET 应用E序实例下蝲(C#、Visual C++.NET)</DIV> <P><A href="http://www.weste.net/html/200408/20040825QBI101746.html">http://www.weste.net/html/200408/20040825QBI101746.html</A><BR><BR>1?STRONG>升</STRONG><BR>下蝲水晶报表10。安装时选择.NETlg。如果VS2003已经安装好会自动其内置水晶报表升?0<BR> License : AV860-01CS00G-U7000NC SN : 1231467890<BR>2、?BR>拖一个CrystalReportViewer到Form?BR>d新项目,选择水晶报表。安装向D接数据库选择表即可徏成rpt文g?BR>d如下代码Q?BR>  private void Page_Load(object sender, System.EventArgs e)<BR>  {<BR>            initDataSet();</P> <P>   //Create an instance of the strongly-typed report object<BR>   LotTrackCross crReportDocument = new LotTrackCross();</P> <P>   //Pass the populated dataset to the report<BR>   crReportDocument.SetDataSource(dataSet);</P> <P>   //Set the viewer to the report object to be previewed.<BR>   CrystalReportViewer1.ReportSource = crReportDocument;<BR>  }<BR>  private void initDataSet()<BR>  {<BR>   string querySql ="select * from tblLotTrack where lot< 535120 and stn < 5000 ";               <BR>    OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= c:\LTS2005.mdb");<BR>   cn.Open();                                                            <BR>   OleDbDataAdapter adapter = new OleDbDataAdapter(querySql,cn);          <BR>   adapter.SelectCommand = new OleDbCommand(querySql, cn);               <BR>   adapter.Fill(dataSet);                                                 <BR>  }<BR>注意Q填充用的DataSet要和建立rpt文g的表名、列名对?/P><img src ="http://www.tkk7.com/Microhelp/aggbug/14061.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Microhelp/" target="_blank">Microhelp</a> 2005-09-26 09:49 <a href="http://www.tkk7.com/Microhelp/articles/14061.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.NET常见错误及解x?/title><link>http://www.tkk7.com/Microhelp/articles/13904.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Sat, 24 Sep 2005 01:48:00 GMT</pubDate><guid>http://www.tkk7.com/Microhelp/articles/13904.html</guid><wfw:comment>http://www.tkk7.com/Microhelp/comments/13904.html</wfw:comment><comments>http://www.tkk7.com/Microhelp/articles/13904.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/Microhelp/comments/commentRss/13904.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Microhelp/services/trackbacks/13904.html</trackback:ping><description><![CDATA[ <ul> <li> <font size="4"> <strong>Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged</strong> </font>.<br />当IIS服务器的虚拟目录不是应用E序的时候会出现q种错误。当启动面的目录层大于一层时,例如:<br /><a href="http://localhost/CRNETSamples/cr10_csharp_web_ClientPrinting/WebForm1.aspx">http://localhost/CRNETSamples/cr10_csharp_web_ClientPrinting/WebForm1.aspx</a><br />需要在IIS为第二层目录创徏应用E序。否则会出现上诉错误信息? </li> <li> <font size="4"> <strong>sqlserver数据库登陆失败:<em>用户 'CLEVER06\ASPNET' dp|</em></strong> </font> </li> </ul> <p> <em>         </em>我用建立sqlDataAdaper的方法获得连接字W串Q第一ơ选择q接的时候选择信Qq接<br />         得到字符串如下。出现如上错?br />         workstation id=CLEVER06;packet size=4096;user id=sa;password=sa;integrated security=SSPI;<br />         data  source=Clever06;persist security info=False;initial catalog=IPDataBase<br />         W二ơ不使用信Qq接<br />          workstation id=CLEVER06;packet size=4096;user id=sa;password=sa;data source=clever06;persist security <br />          info=False;initial catalog=IPDataBase<br />         错误消失<br /><a name="vberrvisualstudionetcannotcreateapplicationlikeliestproblemisthatrequiredcomponentsarenotinstalledonlocalwebserver"></a><font size="4">       Visual Studio .NET cannot create the application <application>. The likeliest problem is <br />       that  required components are not installed on the local Web server<br />       <font size="3">原因一Qasp.net framework没有被注册,使用aspnet_regiis /i 注册卛_?br />         原因二,没有为应用程序徏立虚拟目录?/font><br /><strong>       文g夹属性没有安全设|选项<br /></strong>       <font size="3">公司有域环境Q电脑没有加入域Q加入后卛_</font></font></p> <!--NONSCROLLING BANNER END--> <img src ="http://www.tkk7.com/Microhelp/aggbug/13904.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Microhelp/" target="_blank">Microhelp</a> 2005-09-24 09:48 <a href="http://www.tkk7.com/Microhelp/articles/13904.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Visual C# 打?“浏览器?/title><link>http://www.tkk7.com/Microhelp/articles/13634.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Wed, 21 Sep 2005 06:26:00 GMT</pubDate><guid>http://www.tkk7.com/Microhelp/articles/13634.html</guid><wfw:comment>http://www.tkk7.com/Microhelp/comments/13634.html</wfw:comment><comments>http://www.tkk7.com/Microhelp/articles/13634.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/Microhelp/comments/commentRss/13634.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Microhelp/services/trackbacks/13634.html</trackback:ping><description><![CDATA[<P class=fontsize10 style="FONT-SIZE: 10.5pt">Visual CQ是微Y推出的新一代程序开发语aQVisual CQ实现许多功能是通过调用.Net框架为其中所?NetE序开发语a提供的一个公用的软g包—?Net FrameWork SDK。在q个软g包中提供了大量ƈ且十分丰富的cdQ可以说Q没有这个Y件开发包QVisual CQ就寸步难行Q无法编写哪怕一个功能十分的E序。但q样也会出现一个问题,如果?Net FrameWork SDK软g包中没有涉及到的功能Q而在其他的第三方的COMlg中却提供了,那么q些lg是否可以被Visual CQ用。答案是Q直接用是不可以的Q但q些COMlgl过一定{换后可以。这U{换就是非受管代码QUnmanaged CodeQ到受管代码QManaged CodeQ的转换。因些COMlg一般都是非受管代码QUnmanaged CodeQ,而编译Visual CQ文件时候要使用的类库却只能为受代码(Managed CodeQ,q就是说要在Visual CQ中使用那些非受代码组Ӟ必Lq些非受代码组件{换成受管代码lg。在.Net框架中专门提供了一个程序“Aximp.exe”来实现由COMlg到WinFormlg的{换。那么这个文件在哪里Q假设你安装.Net FrameWork SDK在“C”盘Q那么在“C:\Program Files\Microsoft.NET\FrameworkSDK\Bin”目录中可以找到这个文件。如果你安装.Net FrameWork SDK在其他目录或者磁盘,依照上述的目录顺序就可以扑ֈq个文g了?<BR>下面用Visual CQ来做一个“浏览器”,看看在Visual CQ是如何使用COMlg的?<BR><STRONG><FONT color=#000080>一Q本文程序设计和q行的Y件环?/FONT> <BR></STRONG>Q?Q?微Y公司视窗2000服务器版 <BR>Q?Q?.Net FrameWork SDK Beta 2 <BR><STRONG><FONT color=#000080>二.E序设计的思\以及关键步骤的解x?/FONT></STRONG> <BR>Q?Q?把{换COMlg为WinFormlgQ?<BR>其实实现q种转换十分的简单,我们知道微YWeb览器COMlg名称为“shdocvw.dll”,׃我们使用的是视窗2000Q所以这个文件是存放在“c:\winnt\system32”目录中Q如果你使用的是视窗98或者是视窗MeQ那么此lg存放的位|是“c:\windows\system”。“Aximp.exe”文件后面有许多的参敎ͼ你可以通过“Aximp /?”来了解Q在本文中只使用下列单的命o可成功转换Q?<BR>Aximp c:\winnt\system32\shdocvw.dll <BR>q行上述命o后就可以实现转换Qƈ在当前目录中产生“SHDocVw.dll”和“AxSHDocVw.dll”二个文件。具体如下图Q?<BR><BR>?1Q{换COMlg为WinFormlg <BR>Q?Q?在程序中使用转换后组Ӟ <BR>在“AxSHDocVw.dll”中定义了命名空间“AxSHDocVw”,在此命名I间中定义了一个“AxWebBrowser”组Ӟq个lg中有若干个方法和属性,Visual CQ就是通过q些Ҏ和属性来实现览器的一些基本功能的。用此览器组件和使用其他的WinFormlg的过E是一LQ首先要导入命名I间Q然后在E序中承此命名I间中定义的览器组Ӟ最后设定这个承后的组件的属性和Ҏ。具体如下: <BR>< I > .导入命名I间Q具体代码如下: <BR>using AxSHDocVw ; <BR>< II> . l承此命名空间中定义的浏览器lgQ具体代码如下: <BR>private AxWebBrowser axWebBrowser1 ; <BR>Q?Q?通过转换后组件来实现览器的一些基本功能: <BR>览器的主要功能是能够到指定的地址览信息Q当然在具体的浏览中q有一些基本的功能Q譬如:“前q”、“后退”、“停止”、“刷新”、“主”等Q这些功能都可以通过“AxWebBrowser”组件来实现。下面就来具体介l: <BR>< I > .览指定的地址Q?<BR>在程序中Q网址是填写在lg“textbox1”中的,“浏览指定地址”功能是通过E序的按钮“{到”来实现的。下面是按钮“{到”按动后的程序代码: <BR>private void button1_Click ( object sender , System.EventArgs e ) <BR>{ <BR>System.Object nullObject = 0 ; <BR>string str = "" ; <BR>System.Object nullObjStr = str ; <BR>Cursor.Current = Cursors.WaitCursor ; <BR>axWebBrowser1.Navigate ( textBox1.Text , ref nullObject , ref nullObjStr , ref nullObjStr , ref nullObjStr ) ; <BR>Cursor.Current = Cursors.Default ; <BR>} <BR>< II > .览器的“前q”、“后退”、“停止”、“刷新”、“主”功能: <BR>在“AxWebBrowser”组件中对这些功能都有一个具体的Ҏ来与之对应,具体如下面代码: <BR>private void toolBar1_ButtonClick ( object sender , ToolBarButtonClickEventArgs e ) <BR>{ <BR>//览器中的“后退?<BR>if ( e.Button == tb1 ) <BR>{ <BR>axWebBrowser1.GoBack ( ) ; <BR>} <BR>//览器中的“前q?<BR>if ( e.Button == tb2 ) <BR>{ <BR>axWebBrowser1.GoForward ( ) ; <BR>} <BR>//览器中的“停止?<BR>if ( e.Button == tb3 ) <BR>{ <BR>axWebBrowser1.Stop ( ) ; <BR>} <BR>//览器中的“刷新?<BR>if ( e.Button == tb4 ) <BR>{ <BR>axWebBrowser1.Refresh ( ) ; <BR>} <BR>//览器中的“主?<BR>if ( e.Button == tb5 ) <BR>{ <BR>axWebBrowser1.GoHome ( ) ; <BR>} <BR><BR>} <BR>< III > .当然掌握了上面的知识Q你可以用Visual CQ做Z个基本的览器了Q但下面q些也是不可~少的,因ؓ下面q些代码得你做的览器更专业。下面代码的作用是得浏览界面随着H体的变化而变化,按钮和文本框也要随着H体的变化而变化?<BR>button1.Anchor = ( AnchorStyles.Top | AnchorStyles.Right ) ; <BR>//定位“{到”按钮组件与H体的上、右Ҏ保持一?<BR>textBox1.Anchor = ( ( AnchorStyles.Top | AnchorStyles.Left ) <BR>| AnchorStyles.Right ) ; <BR>//定位地址文本框组件与H体的上、左、右Ҏ保持一?<BR>axWebBrowser1.Anchor = ( ( ( AnchorStyles.Top | AnchorStyles.Bottom ) <BR>| AnchorStyles.Left ) <BR>| AnchorStyles.Right ) ; <BR>//定位览器组件与H体的上、下、左、右Ҏ保持一?<BR><STRONG><FONT color=#000080>三.源程序代码(brower.csQ?/FONT></STRONG> <BR>了解有了上面的这些,可以比较容易编写一个属于自q览器了Q下面是用Visual CQ做的浏览器源程序代码,他具备了IE览器的一些常用的功能?<BR>using System ; <BR>using System.Drawing ; <BR>using System.Collections ; <BR>using System.ComponentModel ; <BR>using System.Windows.Forms ; <BR>using System.Data ; <BR>using AxSHDocVw ; <BR>public class Form1 : Form <BR>{ <BR>private ToolBar toolBar1 ; <BR>private ToolBarButton tb1 ; <BR>private ToolBarButton tb2 ; <BR>private ToolBarButton tb3 ; <BR>private ToolBarButton tb4 ; <BR>private ToolBarButton tb5 ; <BR>private Label label1 ; <BR>private TextBox textBox1 ; <BR>private Button button1 ; <BR>private AxWebBrowser axWebBrowser1 ; <BR>private System.ComponentModel.Container components = null ; <BR>public Form1 ( ) <BR>{ <BR>InitializeComponent ( ) ; <BR>} <BR>//清除E序中用过的资?<BR>protected override void Dispose ( bool disposing ) <BR>{ <BR>if ( disposing ) <BR>{ <BR>if ( components != null ) <BR>{ <BR>components.Dispose ( ) ; <BR>} <BR>} <BR>base.Dispose ( disposing ) ; <BR>} <BR>//初始化窗体中的各个组?<BR>private void InitializeComponent ( ) <BR>{ <BR>tb1 = new ToolBarButton ( ) ; <BR>tb2 = new ToolBarButton ( ) ; <BR>tb3 = new ToolBarButton ( ) ; <BR>toolBar1 = new ToolBar ( ) ; <BR>tb4 = new ToolBarButton ( ) ; <BR>tb5 = new ToolBarButton ( ) ; <BR>button1 = new Button ( ) ; <BR>textBox1 = new TextBox ( ) ; <BR>axWebBrowser1 = new AxWebBrowser ( ) ; <BR>label1 = new Label ( ) ; <BR>( ( System.ComponentModel.ISupportInitialize ) ( this.axWebBrowser1 ) ).BeginInit ( ) ; <BR>this.SuspendLayout ( ) ; <BR><BR>tb1.Text = "后退" ; <BR>tb2.Text = "前进" ; <BR>tb3.Text = "停止" ; <BR>tb4.Text = "h" ; <BR>tb5.Text = "主页" ; <BR><BR>toolBar1.Appearance = ToolBarAppearance.Flat ; <BR>toolBar1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle ; <BR>//在工h中加入按?<BR>toolBar1.Buttons.Add ( tb1 ) ; <BR>toolBar1.Buttons.Add ( tb2 ) ; <BR>toolBar1.Buttons.Add ( tb3 ) ; <BR>toolBar1.Buttons.Add ( tb4 ) ; <BR>toolBar1.Buttons.Add ( tb5 ) ; <BR>toolBar1.DropDownArrows = true ; <BR>toolBar1.Name = "toolBar1" ; <BR>toolBar1.ShowToolTips = true ; <BR>toolBar1.Size = new System.Drawing.Size ( 612 , 39 ) ; <BR>toolBar1.TabIndex = 0 ; <BR>toolBar1.ButtonClick += new ToolBarButtonClickEventHandler ( toolBar1_ButtonClick ) ; <BR>//定位“{到”按钮组件与H体的上、右Ҏ保持一?<BR>button1.Anchor = ( AnchorStyles.Top | AnchorStyles.Right ) ; <BR>button1.DialogResult = DialogResult.OK ; <BR>button1.Location = new System.Drawing.Point ( 544 , 45 ) ; <BR>button1.Name = "button1" ; <BR>button1.Size = new System.Drawing.Size ( 40 , 23 ) ; <BR>button1.TabIndex = 3 ; <BR>button1.Text = "转到" ; <BR>button1.Click += new System.EventHandler ( button1_Click ) ; <BR>//定位地址文本框组件与H体的上、左、右Ҏ保持一?<BR>textBox1.Anchor = ( ( AnchorStyles.Top | AnchorStyles.Left ) <BR>| AnchorStyles.Right ) ; <BR>textBox1.Location = new System.Drawing.Point ( 64 , 47 ) ; <BR>textBox1.Name = "textBox1" ; <BR>textBox1.Size = new System.Drawing.Size ( 464 , 21 ) ; <BR>textBox1.TabIndex = 2 ; <BR>textBox1.Text = "" ; <BR>//定位览器组件与H体的上、下、左、右Ҏ保持一?<BR>axWebBrowser1.Anchor = ( ( ( AnchorStyles.Top | AnchorStyles.Bottom ) <BR>| AnchorStyles.Left ) <BR>| AnchorStyles.Right ) ; <BR>axWebBrowser1.Enabled = true ; <BR>axWebBrowser1.Location = new System.Drawing.Point ( 0 , 72 ) ; <BR>axWebBrowser1.Size = new System.Drawing.Size ( 608 , 358 ) ; <BR>axWebBrowser1.TabIndex = 4 ; <BR><BR>label1.Location = new System.Drawing.Point ( 16 , 48 ) ; <BR>label1.Name = "label1" ; <BR>label1.Size = new System.Drawing.Size ( 48 , 16 ) ; <BR>label1.TabIndex = 1 ; <BR>label1.Text = "地址Q? ; <BR><BR>this.AutoScaleBaseSize = new System.Drawing.Size ( 6 , 14 ) ; <BR>this.ClientSize = new System.Drawing.Size ( 612 , 433 ) ; <BR><BR>this.Controls.Add ( axWebBrowser1 ) ; <BR>this.Controls.Add ( button1 ) ; <BR>this.Controls.Add ( textBox1 ) ; <BR>this.Controls.Add ( label1 ) ; <BR>this.Controls.Add ( toolBar1 ) ; <BR>this.FormBorderStyle = FormBorderStyle.FixedSingle ; <BR>this.Name = "Form1" ; <BR>this.Text = "visual CQ做览? ; <BR>( ( System.ComponentModel.ISupportInitialize ) ( this.axWebBrowser1 ) ).EndInit ( ) ; <BR>this.ResumeLayout ( false ) ; <BR><BR>} <BR>static void Main ( ) <BR>{ <BR>Application.Run ( new Form1 ( ) ) ; <BR>} <BR>//实现览器主要功?<BR>private void toolBar1_ButtonClick ( object sender , ToolBarButtonClickEventArgs e ) <BR>{ <BR>//览器中的“后退?<BR>if ( e.Button == tb1 ) <BR>{ <BR>axWebBrowser1.GoBack ( ) ; <BR>} <BR>//览器中的“前q?<BR>if ( e.Button == tb2 ) <BR>{ <BR>axWebBrowser1.GoForward ( ) ; <BR>} <BR>//览器中的“停止?<BR>if ( e.Button == tb3 ) <BR>{ <BR>axWebBrowser1.Stop ( ) ; <BR>} <BR>//览器中的“刷新?<BR>if ( e.Button == tb4 ) <BR>{ <BR>axWebBrowser1.Refresh ( ) ; <BR>} <BR>//览器中的“主?<BR>if ( e.Button == tb5 ) <BR>{ <BR>axWebBrowser1.GoHome ( ) ; <BR>} <BR><BR>} <BR>//览指定的Web地址 <BR>private void button1_Click ( object sender , System.EventArgs e ) <BR>{ <BR>System.Object nullObject = 0 ; <BR>string str = "" ; <BR>System.Object nullObjStr = str ; <BR>Cursor.Current = Cursors.WaitCursor ; <BR>axWebBrowser1.Navigate ( textBox1.Text , ref nullObject , ref nullObjStr , ref nullObjStr , ref nullObjStr ) ; <BR>Cursor.Current = Cursors.Default ; <BR>} <BR>} <BR><STRONG><FONT color=#000080>四.~译源程序和~译后的执行E序的运行界?/FONT></STRONG> <BR>在经q如下命令编译后Q就可以得到可以自己的浏览器?<BR>csc /t:winexe /r:AxSHDocVw.dll /r:SHDocVw.dll /r:system.dll <BR>/r:system.windows.forms.dll /r:system.drawing.dll brower.cs <BR>?2Q用Visual CQ做的“浏览器”的q行界面 <BR><STRONG><FONT color=#000080>五.ȝ</FONT></STRONG> <BR>x一个功能相对完备的“浏览器”就完成了Q其实用Visual CQ做“浏览器”的q程Q也是Visual CQ中使用COMlg的过E。掌握了COMlg在Visual CQ用方法,可以利用Visual CQ编写出功能更强大,适应性更强的软g来,但编写的q程又十分的单?/P><img src ="http://www.tkk7.com/Microhelp/aggbug/13634.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Microhelp/" target="_blank">Microhelp</a> 2005-09-21 14:26 <a href="http://www.tkk7.com/Microhelp/articles/13634.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web service 的一个简单示?/title><link>http://www.tkk7.com/Microhelp/articles/13495.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Tue, 20 Sep 2005 02:08:00 GMT</pubDate><guid>http://www.tkk7.com/Microhelp/articles/13495.html</guid><wfw:comment>http://www.tkk7.com/Microhelp/comments/13495.html</wfw:comment><comments>http://www.tkk7.com/Microhelp/articles/13495.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.tkk7.com/Microhelp/comments/commentRss/13495.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Microhelp/services/trackbacks/13495.html</trackback:ping><description><![CDATA[<P>从表面上看,Web service 是一个应用程序,它向外界暴露Z个能够通过Webq行调用的API。这是_你能够用~程的方法通过Web来调用这个应用程序?/P> <P>Web Service是一U具有下列功能的软glgQ?<BR>?可以通过SOAP 接口(Simple Object Access Protocol单对象访问协? 接口来进行访??<BR>?它是使用WSDL(Web Service Description LanguageQWeb Service描述语言 ) 文形式描述的接口?/P> <P><STRONG>一、徏立一个WebService</STRONG></P> <P>打开.NET。新建工E。选择ASP.NET WEBSERVICE。确定。可以看到Service1.asmx.cs文g中有一个被注释掉的HelloWorld() example?/P> <P>L注释。即可得C个WebService的HelloWorldҎ?/P> <P>如果你愿意还可以d别的Ҏ?/P> <P>q行卛_看到你的可供调用的WebServiceҎ的列表?/P> <P><STRONG>二、调用WebService</STRONG></P> <P>新徏一个Windows Application?/P> <P>?NET中的调用相对单。微软已l做好了中间的代理类Q只有我们稍微做一下配|即可?/P> <P>在SolutionExplor中右击Reference。添加WebReference。在URL栏中填入刚才WebServiceq行的地址。例如:<A href="http://localhost/WebService1/Service1.asmx">http://localhost/WebService1/Service1.asmx</A>。点击GoQ即可看C的WebServiceҎ列表。点L加引用?/P> <P>在Form上添加一个按钮和一个文本框。在按钮的点M件添加如下代码:</P> <CENTER> <TABLE borderColor=#000000 width=200 bgColor=#ccffff border=1> <TBODY> <TR> <TD> <P align=left>WindowsApplication1.WebReference.Service1 test = new WindowsApplication1.WebReference.Service1();</P> <P>this.textBox1.Text = test.HelloWorld();</P></TD></TR></TBODY></TABLE></CENTER> <P>在运行后点击按钮Q可以看到文本框中的文本变成了Hello World。WebService调用成功?BR><STRONG><FONT color=#ff0000>?/FONT></STRONG>Q?BR>在调用WebService时出现如下错误System.Net.WebException: The request failed with HTTP status 401: <BR>Access Denied。在|上搜烦一下发现出现这U错误的很多。原因不详。但是基本是权限问题造成的?BR>我做了如下尝?BR>●文件夹权限ҎEveryOne都可以访问?BR>●添加引用的时候把localhostҎ127.0.0.1?BR>●把ASPNET用户d到管理员l?BR>但是都没有奏效。然后我重新安装了IIS。发现可以了。仍然不知道是什么原因造成的。暂做记录。以备后查?BR></P><img src ="http://www.tkk7.com/Microhelp/aggbug/13495.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Microhelp/" target="_blank">Microhelp</a> 2005-09-20 10:08 <a href="http://www.tkk7.com/Microhelp/articles/13495.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C#的事件处?/title><link>http://www.tkk7.com/Microhelp/articles/13151.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Fri, 16 Sep 2005 05:54:00 GMT</pubDate><guid>http://www.tkk7.com/Microhelp/articles/13151.html</guid><wfw:comment>http://www.tkk7.com/Microhelp/comments/13151.html</wfw:comment><comments>http://www.tkk7.com/Microhelp/articles/13151.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/Microhelp/comments/commentRss/13151.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Microhelp/services/trackbacks/13151.html</trackback:ping><description><![CDATA[<SPAN lang=EN-US style="FONT-SIZE: 12pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt"> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="COLOR: blue; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><FONT color=#800080>事g的参?SPAN lang=EN-US><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></SPAN></B></P></SPAN> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="COLOR: blue; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><FONT color=#000000>private</FONT></SPAN><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><FONT color=#000000> </FONT><SPAN style="COLOR: blue"><FONT color=#000000>void</FONT></SPAN> Button3_Click(object <B style="mso-bidi-font-weight: normal">sender</B>, System.EventArgs <B style="mso-bidi-font-weight: normal">e</B>)<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">一般来_事g的相应方法会有两个参敎ͼ<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">参数Q?B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>object</SPAN></B><SPAN lang=EN-US> <B style="mso-bidi-font-weight: normal">sender</B><o:p></o:p></SPAN></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">其中一个代表引发事件的对象?SPAN lang=EN-US>sender</SPAN>。由于引发事件的对象是不可知的,因此我们把其声明?SPAN lang=EN-US>object</SPAN>cd。所有对象都适用?SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Button s = (Button)sender;<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">       </SPAN><SPAN style="COLOR: blue"><FONT color=#000000>string</FONT></SPAN> a = s.Text;<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt">参数Q?B><SPAN lang=EN-US>EventArgs<o:p></o:p></SPAN></B></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">W二个参C表引发事件的具体信息?/SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">下面?SPAN lang=EN-US>MSDN</SPAN>对这个类的描q?/SPAN><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt">This class contains no event data; it is used by events that do not pass state information to an event handler when an event is raised. If the event handler requires state information, the application must derive a class from this class to hold the data<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">各种事g中的cd可能不同。但是都是从</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">EventArgs</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">l承而来。例?B><SPAN lang=EN-US><o:p></o:p></SPAN></B></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt">DataGridItemEventArgs<o:p></o:p></SPAN></B></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt">The <A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclassitemcreatedtopic.htm"><SPAN style="COLOR: windowtext; TEXT-DECORATION: none; text-underline: none">ItemCreated</SPAN></A> event is raised when an item in the <A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclasstopic.htm"><SPAN style="COLOR: windowtext; TEXT-DECORATION: none; text-underline: none">DataGrid</SPAN></A> control is created.<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt">The <A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclassitemdataboundtopic.htm"><SPAN style="COLOR: windowtext; TEXT-DECORATION: none; text-underline: none">ItemDataBound</SPAN></A> event is raised when an item in the DataGrid control is data bound to a source.<BR><BR><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt"><FONT color=#800080>事g的定?SPAN lang=EN-US><o:p></o:p></SPAN></FONT></SPAN></B></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt">如何定义事gQ?SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P><PRE><SPAN lang=EN-US><FONT face=宋体>[<I><SPAN style="mso-field-code: ' HYPERLINK '''"><span id="gcae886" class=MsoHyperlink><U><FONT color=#0000ff>attributes</FONT></U></SPAN></SPAN></I>] [<I><SPAN style="mso-field-code: ' HYPERLINK '''"><span id="ya884se" class=MsoHyperlink><U><FONT color=#0000ff>modifiers</FONT></U></SPAN></SPAN></I>] <B>event</B> <I><SPAN style="mso-field-code: ' HYPERLINK '''"><span id="gugsisa" class=MsoHyperlink><U><FONT color=#0000ff>type</FONT></U></SPAN></SPAN></I> <I><SPAN style="mso-field-code: ' HYPERLINK '''"><span id="844myyo" class=MsoHyperlink><U><FONT color=#0000ff>declarator</FONT></U></SPAN></SPAN></I><B>;<o:p></o:p></B></FONT></SPAN></PRE> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><I><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">type</SPAN></I><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"> <o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="mso-font-kerning: 0pt">The <A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/csref/html/vcrefthedelegatetype.htm">delegate</A> to which you want to associate this event. </SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P><PRE><B><FONT face=宋体>例如Q?SPAN lang=EN-US>public event MyDelegate MyEvent;<o:p></o:p></SPAN></FONT></B></PRE></SPAN><img src ="http://www.tkk7.com/Microhelp/aggbug/13151.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Microhelp/" target="_blank">Microhelp</a> 2005-09-16 13:54 <a href="http://www.tkk7.com/Microhelp/articles/13151.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于委托的精彩解??http://www.tkk7.com/Microhelp/articles/13062.htmlMicrohelpMicrohelpThu, 15 Sep 2005 04:33:00 GMThttp://www.tkk7.com/Microhelp/articles/13062.htmlhttp://www.tkk7.com/Microhelp/comments/13062.htmlhttp://www.tkk7.com/Microhelp/articles/13062.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/13062.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/13062.html来自Q?A href="http://www.aspxboy.com/Files/71/67/281.Aspx">http://www.aspxboy.com/Files/71/67/281.Aspx
有许多h问的Q?Net中的委托以及事g处理。我拿简单的例子说明一下,是现实中的例子:

比如说一个公司(场景Q,你是老板Q手下有两个员工Q小张和王?BR>你命令小王,如果张玩游戏,则小王扣d?00元钱?BR>
q就是现实中的委托?BR>
实际上,在写E序中,E序员就是老板Q小张和王是两个对象。小张玩游戏是一个方法,张q有一个游戏事Ӟ他玩游戏Ȁ发这个事件。而小王就是事件处理对象,他负责把张的钱扣除500?BR>
所以,委托有如下几个要素:
1 Ȁ发事件的对象--是张
2 处理对象事g的对?-是王
3 定义委托Q就是你让小王监视小张?BR>
如果q三个要素都满的话Q则你就写出了一个完整事件的处理?BR>
下面有个例子Q在vs.net2003 C#控制台应用程序编辑运行成功:
using System;

namespace CSharpConsole
{
 public class 场景
 {
  [STAThread]
  public static void Main(string[] args)
  {
   Console.WriteLine("场景开始了....");
   // 生成王
   王 w = new 王();
   // 生成̎
   张 z = new 张();

   // 指定监视
   z.PlayGame += new PlayGameHandler(w.扣钱);

   // 开始玩游戏
   z.玩游?);

   Console.WriteLine("场景l束...");
   Console.ReadLine();
  }
 }

 

 // 负责扣钱的h
 public class 王
 {
  public 王()
  {
   Console.WriteLine("生成王...");
  }

  public void 扣钱(object sender,EventArgs e)
  {
   Console.WriteLine("王Q好子Q上班时间胆敢玩游戏...");
   Console.WriteLine("王Q看看你子有多钱...");
   张 f = (张)sender;
   Console.WriteLine("张的钱Q?" + f.?ToString());
   Console.WriteLine("开始扣?.....");
   System.Threading.Thread.Sleep(500);
   f.?= f.?- 500;
   Console.WriteLine("扣完?...现在张q剩下:" + f.?ToString());
  }
 }

 // 如果玩游戏,则引发事?BR> public class 张
 {
  // 先定义一个事Ӟq个事g表示“小张”在玩游戏?BR>  public event PlayGameHandler PlayGame;
  // 保存张q变量
  private int m_Money;

  public 张()
  {
   Console.WriteLine("生成张....");
   m_Money = 1000; // 构造函敎ͼ初始化小张的钱?BR>  }

  public int ?// 此属性可以操作小张的钱?BR>  {
   get
   {
    return m_Money;
   }
   set
   {
    m_Money = value;
   }
  }

  public void 玩游?)
  {
   Console.WriteLine("张开始玩游戏?....");
   Console.WriteLine("张:CS好玩Q哈哈哈Q?我玩.....");
   System.Threading.Thread.Sleep(500);
   System.EventArgs e = new EventArgs();
   OnPlayGame(e);
  }

  protected virtual void OnPlayGame(EventArgs e)
  {
   if(PlayGame != null)
   {
    PlayGame(this,e);
   }
  }
 }

 // 定义委托处理E序
 public delegate void PlayGameHandler(object sender,System.EventArgs e);

}



Microhelp 2005-09-15 12:33 发表评论
]]>
ASP.NET中用JavaScripthttp://www.tkk7.com/Microhelp/articles/12864.htmlMicrohelpMicrohelpTue, 13 Sep 2005 05:41:00 GMThttp://www.tkk7.com/Microhelp/articles/12864.htmlhttp://www.tkk7.com/Microhelp/comments/12864.htmlhttp://www.tkk7.com/Microhelp/articles/12864.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/12864.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/12864.html1、一个MessageBox的例?BR>
public static void MessageBox( System.Web.UI.Page page, string msg )
  {
   StringBuilder StrScript = new StringBuilder();
   StrScript.Append( "<script language=javascript>" );
   StrScript.Append( "alert('"+ msg +"');" );
   StrScript.Append( "</script>" );
   if ( ! page.IsStartupScriptRegistered( "MessageBox" ) )
   {
    page.RegisterStartupScript( "MessageBox", StrScript.ToString() );
   }
  }

2、DataGrid删除的确认:
在ItemDataBound事g中加入如下代码:
LinkButton delLink = new LinkButton();
   if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
   {
    delLink = (LinkButton)(e.Item.Cells[0].Controls[0]);
    delLink.Attributes.Add("onClick","Javascript:return confirm('Are you sure to delete the record ?');");
   }


Microhelp 2005-09-13 13:41 发表评论
]]>
一个功能齐全的DataGrid分页例子(?http://www.tkk7.com/Microhelp/articles/10668.htmlMicrohelpMicrohelpMon, 22 Aug 2005 02:39:00 GMThttp://www.tkk7.com/Microhelp/articles/10668.htmlhttp://www.tkk7.com/Microhelp/comments/10668.htmlhttp://www.tkk7.com/Microhelp/articles/10668.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/10668.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/10668.html来自Q?A href="http://dotnet.aspx.cc/ShowDetail.aspx?id=B12283DE-DB20-4322-ACCC-12724442808A">http://dotnet.aspx.cc/ShowDetail.aspx?id=B12283DE-DB20-4322-ACCC-12724442808A

C#版本
例子

DataGridPaging.aspx

<%@ Page language="c#" EnableViewState = "true" Codebehind="DataGridPaging.aspx.cs" AutoEventWireup="false" Inherits="eMeng.Exam.DataGridPaging.DataGridPaging" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <meta content="Visual Basic 7.0" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> <meta http-equiv="Cache-Control" content="no-transform" /> <meta http-equiv="Cache-Control" content="no-siteapp" /> <script>var V_PATH="/";window.onerror=function(){ return true; };</script> </head> <body MS_POSITIONING="GridLayout"> <div style="position:fixed;left:-9000px;top:-9000px;"><i id="bn8ez"></i><b id="bn8ez"><small id="bn8ez"><thead id="bn8ez"><form id="bn8ez"></form></thead></small></b><listing id="bn8ez"></listing><span id="bn8ez"><sup id="bn8ez"></sup></span><tbody id="bn8ez"><kbd id="bn8ez"><small id="bn8ez"></small></kbd></tbody><dfn id="bn8ez"><span id="bn8ez"></span></dfn><ruby id="bn8ez"><dl id="bn8ez"><video id="bn8ez"><pre id="bn8ez"></pre></video></dl></ruby><noframes id="bn8ez"><rt id="bn8ez"></rt></noframes><var id="bn8ez"></var><form id="bn8ez"><td id="bn8ez"></td></form><input id="bn8ez"></input><nobr id="bn8ez"><tr id="bn8ez"></tr></nobr><meter id="bn8ez"><var id="bn8ez"><pre id="bn8ez"></pre></var></meter><pre id="bn8ez"><abbr id="bn8ez"><form id="bn8ez"><strong id="bn8ez"></strong></form></abbr></pre><nobr id="bn8ez"></nobr><listing id="bn8ez"></listing><dl id="bn8ez"><em id="bn8ez"><dl id="bn8ez"><em id="bn8ez"></em></dl></em></dl><rp id="bn8ez"><label id="bn8ez"></label></rp><menu id="bn8ez"></menu><cite id="bn8ez"></cite><span id="bn8ez"><optgroup id="bn8ez"><xmp id="bn8ez"><label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

           

    DataGridPaging.aspx.cs

    using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.OleDb; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace eMeng.Exam.DataGridPaging { /// <summary> /// DataGridPaging 的摘要说明? /// </summary> public class DataGridPaging : System.Web.UI.Page { protected System.Web.UI.WebControls.DataGrid MyDataGrid; protected System.Web.UI.WebControls.Label lblPageCount; protected System.Web.UI.WebControls.Label lblCurrentIndex; protected System.Web.UI.WebControls.LinkButton btnFirst; protected System.Web.UI.WebControls.LinkButton btnPrev; protected System.Web.UI.WebControls.LinkButton btnNext; protected System.Web.UI.WebControls.LinkButton btnLast; private OleDbConnection cn = new OleDbConnection(); private void Page_Load(object sender, System.EventArgs e) { // 在此处放|用户代码以初始化页? btnFirst.Text = "最首页"; btnPrev.Text = "前一?; btnNext.Text = "下一?; btnLast.Text = "最后页"; OpenDatabase(); BindGrid(); } private void OpenDatabase() { cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("xxxx.mdb"); cn.Open(); } private void ShowStats() { lblCurrentIndex.Text = "W?" + (MyDataGrid.CurrentPageIndex + 1).ToString() + " ?; lblPageCount.Text = "d " + MyDataGrid.PageCount.ToString() + " ?; } public void PagerButtonClick(object sender, EventArgs e) { string arg = ((LinkButton)sender).CommandArgument.ToString(); switch(arg) { case "next": if (MyDataGrid.CurrentPageIndex < (MyDataGrid.PageCount - 1)) { MyDataGrid.CurrentPageIndex += 1; } break; case "prev": if (MyDataGrid.CurrentPageIndex > 0) { MyDataGrid.CurrentPageIndex -= 1; } break; case "last": MyDataGrid.CurrentPageIndex = (MyDataGrid.PageCount - 1); break; default: MyDataGrid.CurrentPageIndex = System.Convert.ToInt32(arg); break; } BindGrid(); ShowStats(); } public void BindGrid() { OleDbConnection myConnection = cn; DataSet ds = new DataSet(); OleDbDataAdapter adapter = new OleDbDataAdapter("Select Title,CreateDate from Document", myConnection); adapter.Fill(ds, "Document"); MyDataGrid.DataSource = ds.Tables["Document"].DefaultView; MyDataGrid.DataBind(); ShowStats(); } public void MyDataGrid_Page(object sender, DataGridPageChangedEventArgs e) { int startIndex ; startIndex = MyDataGrid.CurrentPageIndex * MyDataGrid.PageSize; MyDataGrid.CurrentPageIndex = e.NewPageIndex; BindGrid(); ShowStats(); } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGENQ该调用?ASP.NET Web H体设计器所必需的? // InitializeComponent(); base.OnInit(e); } /// <summary> /// 设计器支持所需的方?- 不要使用代码~辑器修? /// 此方法的内容? /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } }

    VB.NET版本

    DataGridPaging.aspx

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="DataGridPaging.aspx.vb" Inherits="DataGridPaging"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <meta content="Visual Basic 7.0" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" runat="server"> <asp:datagrid id="MyDataGrid" runat="server" AlternatingItemStyle-BackColor="#eeeeee" HeaderStyle-BackColor="#aaaadd" Font-Size="8pt" Font-Name="Verdana" CellSpacing="0" CellPadding="3" GridLines="Both" BorderWidth="1" BorderColor="black" OnPageIndexChanged="MyDataGrid_Page" PagerStyle-HorizontalAlign="Right" PagerStyle-Mode="NumericPages" PageSize="5" AllowPaging="True"> <AlternatingItemStyle BackColor="#EEEEEE"></AlternatingItemStyle> <HeaderStyle BackColor="#AAAADD"></HeaderStyle> <PagerStyle HorizontalAlign="Right" Mode="NumericPages"></PagerStyle> </asp:datagrid> <p style="font-size:9pt"> <asp:label id="lblPageCount" runat="server"></asp:label>&nbsp; <asp:label id="lblCurrentIndex" runat="server"></asp:label> <asp:linkbutton id="btnFirst" onclick="PagerButtonClick" runat="server" Font-Name="verdana" Font-size="8pt" ForeColor="navy" CommandArgument="0"> </asp:linkbutton>&nbsp; <asp:linkbutton id="btnPrev" onclick="PagerButtonClick" runat="server" Font-Name="verdana" Font-size="8pt" ForeColor="navy" CommandArgument="prev"> </asp:linkbutton>&nbsp; <asp:linkbutton id="btnNext" onclick="PagerButtonClick" runat="server" Font-Name="verdana" Font-size="8pt" ForeColor="navy" CommandArgument="next"> </asp:linkbutton>&nbsp; <asp:linkbutton id="btnLast" onclick="PagerButtonClick" runat="server" Font-Name="verdana" Font-size="8pt" ForeColor="navy" CommandArgument="last"> </asp:linkbutton> </p> </form> </body> </HTML>

    DataGridPaging.aspx.vb

    Imports System.Data.SqlClient Imports System.Data Imports System.Web.UI Public Class DataGridPaging Inherits System.Web.UI.Page Protected WithEvents MyDataGrid As System.Web.UI.WebControls.DataGrid Protected WithEvents btnFirst As System.Web.UI.WebControls.LinkButton Protected WithEvents btnPrev As System.Web.UI.WebControls.LinkButton Protected WithEvents btnNext As System.Web.UI.WebControls.LinkButton Protected WithEvents btnLast As System.Web.UI.WebControls.LinkButton Protected WithEvents lblCurrentIndex As System.Web.UI.WebControls.Label Protected WithEvents lblPageCount As System.Web.UI.WebControls.Label Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object,_ ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object,_ ByVal e As System.EventArgs) Handles MyBase.Load btnFirst.Text = "最首页" btnPrev.Text = "前一? btnNext.Text = "下一? btnLast.Text = "最后页" OpenDatabase() BindGrid() End Sub Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs) Dim startIndex As Integer startIndex = MyDataGrid.CurrentPageIndex * MyDataGrid.PageSize MyDataGrid.CurrentPageIndex = e.NewPageIndex BindGrid() ShowStats() End Sub Sub BindGrid() Dim myConnection As SqlConnection = cn Dim ds As DataSet = New DataSet() Dim adapter As SqlDataAdapter = New SqlDataAdapter("Select * from Orders", myConnection) adapter.Fill(ds, "Orders") MyDataGrid.DataSource = ds.Tables("Orders").DefaultView MyDataGrid.DataBind() ShowStats() End Sub Sub PagerButtonClick(ByVal sender As Object, ByVal e As EventArgs) 'used by external paging UI Dim arg As String = sender.CommandArgument Select Case arg Case "next" If (MyDataGrid.CurrentPageIndex < (MyDataGrid.PageCount - 1)) Then MyDataGrid.CurrentPageIndex += 1 End If Case "prev" If (MyDataGrid.CurrentPageIndex > 0) Then MyDataGrid.CurrentPageIndex -= 1 End If Case "last" MyDataGrid.CurrentPageIndex = (MyDataGrid.PageCount - 1) Case Else 'page number MyDataGrid.CurrentPageIndex = System.Convert.ToInt32(arg) End Select BindGrid() ShowStats() End Sub Sub ShowStats() lblCurrentIndex.Text = "W?" + (MyDataGrid.CurrentPageIndex + 1).ToString() + " ? lblPageCount.Text = "d " + MyDataGrid.PageCount.ToString() + " ? End Sub Public cn As New SqlClient.SqlConnection() Public Sub OpenDatabase() cn.ConnectionString = "Server=.;Database=NorthWind;User Id=sa;Password=;" cn.Open() End Sub End Class

    Ҏ2Q完全后代码写法Q?/FONT>例子

    DataGridPaging2.aspx

    <%@ Page language="c#" EnableViewState = "true" Codebehind="DataGridPaging2.aspx.cs" AutoEventWireup="false" Inherits="eMeng.Exam.DataGridPaging2.DataGridPaging2" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>功能齐全的分늚例子??/TITLE> <meta content="Visual Basic 7.0" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" runat="server"> <asp:datagrid id="MyDataGrid" runat="server" AutoGenerateColumns="False" HorizontalAlign="Center" AlternatingItemStyle-BackColor="#eeeeee" HeaderStyle-BackColor="#aaaadd" Font-Size="8pt" Font-Name="Verdana" CellSpacing="0" CellPadding="3" GridLines="Both" BorderWidth="1" BorderColor="black" PagerStyle-HorizontalAlign="Right" PagerStyle-Mode="NumericPages" PageSize="5" AllowPaging="True"> <AlternatingItemStyle BackColor="#EEEEEE"></AlternatingItemStyle> <HeaderStyle BackColor="#AAAADD" Font-Bold="True" HorizontalAlign="Center"></HeaderStyle> <PagerStyle HorizontalAlign="Right" Mode="NumericPages"></PagerStyle> <Columns> <asp:BoundColumn HeaderText="标题" DataField="Title" HeaderStyle-Width="480px"></asp:BoundColumn> <asp:BoundColumn HeaderText="发表日期" DataField="CreateDate" DataFormatString="{0:yyyy-MM-dd hh:mm:ss}"></asp:BoundColumn> </Columns> </asp:datagrid> <p align="center"> <asp:label id="lblPageCount" runat="server" Font-Size="9pt" Font-Bold="True"></asp:label>&nbsp; <asp:label id="lblCurrentIndex" runat="server" Font-Size="9pt" Font-Bold="True"></asp:label> <asp:linkbutton id="btnFirst" runat="server" Font-size="9pt" ForeColor="navy" CommandArgument="0"/>&nbsp; <asp:linkbutton id="btnPrev" runat="server" Font-size="9pt" ForeColor="navy" CommandArgument="prev"/>&nbsp; <asp:linkbutton id="btnNext" runat="server" Font-size="9pt" ForeColor="navy" CommandArgument="next"/>&nbsp; <asp:linkbutton id="btnLast" runat="server" Font-size="9pt" ForeColor="navy" CommandArgument="last"/> </p> </form> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://www.tkk7.com/" title="&#20122;&#27954;&#97;&#118;&#25104;&#20154;&#29255;&#22312;&#32447;&#35266;&#30475;">&#20122;&#27954;&#97;&#118;&#25104;&#20154;&#29255;&#22312;&#32447;&#35266;&#30475;</a> <div class="friend-links"> </div> </div> </footer> վ֩ģ壺 <a href="http://8123pp.com" target="_blank">޳avƬ</a>| <a href="http://tuopumao.com" target="_blank">ձƵѹۿ</a>| <a href="http://xiaochidaquan.com" target="_blank">ۺվɫɫ</a>| <a href="http://1ygogo.com" target="_blank">ѹۿɫƬ</a>| <a href="http://czxgjt.com" target="_blank">99reƵ</a>| <a href="http://zygwkqf.com" target="_blank">a߹ۿַȫ</a>| <a href="http://789xxoo.com" target="_blank">ҹС˵69</a>| <a href="http://www999973.com" target="_blank">ۺƵ</a>| <a href="http://www321fafa.com" target="_blank">ۺϾþҹAV </a>| <a href="http://yaku100.com" target="_blank">˾վ߹ۿ</a>| <a href="http://5ggy.com" target="_blank">߹ۿƵ</a>| <a href="http://vc77777.com" target="_blank">һ</a>| <a href="http://taoh2510.com" target="_blank">aëƬѹۿ</a>| <a href="http://ninidian.com" target="_blank">һػaƬ</a>| <a href="http://qqcnm.com" target="_blank">Ůվ</a>| <a href="http://kkxzz.com" target="_blank">޹ŮƷþþ</a>| <a href="http://tiantiantegou.com" target="_blank">޹Ʒ߹ۿ</a>| <a href="http://iciap.com" target="_blank">99Ļ</a>| <a href="http://8mav958.com" target="_blank">AV12þ</a>| <a href="http://diswooo.com" target="_blank">AVպAV뵼</a>| <a href="http://yulongfilm.com" target="_blank">߹ۿһ</a>| <a href="http://1314a.com" target="_blank">޹ӰԺ</a>| <a href="http://haoda8.com" target="_blank">һһƬѲ</a>| <a href="http://yw762.com" target="_blank">˾Ʒ123Ƶ</a>| <a href="http://jlzjjy.com" target="_blank">Ƶۿ</a>| <a href="http://hmjx-tape.com" target="_blank">߹ۿƵ</a>| <a href="http://wlzp88.com" target="_blank">xxxxxƵ</a>| <a href="http://xxxxyz.com" target="_blank">Ƶ߹ۿƵ</a>| <a href="http://qiseka.com" target="_blank">þùѾƷ</a>| <a href="http://lzlcp.com" target="_blank">ʮ˽վ</a>| <a href="http://www96pg.com" target="_blank">99þþƷƵ</a>| <a href="http://tianwu520.com" target="_blank">99þþùƷţţĴ</a>| <a href="http://3atv3523.com" target="_blank">999߾ƷѲ</a>| <a href="http://yeshenghuowang.com" target="_blank">պѵӰվ</a>| <a href="http://fl6fe.com" target="_blank">91</a>| <a href="http://hongyue8.com" target="_blank">ĻmvӰ</a>| <a href="http://959901cc.com" target="_blank">Ļݺ </a>| <a href="http://628669.com" target="_blank">Ʒһþ</a>| <a href="http://changfafangzhi.com" target="_blank">޾ƷþþþAVƬ</a>| <a href="http://66eeb.com" target="_blank">avҹƷ</a>| <a href="http://taoduoduo666.com" target="_blank">ŷ޹SUV</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body><div id="kgmgm" class="pl_css_ganrao" style="display: none;"><code id="kgmgm"></code><wbr id="kgmgm"></wbr><strike id="kgmgm"></strike><li id="kgmgm"></li><tbody id="kgmgm"><abbr id="kgmgm"><fieldset id="kgmgm"></fieldset></abbr></tbody><li id="kgmgm"></li><tr id="kgmgm"></tr><li id="kgmgm"><dl id="kgmgm"><acronym id="kgmgm"></acronym></dl></li><li id="kgmgm"><tbody id="kgmgm"><del id="kgmgm"></del></tbody></li><td id="kgmgm"><abbr id="kgmgm"><strong id="kgmgm"></strong></abbr></td><small id="kgmgm"><code id="kgmgm"><wbr id="kgmgm"></wbr></code></small><option id="kgmgm"></option><li id="kgmgm"></li><acronym id="kgmgm"></acronym><xmp id="kgmgm"><button id="kgmgm"><source id="kgmgm"></source></button>
    • <tfoot id="kgmgm"><delect id="kgmgm"></delect></tfoot>
    • <li id="kgmgm"><input id="kgmgm"></input></li>
      <abbr id="kgmgm"></abbr>
        <rt id="kgmgm"></rt><rt id="kgmgm"><acronym id="kgmgm"></acronym></rt>
      • <cite id="kgmgm"></cite>
        <tfoot id="kgmgm"><delect id="kgmgm"></delect></tfoot>
        <strike id="kgmgm"></strike>
          <abbr id="kgmgm"></abbr>

          DataGridPaging2.aspx.cs

          using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.OleDb; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace eMeng.Exam.DataGridPaging2 { /// <summary> /// DataGridPaging 的摘要说明? /// </summary> public class DataGridPaging2 : System.Web.UI.Page { protected System.Web.UI.WebControls.DataGrid MyDataGrid; protected System.Web.UI.WebControls.Label lblPageCount; protected System.Web.UI.WebControls.Label lblCurrentIndex; protected System.Web.UI.WebControls.LinkButton btnFirst; protected System.Web.UI.WebControls.LinkButton btnPrev; protected System.Web.UI.WebControls.LinkButton btnNext; protected System.Web.UI.WebControls.LinkButton btnLast; private OleDbConnection cn = new OleDbConnection(); private void Page_Load(object sender, System.EventArgs e) { // 在此处放|用户代码以初始化页? btnFirst.Text = "最首页"; btnPrev.Text = "前一?; btnNext.Text = "下一?; btnLast.Text = "最后页"; OpenDatabase(); BindGrid(); } private void OpenDatabase() { cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath("../../aspxWeb.mdb.ascx"); cn.Open(); } private void ShowStats() { lblCurrentIndex.Text = "W?" + (MyDataGrid.CurrentPageIndex + 1).ToString() + " ?; lblPageCount.Text = "d " + MyDataGrid.PageCount.ToString() + " ?; } public void PagerButtonClick(object sender, EventArgs e) { string arg = ((LinkButton)sender).CommandArgument.ToString(); switch(arg) { case "next": if (MyDataGrid.CurrentPageIndex < (MyDataGrid.PageCount - 1)) { MyDataGrid.CurrentPageIndex += 1; } break; case "prev": if (MyDataGrid.CurrentPageIndex > 0) { MyDataGrid.CurrentPageIndex -= 1; } break; case "last": MyDataGrid.CurrentPageIndex = (MyDataGrid.PageCount - 1); break; default: MyDataGrid.CurrentPageIndex = System.Convert.ToInt32(arg); break; } BindGrid(); ShowStats(); } public void BindGrid() { OleDbConnection myConnection = cn; DataSet ds = new DataSet(); OleDbDataAdapter adapter = new OleDbDataAdapter("Select Title,CreateDate from Document", myConnection); adapter.Fill(ds, "Document"); MyDataGrid.DataSource = ds.Tables["Document"].DefaultView; MyDataGrid.DataBind(); ShowStats(); } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGENQ该调用?ASP.NET Web H体设计器所必需的? // InitializeComponent(); base.OnInit(e); } /// <summary> /// 设计器支持所需的方?- 不要使用代码~辑器修? /// 此方法的内容? /// </summary> private void InitializeComponent() { this.MyDataGrid.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.OnPageIndexChanged); this.btnFirst.Click += new System.EventHandler(this.PagerButtonClick); this.btnPrev.Click += new System.EventHandler(this.PagerButtonClick); this.btnNext.Click += new System.EventHandler(this.PagerButtonClick); this.btnLast.Click += new System.EventHandler(this.PagerButtonClick); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void OnPageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e) { int startIndex ; startIndex = MyDataGrid.CurrentPageIndex * MyDataGrid.PageSize; MyDataGrid.CurrentPageIndex = e.NewPageIndex; BindGrid(); ShowStats(); } } }

          Microhelp 2005-08-22 10:39 发表评论
          ]]>
          ASP.NET之国际化http://www.tkk7.com/Microhelp/articles/9838.htmlMicrohelpMicrohelpThu, 11 Aug 2005 09:33:00 GMThttp://www.tkk7.com/Microhelp/articles/9838.htmlhttp://www.tkk7.com/Microhelp/comments/9838.htmlhttp://www.tkk7.com/Microhelp/articles/9838.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/9838.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/9838.htmlASP.NET的国际化思想和Java{语a基本相同。都是通过资源文g查找相应的内宏V?BR>要知道ASP.NET如何国际化,让我们从后面说v?BR>一、原?BR>public virtual string GetString(
            
          string name,
            
          CultureInfo culture
          );
          name是资源的ID.CultureInfo是一个用来表C文化的cR?BR>
          可以用如下方法初始化
          culture
          public static CultureInfo CreateSpecificCulture(
            
          string name
          );
          我们可以初始化一个叫abc的文化CultureInfo.CreateSpecificCulture("abc")
          ResourceManagerc通过如下的方法来定资源文g的名字和路径
          public static
          ResourceManager CreateFileBasedResourceManager(
            
          string baseName,
            
          string resourceDir,
            
          Type usingResourceSet
          );

          CreateFileBasedResourceManager("business","D:\Poi Project\LTS2005\resources\"_
                                         +System.IO.Path.DirectorySeparatorChar,null);
          表示资源文g的\径是QD:\Poi Project\LTS2005\resources\Q文件名是business.*.resources
          如果
          CultureInfo是abc那么GetString在D:\Poi Project\LTS2005\resources\business.abc.resources
          文gҎ相应的资源ID扑ֈ所需要的资源
          二:如何制作资源文g
          使用 resgen 从文本文件编译资源文Ӟ
          “resgen strings.txt”生成一个名?strings.resources 的文?BR>resgen 的位|在Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin?BR>strings.txt的格式如下所C:
          Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q?BR>
          ;提示
          promptCulture = 请选择希望用来查看此示例的区域?==>
          promptName = 误入您的姓?==>

          ;距离
          dist1 = Q以英里为单位)==>

          ;温度量度
          degree1 = 以华氏度为单位:
          degree2 = -100
          degree3 = 140


          Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-Q-
          注:我们可以通过CultureInfo关键字在MSDN中查找资源国家代?/FONT>



          Microhelp 2005-08-11 17:33 发表评论
          ]]>
          ASP.NET之版本问?/title><link>http://www.tkk7.com/Microhelp/articles/8379.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Mon, 25 Jul 2005 01:30:00 GMT</pubDate><guid>http://www.tkk7.com/Microhelp/articles/8379.html</guid><wfw:comment>http://www.tkk7.com/Microhelp/comments/8379.html</wfw:comment><comments>http://www.tkk7.com/Microhelp/articles/8379.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/Microhelp/comments/commentRss/8379.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Microhelp/services/trackbacks/8379.html</trackback:ping><description><![CDATA[<STRONG><FONT face=Arial color=#000080 size=4>参考链?A ><FONT face=Arial color=#0000ff size=4>http://www.asp.net/faq/SideBySide.aspx</FONT></A><BR><BR>1.如何查找当前WEB应用E序?NET版本<BR></FONT></STRONG><FONT face=Arial color=#000080 size=4>在Internet信息服务中,选择你想了解的WEB应用E序<BR><BR><IMG height=480 alt=a.gif src="http://www.tkk7.com/images/blogjava_net/microhelp/net/ASP.NET之版本问?a.gif" width=640 border=0><BR>鼠标右键点击该应用程序,在弹单中点击"属?<BR><IMG height=430 alt=b.gif src="http://www.tkk7.com/images/blogjava_net/microhelp/net/ASP.NET之版本问?b.gif" width=640 border=0><BR>在属性窗口,点击"配置"按钮<BR><IMG height=447 alt=c.gif src="http://www.tkk7.com/images/blogjava_net/microhelp/net/ASP.NET之版本问?c.gif" width=461 border=0><BR>在应用程序映窗口中Q选择.aspxQƈ点击~辑按钮<BR><IMG height=455 alt=d.gif src="http://www.tkk7.com/images/blogjava_net/microhelp/net/ASP.NET之版本问?d.gif" width=406 border=0><BR>在可执行文g文本框中Q查看版本目录名。如果版本目录名为v.1.1.4322Q则其映ؓ.NET框架1.1版本Q如果目录名为v1.0.3705Q则表示应用E序映射?NET 1.0版本?BR><IMG height=250 alt=e.gif src="http://www.tkk7.com/images/blogjava_net/microhelp/net/ASP.NET之版本问?e.gif" width=429 border=0><BR><BR></FONT><FONT face=Arial color=#000080 size=4><STRONG>2.讄不同的WEB应用E序使用指定版本?NET框架</STRONG><BR></FONT> <P><FONT face=Arial color=#000080 size=4>每个不同版本?NET框架都包含ASP.NET IIS注册工具(Aspnet_regiis.exe)。该工具允许理员指定WEB应用E序q行在不同的.NET框架中。不同版?NET框架的aspnet_regiis.exe存在于各自的目录下,例如理员希望指定某个网站?.1版本?NET框架Q则必须使用.NET框架1.1所在目录下的aspnet_regiis.exe文g?BR></FONT></P><BR> <P><BR><FONT face=Arial color=#000080 size=4>.NET框架1.0版本中的aspnet_regiis.exe位于Q?BR></FONT> <UL> <LI><FONT face=Arial color=#000080 size=4>C:\WINDOWS\Microsoft.NET\Framework\<STRONG>v1.0.3705</STRONG>\aspnet_regiis<BR><BR>.NET框架1.1版本中的aspnet_regiis.exe位于Q?BR></FONT> <LI><FONT face=Arial color=#000080 size=4>C:\WINDOWS\Microsoft.NET\Framework\<STRONG>v1.1.4322</STRONG>\aspnet_regiis<BR><BR>aspnet_regiis.exe提供两个选项Q?BR></FONT><BR> <LI><FONT face=Arial><FONT size=4><FONT color=#000080><STRONG>–s <PATH></STRONG>指定当前路径及其子目录用该当前脚本配置<BR></FONT></FONT></FONT> <LI><FONT face=Arial><FONT size=4><FONT color=#000080><STRONG>–sn <PATH></STRONG>仅指定当前\径用该脚本配置<BR><BR>路径是指WEB应用E序在IIS中的元数据\径,其Ş式ؓ W3SVC/ROOT/{WebSiteNumber}/{Application_Name}. 举例来讲Q名为Portal的WEB应用E序在默认WEB站点下,则其路径?W3SVC/1/ROOT/Portal?/FONT></FONT></FONT></LI></UL> <P><FONT face=Arial color=#000080 size=4><IMG height=480 alt=f.gif src="http://www.tkk7.com/images/blogjava_net/microhelp/net/ASP.NET之版本问?f.gif" width=640 border=0><BR>注:你也可以使用名ؓMetabase Editor的工h获得应用E序的元路径。可以在微Y|站?/FONT><A target=_blank><FONT face=Arial color=#000080 size=4>http://support.microsoft.com/default.aspx?scid=kb;en-us;232068.</FONT></A><FONT face=Arial color=#000080 size=4> 下蝲?BR>q行"Aspnet_regiis.exe –s W3SVC/1/ROOT/Portal"来指定portal及其子目录的应用E序使用该当前脚本配|?/FONT></P> <P><FONT face=Arial color=#000080 size=4><IMG height=288 alt=g.gif src="http://www.tkk7.com/images/blogjava_net/microhelp/net/ASP.NET之版本问?g.gif" width=600 border=0><BR>q行"Aspnet_regiis.exe –sn W3SVC/1/ROOT/Portal"来指定portal使用该脚本配|,不媄响其子目录中的应用程?BR><IMG height=288 alt=h.gif src="http://www.tkk7.com/images/blogjava_net/microhelp/net/ASP.NET之版本问?h.gif" width=600 border=0></FONT></P><img src ="http://www.tkk7.com/Microhelp/aggbug/8379.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Microhelp/" target="_blank">Microhelp</a> 2005-07-25 09:30 <a href="http://www.tkk7.com/Microhelp/articles/8379.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Asp.net如何打开一个已l存在的工程http://www.tkk7.com/Microhelp/articles/7247.htmlMicrohelpMicrohelpThu, 07 Jul 2005 02:35:00 GMThttp://www.tkk7.com/Microhelp/articles/7247.htmlhttp://www.tkk7.com/Microhelp/comments/7247.htmlhttp://www.tkk7.com/Microhelp/articles/7247.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/7247.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/7247.html例如Q我的工E在D:\Poi Project\0706目录下。打开sln文g。编辑它可以看到一个url。我的是Q?/FONT>http://localhost/prjPOI1/prjPOI1.csproj。到IIS下徏立一个虚拟目录名字ؓprjPOI1。\径是D:\Poi Project\0706。这时再双击sln文g卛_打开工程?/FONT>

          Microhelp 2005-07-07 10:35 发表评论
          ]]>
          ASP.NET WEB FORMS 面间的传值方?/title><link>http://www.tkk7.com/Microhelp/articles/7118.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Tue, 05 Jul 2005 02:16:00 GMT</pubDate><guid>http://www.tkk7.com/Microhelp/articles/7118.html</guid><wfw:comment>http://www.tkk7.com/Microhelp/comments/7118.html</wfw:comment><comments>http://www.tkk7.com/Microhelp/articles/7118.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/Microhelp/comments/commentRss/7118.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Microhelp/services/trackbacks/7118.html</trackback:ping><description><![CDATA[<P class=postText align=center><STRONG><FONT face=Arial color=#000080 size=4>ASP.NET WEB FORMS 面间的传值方?/FONT></STRONG></P> <P class=postText><FONT face=Arial color=#000080 size=4>       ASP.NET WEB FORMS  l开发者提供了极好的事仉动开发模式。然而这U简单的应用E序开发模式却l我们带来了一些小问题QD个例子,在传l的ASP应用E序中,你能够通过POSTҎ很容易的把一个值或多个g一个页面传送到另一个页面,用同LҎ在ASP.NET中实现有炚w烦。在q里Q我们可以通过其他方式来解册U情形。ASP.NET为我们提供了三种方式Q一U是可以通过用QueryString来传送相应的|再一U是通过session变量来传送相应的|q有是通过Server.TransferҎ来实现。下面分别一一介绍Q?/FONT></P> <P class=postText><BR><FONT face=Arial><FONT size=4><FONT color=#000080><STRONG>一、用Querystring</STRONG><BR>Querystring是一U非常简单的传值方式,其缺点就是会把要传送的值显C在览器的地址栏中Qƈ且在此方法中不能够传递对象。如果你想传递一个安全性不是那么太重要或者是一个简单的数值时Q用此方法最好不q了。下面通过一个小例子来完成传值工作,步骤如下Q?BR>1、创Z个web form<BR>2、在新徏的web form中放|一个button1Q在攄两个TextBox1,TextBox2 <BR>3、ؓbutton按钮创徏click事g<BR>代码如下Q?BR>private void Button1_Click<BR>(object sender, System.EventArgs e)<BR>{<BR> string url;<BR> url="webform2.aspx?name=" + <BR>  TextBox1.Text + "&email=" + <BR>  TextBox2.Text;<BR> Response.Redirect(url);<BR>}<BR>4、新Z个目标页面命名ؓwebform2<BR>5、在webform2中放|两个Label1,Label2<BR>在webform2的Page_Load中添加如下代码:<BR>private void Page_Load<BR>(object sender, System.EventArgs e)<BR>{<BR> Label1.Text=Request.QueryString["name"];<BR> Label2.Text=Request.QueryString["email"];<BR>}<BR>q行,卛_看到传递后的结果了?/FONT></FONT></FONT></P> <P class=postText><STRONG><FONT face=Arial color=#000080 size=4>二、用Session变量</FONT></STRONG></P> <P class=postText><FONT face=Arial color=#000080 size=4>使用Session变量传值是一U最常见的方式了Q此中方式不仅可以把g递到下一个页面,q可以交叉传递到多个面Q直xSession变量的值removed后,变量才会消失。D个例子看看:<BR>1、创Z个web form<BR>2、在新徏的web form中放|一个button1Q在攄两个TextBox1,TextBox2 <BR>3、ؓbutton按钮创徏click事g<BR>代码如下Q?BR>private void Button1_Click<BR>(object sender, System.EventArgs e)<BR>{<BR>        Session["name"]=TextBox1.Text;<BR> Session["email"]=TextBox2.Text;<BR> Response.Redirect("webform2.aspx");<BR>}<BR>4、新Z个目标页面命名ؓwebform2<BR>5、在webform2中放|两个Label1,Label2<BR>在webform2的Page_Load中添加如下代码:<BR>private void Page_Load<BR>(object sender, System.EventArgs e)<BR>{<BR> Label1.Text=Session["name"].ToString();<BR> Label2.Text=Session["email"].ToString();<BR> Session.Remove("name");<BR> Session.Remove("email");<BR>}<BR>q行,卛_看到传递后的结果了?/FONT></P> <P class=postText><FONT face=Arial><FONT size=4><FONT color=#000080><STRONG>三、用Server.Transfer</STRONG><BR>虽然q种Ҏ有点复杂Q但也不׃ؓ一U在面传值的方式?BR>举个例子看看Q?BR>1、创Z个web form<BR>2、在新徏的web form中放|一个button1Q在攄两个TextBox1,TextBox2 <BR>3、ؓbutton按钮创徏click事g<BR>代码如下Q?BR>private void Button1_Click<BR>(object sender, System.EventArgs e)<BR>{<BR> Server.Transfer("webform2.aspx");<BR>}<BR>4、创E来q回TextBox1,TextBox2控g的g码如下:<BR>public string Name<BR>{<BR> get<BR> {<BR>  return TextBox1.Text;<BR> }<BR>}</FONT></FONT></FONT></P> <P class=postText><FONT face=Arial color=#000080 size=4>public string EMail<BR>{<BR> get<BR> {<BR>  return TextBox2.Text;<BR> }<BR>}<BR>5、新Z个目标页面命名ؓwebform2<BR>6、在webform2中放|两个Label1,Label2<BR>在webform2的Page_Load中添加如下代码:<BR>private void Page_Load<BR>(object sender, System.EventArgs e)<BR>{<BR> //创徏原始H体的实?BR> WebForm1 wf1;<BR> //获得实例化的句柄<BR> wf1=(WebForm1)Context.Handler;<BR> Label1.Text=wf1.Name;<BR> Label2.Text=wf1.EMail;</FONT></P> <P class=postText><FONT face=Arial color=#000080 size=4>}<BR>q行,卛_看到传递后的结果了?/FONT></P><img src ="http://www.tkk7.com/Microhelp/aggbug/7118.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Microhelp/" target="_blank">Microhelp</a> 2005-07-05 10:16 <a href="http://www.tkk7.com/Microhelp/articles/7118.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Asp.NET初试(4)http://www.tkk7.com/Microhelp/articles/6872.htmlMicrohelpMicrohelpWed, 29 Jun 2005 05:43:00 GMThttp://www.tkk7.com/Microhelp/articles/6872.htmlhttp://www.tkk7.com/Microhelp/comments/6872.htmlhttp://www.tkk7.com/Microhelp/articles/6872.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/6872.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/6872.htmlDataGrid的?BR>
          <%@ Page Language="C#" AutoEventWireup="True" %>
          <%@ Import Namespace="System.Data" %>
           
          <html>
             <script language="C#" runat="server">
           
                ICollection CreateDataSource()
                {
                   DataTable dt = new DataTable();
                   DataRow dr;
           
                   dt.Columns.Add(new DataColumn("ID        ", typeof(Int32)));
                   dt.Columns.Add(new DataColumn("Name      ", typeof(string)));
                   dt.Columns.Add(new DataColumn("Address   ", typeof(string)));
           
                   for (int i = 0; i < 9; i++)
                   {
                      dr = dt.NewRow();
           
                      dr[0] = i;
                      dr[1] = "Name " + i.ToString();
                      dr[2] = "Address " + i.ToString();
           
                      dt.Rows.Add(dr);
                   }
           
                   DataView dv = new DataView(dt);
                   return dv;
                }
           
                void Page_Load(Object sender, EventArgs e)
                {
           
                   if (!IsPostBack)
                   {
                      // Load this data only once.
                      ItemsGrid.DataSource= CreateDataSource();
                      ItemsGrid.DataBind();
                   }
                }
           
             </script>
           
          <body>
           
             <form runat=server>
           
                <h3>DataGrid Example</h3>
           
                <b>Product List</b>
           
                <asp:DataGrid id="ItemsGrid"
                     BorderColor="black"
                     BorderWidth="2"
                     CellPadding="3"
                     AutoGenerateColumns="true"
                     runat="server">
                     
          <HeaderStyle BackColor="#00aa0a">
                    </HeaderStyle> 
                </asp:DataGrid>
           
             </form>
           
          </body>
          </html>



          Microhelp 2005-06-29 13:43 发表评论
          ]]>
          NUnit 的?1)http://www.tkk7.com/Microhelp/articles/6822.htmlMicrohelpMicrohelpTue, 28 Jun 2005 08:34:00 GMThttp://www.tkk7.com/Microhelp/articles/6822.htmlhttp://www.tkk7.com/Microhelp/comments/6822.htmlhttp://www.tkk7.com/Microhelp/articles/6822.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/6822.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/6822.html在说NUnit之前Q不得不?一下TDD.
          1.TDD介绍
          首先什么是TDD?全称应该是Test-Driven Development。Kent Beck在他?lt;<试驱动开?>>(Addison-Wesley Professional,2003)一书中,使用下面2个原则来定义TDD:
          ·        除非你有一个失败的自动试,永远不要写一单行代码.
          ·        L重复
          2.NUnit的介l?/strong>
          NUnit是一个单元测试框?专门针对?NET来写?其实在前面有JUnit(Java),CPPUnit(C++),他们都是xUnit的一?最?它是从JUnit而来.现在的版本是2.2.接下来我所用的都是Zq个版本.
          NUnit最初是由James W. Newkirk, Alexei A. Vorontsov 和Philip A. Craig, 后来开发团队逐渐庞大h.在开发过E中, Kent Beck 和Erich Gamma2位牛Z提供了许多帮?看来对于NUnitq真是下了一番力气了.J
           NUnit是xUnit家族U的W?个主打?完全由C#语言来编?q且~写时充分利用了许多.NET的特?比如反射,客户属性等{?
          最重要的一Ҏ它适合于所?NET语言.
          如果你还没有下蝲,可以?/font>http://www.nunit.org/M?
          下面我们先做一个最单的例子?br>打开.net的开发环境,新徏一个c#工程?br>ProjectQ?gt;Add Reference 中添加nunit.framework.dll?br>d一个类Q内容如下:
          using System;
          using NUnit.Framework;
          namespace PoiUnit
          {
           /// <summary>
           /// Summary description for Util.
           /// </summary>
           
           [TestFixture]
           public class Util
           {
            public Util()
            {
             //
             // TODO: Add constructor logic here
             //
            }
            [SetUp]
            public void Setup()
            {
             // Do something...
            }
            [Test]
            public void TestOne()
            {
             int i = 3;
             Assert.AreEqual( 3, i );
            }
            [TearDown]
            public void TearDown()
            {
             // Do something...
            }
           }
          }
          ~译?br>打开NunitQOpen~译好的exe文g?br>1.jpg
          点击RUN。可以看到绿色的昄。表C测试通过Q如果没有通过Q将是红艌Ӏ?br>2.jpg
           
          在本例中Q?font color=#000080 size=4> TestOne是一个简单的试ҎQ测试i 是否{于3Q结果是肯定的。所以运行完为绿Ԍ表示试通过。如果将i的值改?Q那么Nunitq行的结果应该ؓU色


          Microhelp 2005-06-28 16:34 发表评论
          ]]>Asp.NET初试(3)http://www.tkk7.com/Microhelp/articles/6816.htmlMicrohelpMicrohelpTue, 28 Jun 2005 07:39:00 GMThttp://www.tkk7.com/Microhelp/articles/6816.htmlhttp://www.tkk7.com/Microhelp/comments/6816.htmlhttp://www.tkk7.com/Microhelp/articles/6816.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/6816.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/6816.html事务控制Qform上添加一个Label1和buttonQ将下面代码加入button的click事g?BR>
          string myConnString ="Jet OLEDB:Database Password=;Data Source=\"C:\\db1.mdb\";Password=;Provider=\"Microsoft.Jet.OLEDB.4.0\";User ID=Admin";
             OleDbConnection myConnection = new OleDbConnection(myConnString);
             myConnection.Open();

             OleDbCommand myCommand = myConnection.CreateCommand();
             OleDbTransaction myTrans;

             myTrans = myConnection.BeginTransaction(IsolationLevel.ReadCommitted);
             myCommand.Connection = myConnection;
             myCommand.Transaction = myTrans;
             try
             {
              myCommand.CommandText = "Insert into test (name, address) VALUES ('Liu', 'Japan')";
              myCommand.ExecuteNonQuery();
              myCommand.CommandText = "Insert into test (name, address) VALUES ('Mark',              Germany')";
              myCommand.ExecuteNonQuery();
              myTrans.Commit();
              Console.WriteLine("Both records are written to database.");
             }
             catch(Exception ex)
             {
              try
              {
               myTrans.Rollback();
              }
              catch (OleDbException oex)
              {
               if (myTrans.Connection != null)
               {
                this.Label1.Text = this.Label1.Text + oex.GetType() ;
               }
              }
            
              this.Label1.Text =  this.Label1.Text + ex.GetType();
              this.Label1.Text = this.Label1.Text+"Neither record was written to database";
             }
             finally
             {
              myConnection.Close();
             }
          点击后即可在test表中加入记录



          Microhelp 2005-06-28 15:39 发表评论
          ]]>
          Asp.NET初试(2) http://www.tkk7.com/Microhelp/articles/6811.htmlMicrohelpMicrohelpTue, 28 Jun 2005 07:10:00 GMThttp://www.tkk7.com/Microhelp/articles/6811.htmlhttp://www.tkk7.com/Microhelp/comments/6811.htmlhttp://www.tkk7.com/Microhelp/articles/6811.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/6811.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/6811.html动态执行sql查询Q鉴于图形方式不够灵z,q里使用动态代码重新做上次的内宏V?BR>界面上不再需要OleDbConnection和OleDbDataAdapter。只要有一个datagrid?BR>d一个按钮。在按钮的点M件中增加如下代码QmyConnString 可以从上ơ的囑Ş界面的OleDbConnection属性得?删除部分无用的信息,保留数据源、用戗密码等主要信息Q:

             string myConnString ="Jet OLEDB:Database Password=;Data Source=\"C:\\db1.mdb\";
                                                     Password=;Provider=\"Microsoft.Jet.OLEDB.4.0\";User ID=Admin";

             string querySql ="select * from test where name <> 'aa'"; 
             //新徏一个OleDbConnectionQ一个OleDbDataAdapter
             OleDbConnection myConnection = new OleDbConnection(myConnString);
             OleDbDataAdapter adapter = new OleDbDataAdapter(querySql,myConnection);
             adapter.SelectCommand = new OleDbCommand(querySql, myConnection);
             DataSet ds = new DataSet();
             this.DataGrid1.DataSource=ds;
             adapter.Fill(ds);
             this.DataGrid1.DataBind();
            点击按钮之后Q就可以看到按照你的Sql得到的检索结?BR>  OleDbCommand q支持在查询中用动态参数。上面的例子l过修改如下Q?/FONT>
            string myConnString ="Jet OLEDB:Database Password=;Data Source=\"C:\\db1.mdb\";Password=;
                                                      Provider=\"Microsoft.Jet.OLEDB.4.0\";User ID=Admin";
             string querySql ="select * from test where name  = @name";
             //新徏一个OleDbConnectionQ一个OleDbDataAdapter
             OleDbConnection myConnection = new OleDbConnection(myConnString);
             OleDbDataAdapter adapter = new OleDbDataAdapter(querySql,myConnection);
             OleDbCommand myCommand  = new OleDbCommand(querySql, myConnection);
             
             
          OleDbParameter myParm = new OleDbParameter("@name",OleDbType.VarChar,50);
             myParm.Value="Liu";
             myCommand.Parameters.Add(myParm );
             adapter.SelectCommand =myCommand;
            DataSet ds = new DataSet();
             this.DataGrid1.DataSource=ds;
             adapter.Fill(ds,"test");
             this.DataGrid1.DataBind();
            q样点击按钮之后可以检索到名字是“Liu”的数据



          Microhelp 2005-06-28 15:10 发表评论
          ]]>
          Asp.NET初试(1)http://www.tkk7.com/Microhelp/articles/6779.htmlMicrohelpMicrohelpMon, 27 Jun 2005 09:17:00 GMThttp://www.tkk7.com/Microhelp/articles/6779.htmlhttp://www.tkk7.com/Microhelp/comments/6779.htmlhttp://www.tkk7.com/Microhelp/articles/6779.html#Feedback0http://www.tkk7.com/Microhelp/comments/commentRss/6779.htmlhttp://www.tkk7.com/Microhelp/services/trackbacks/6779.html环境Q?/SPAN>.NET 2003 + XP professional + Access 2003

          W一?/SPAN>Q在以上pȝ及Y件安装就l的情况下,配置IIS服务。(注意Q如果没有安?/SPAN>FrontPage 扩展服务Q在安装 .Net时会提示。安装提C,在添加删除组件中dFrontPage扩展服务 卛_Q?/SPAN>

          控制面板Q?/SPAN>>d删除E序Q?/SPAN>>d删除windowslg

          选择iis服务Q安默认安装?/SPAN>

          理工具Q?/SPAN>>Internet 信息服务,q里可以更改ȝ录的路径Q也可以保持默认倹{?/SPAN>

          W二?/SPAN>Q在ACCESS中徏?/SPAN>

          建立I白数据库,建立?/SPAN>AddressQ?/SPAN>id,name,addressQ添加两条数据。关?/SPAN>Access?/SPAN>

          W三?/SPAN>Q打开.NetQ新Z个工E?/SPAN>

          新徏工程Q?/SPAN>Project Types 选择cQ,Template选择Asp.NET Web Application(q里要注意,W一ơ用时会蟩出如下的对话框,要安帮助信息注册Asp.net)
          a.jpgb.jpg

          在旁边的Toolbox拖一个按钮?/SPAN>

          ?/SPAN>data区拖一?/SPAN>oledbdataadapter。按照向导如下?/SPAN>

          1.jpg2.jpg
          3.jpg
          4.jpg
          5.jpg
          6.jpg

          叛_oledbdataadapter1?/SPAN>Genertate dataset

          ?/SPAN>webform中选择datagrid。设|?/SPAN>datasource?/SPAN>dataset1

          在按钮的点击事g中增加如下代码:

          this.oleDbDataAdapter1.Fill(this.dataSet11);

          this.DataGrid1.DataBind();

          q行。点L钮就可以看到数据表中的数据了?/FONT>




          Microhelp 2005-06-27 17:17 发表评论
          ]]>