锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲精品无码你懂的,亚洲免费在线播放,亚洲精品无码不卡在线播放http://www.tkk7.com/tw-ddm/category/13837.html<div id="ddm_subTitle"> <h2 class="catchline"> 鍝曟病鏈夊姙娉曚竴瀹氭湁璇存硶,<br/> 灝辯畻娌℃湁楦藉瓙涓瀹氭湁涔岄甫,<br/> 鍥烘墽鏃犵姜&nbsp;姊︽兂鏈変環(huán),<br/> 璁╀粬浠儕璁? </h2> </div>zh-cnWed, 28 Feb 2007 22:56:43 GMTWed, 28 Feb 2007 22:56:43 GMT60GridView鍦―ataTable絀鴻鏃朵笉鏄劇ず鐨勫鐞?/title><link>http://www.tkk7.com/tw-ddm/articles/71625.html</link><dc:creator>澶уぇ姣?/dc:creator><author>澶уぇ姣?/author><pubDate>Sun, 24 Sep 2006 18:00:00 GMT</pubDate><guid>http://www.tkk7.com/tw-ddm/articles/71625.html</guid><wfw:comment>http://www.tkk7.com/tw-ddm/comments/71625.html</wfw:comment><comments>http://www.tkk7.com/tw-ddm/articles/71625.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/tw-ddm/comments/commentRss/71625.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/tw-ddm/services/trackbacks/71625.html</trackback:ping><description><![CDATA[ <font size="2"> <br />聽聽聽<strong>闂錛?/strong><br /><br />聽聽聽聽聽聽GridView鎺т歡搴旂敤寰堟槸騫挎硾錛岄氬父灝嗗畠涓嶥ataSourceControl鎼厤浣跨敤錛屽綋鐒朵篃鍙互鎵嬪伐鎸囧畾DataSource灞炴ф潵瀹屾垚鏁版嵁緇戝畾銆傚鏋?strong>鏁版嵁婧愯繑鍥炰竴涓┖琛岀殑鏁版嵁闆?/strong>(渚嬪鏌ヨ涓嶅埌鎸囧畾璁板綍絳?鏃訛紝灝嗕細(xì)鍑虹幇涓ょ鎯呭喌錛?br />聽聽聽聽聽聽1.褰揋ridView鏈寚瀹?lt;EmptyDataTemplate>鎴朎mptyDataText灞炴ф椂錛屾帶浠跺皢涓嶄細(xì)琚渶緇堢敓鎴愶紝緗戦〉涓婄殑琛ㄧ幇涓虹┖鐧斤紝榪欐牱涓嶄粎鎰熻涓嶇埥錛岃屼笖寰堝鏄撻犳垚甯冨眬鐨勫彉褰€?br />聽聽聽聽聽聽2.濡傛灉鎸囧畾浜?lt;EmptyDataTemplate>鎴朎mptyDataText灞炴э紝緗戦〉涓婂皢鏈緇堜駭鐢熶竴涓猼able鍏冪礌錛屽畠鍏鋒湁涓琛屼竴鏍鹼紝鍙互鏄劇ず鍑鴻緗殑鎻愮ず淇℃伅錛屼絾鏄繖縐嶆儏鍐典笅璇able灝嗕笉浼?xì)鏄窘C哄嚭琛ㄥご鏉ャ?br />聽聽聽聽聽聽閫氬父甯屾湜鐨勬槸錛屽嵆浣挎暟鎹簮榪斿洖涓涓┖琛岀殑鏁版嵁闆嗭紝浣嗘槸鍘熸湁鐨凾able鍏冪礌涔熷簲璇ヨ鏄劇ず鍑烘潵錛屽畠搴旇甯︿竴涓〃澶磋錛屼互鍙?qiáng)涓涓┖鐧借銆?br /><br /><br />聽聽聽<strong>瑙e喅鍔炴硶錛?/strong><br /><br />聽聽聽聽聽聽閫氳繃鎵嬪伐鍚戞暟鎹簮娣誨姞涓涓柊琛屽嵆鍙В鍐熾傚湪姝よ繃紼嬪簲璇ュ鐞嗗ソ浠ヤ笅鍑犱釜鏂歸潰鐨勪簨鎯呫?br />聽聽聽聽聽聽1.鍦?New 涓琛屾椂錛屽鏋滃寘鍚富閿垪錛屽垯璇ュ垪鐨勫間細(xì)琚嚜鍔ㄨ祴鍊?濡?int 鍒椾細(xì)琚祴鍊?0 )銆傚姝ゅ簲璇ユ墜宸ュ皢鏂拌鐨勬瘡涓鍒楅兘璧嬪間負(fù) DBNull.Value聽錛?br />聽聽聽聽聽聽2.鐢變簬鍙兘瀛樺湪鏈夐潪絀虹害鏉燂紝浼?xì)閫犳垚鎻掑叆澶辮觸錛屽洜姝ゅ繀欏繪墜宸ュ皢姣忎竴鍒楃殑 AllowDBNull 灞炴ч噸鏂拌瀹?br />聽聽聽聽聽聽浠ヤ笅紺轟緥 GridView 緇戝畾鑷?ObjectDataSource 鏃剁殑澶勭悊浠g爜錛?br /><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="Code_Closed_Image_000234" onclick="this.style.display='none'; Code_Closed_Text_000234.style.display='none'; Code_Open_Image_000234.style.display='inline'; Code_Open_Text_000234.style.display='inline';" height="16" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" /><img id="Code_Open_Image_000234" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text_000234.style.display='none'; Code_Closed_Image_000234.style.display='inline'; Code_Closed_Text_000234.style.display='inline';" height="16" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><span id="Code_Closed_Text_000234" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><strong>Selected浜嬩歡</strong></span><span id="Code_Open_Text_000234" style="DISPLAY: none"><br /><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="COLOR: #000000">聽聽聽聽</span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">聽ObjectDataSource2_Selected(</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000">聽sender,聽ObjectDataSourceStatusEventArgs聽e)聽{<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">杞瀷鍒癉ataTable</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽DataTable聽table聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽(DataTable)e.ReturnValue;<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">濡傛灉榪斿洖鐨勬槸寮犵┖琛?/span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(table.Rows.Count聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)聽{<br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">鐢熸垚DataRow瀵硅薄</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽聽聽聽聽DataRow聽row聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽table.NewRow();<br /><br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">foreach</span><span style="COLOR: #000000">聽(DataColumn聽col聽</span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">聽table.Columns)聽{<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">閲嶆柊璁劇疆AllowDBNull灞炴?/span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽col.AllowDBNull聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">;<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">鏄懼紡璧嬪兼垚null</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽row[col]聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽DBNull.Value;<br />聽聽聽聽聽聽聽聽聽聽聽聽}<br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">灝咲ataRow瀵硅薄娣誨姞鑷硉able涓?/span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽聽聽聽聽table.Rows.Add(row);<br />聽聽聽聽聽聽聽聽}<br /><br />聽聽聽聽}</span></span></div><br />聽聽聽聽聽聽鏁堟灉紺烘剰濡備笅錛?br /><table cellspacing="0" cellpadding="0" width="300" border="1"><tbody><tr><th>鏍囬1</th><th>鏍囬2</th><th>鏍囬...</th></tr><tr><td>聽</td><td>聽</td><td>聽</td></tr></tbody></table><br />聽聽聽聽聽聽灝辨鏉ヨ鏁堟灉騫朵笉鏄崄鍒嗙悊鎯籌紝濡傛灉鑳藉瀹炵幇浠ヤ笅鐨勬晥鏋滈偅灝辨洿濂戒簡(jiǎn)錛?<br /><table cellspacing="0" cellpadding="0" width="300" border="1"><tbody><tr><th>鏍囬1</th><th>鏍囬2</th><th>鏍囬...</th></tr><tr><td align="middle" colspan="3"><font color="red" size="2">娌℃湁鏌ユ壘鍒扮鍚堟潯浠剁殑璁板綍</font></td></tr></tbody></table><p><br />聽聽聽聽聽聽涓鴻揪鎴愮洰鐨勶紝榪橀渶瑕佸湪 GridView 涓姞涓鐐瑰皬鏀硅繘錛屽鐞嗕竴涓嬮偅涓┖琛屻?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="Code_Closed_Image_014310" onclick="this.style.display='none'; Code_Closed_Text_014310.style.display='none'; Code_Open_Image_014310.style.display='inline'; Code_Open_Text_014310.style.display='inline';" height="16" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" /><img id="Code_Open_Image_014310" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text_014310.style.display='none'; Code_Closed_Image_014310.style.display='inline'; Code_Closed_Text_014310.style.display='inline';" height="16" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><span id="Code_Closed_Text_014310" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><strong>DataBound浜嬩歡</strong></span><span id="Code_Open_Text_014310" style="DISPLAY: none"><br /><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="COLOR: #000000">聽聽聽聽</span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">聽GridView1_DataBound(</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000">聽sender,聽EventArgs聽e)聽{<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">濡傛灉鏄┖琛?鍒ゆ柇鏉′歡涓?琛屾暟=1涓斾富閿垪=DBNull.Value,濡傛灉闇瑕佸尯鍒嗘槸鍒濆鍖?鎻愪氦鐘舵?鍙互鍔犲叆聽Page.IsPostBack 鍒ゆ柇</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(GridView1.DataKeys.Count聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000">聽GridView1.DataKeys[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">].Values[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽DBNull.Value)聽{<br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">娓呴櫎鎺夎絀鴻鐨勫叏閮ㄥ崟鍏冩牸</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽聽聽聽聽GridView1.Rows[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">].Cells.Clear();<br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">鏂板緩鍗曞厓鏍煎璞?/span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽聽聽聽聽TableCell聽cell聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽TableCell();<br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">鍚堝茍鍗曞厓鏍?/span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽聽聽聽聽cell.ColumnSpan聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽GridView1.Columns.Count;<br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">GridView1.EmptyDataText宸茬粡璁劇疆涓郝犅?娌℃湁鏌ユ壘鍒扮鍚堟潯浠剁殑璁板綍"<br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">璁劇疆鍗曞厓鏍煎唴瀹逛負(fù)GridView1.EmptyDataText,鎶婃彁紺烘枃鏈粰鍒嗙鍑烘潵</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽聽聽聽聽cell.Text聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽GridView1.EmptyDataText;<br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">鍚戠┖琛屼腑鍔犲叆鍗曞厓鏍?/span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽聽聽聽聽GridView1.Rows[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">].Cells.Add(cell);<br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">璁╄琛屽簲鐢‥mptyDataRowStyle鏍峰紡,榪欐牱鍙互鏇村姞鐏墊椿,姣斿鍙互寰堝鏄撶殑搴旂敤涓婚</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽聽聽聽聽GridView1.Rows[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">].ApplyStyle(GridView1.EmptyDataRowStyle);<br />聽聽聽聽聽聽聽聽}<br />聽聽聽聽聽聽聽聽<br />聽聽聽聽}</span></span></div><p>聽聽聽聽聽聽濡傛涓鏉ワ紝閰嶅悎 GridView 鐨?EmptyDataText , EmptyDataRowStyle 鍗沖彲浠ュ疄鐜頒護(hù)浜烘弧鎰忕殑鏁堟灉錛岃涓嬪浘銆?br /><br />聽聽聽聽聽聽聽聽聽聽聽聽<img height="65" alt="GridView絀烘暟鎹泦鏁堟灉鍥? src="http://www.tkk7.com/images/blogjava_net/tw-ddm/10051/r_emptyDataSet.PNG" width="423" border="0" /><br /><br /></p></font> <img src ="http://www.tkk7.com/tw-ddm/aggbug/71625.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/tw-ddm/" target="_blank">澶уぇ姣?/a> 2006-09-25 02:00 <a href="http://www.tkk7.com/tw-ddm/articles/71625.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鏁版嵁鎺т歡http://www.tkk7.com/tw-ddm/articles/65343.html澶уぇ姣?/dc:creator>澶уぇ姣?/author>Wed, 23 Aug 2006 10:52:00 GMThttp://www.tkk7.com/tw-ddm/articles/65343.htmlhttp://www.tkk7.com/tw-ddm/comments/65343.htmlhttp://www.tkk7.com/tw-ddm/articles/65343.html#Feedback0http://www.tkk7.com/tw-ddm/comments/commentRss/65343.htmlhttp://www.tkk7.com/tw-ddm/services/trackbacks/65343.html 聽聽聽Repeater鎺т歡錛屽叡鏈変簲涓ā鏉匡紝緙栬緫璇ユ帶浠剁殑妯℃澘鍙兘鍦ˋSP婧愮爜涓繘琛?br />聽聽聽聽聽聽1.ItemTemplate錛屾甯告樉紺洪」錛屽鏋滃畾涔変簡(jiǎn)浜ゆ浛欏規(guī)ā鏉匡紝鍒欎粎浠h〃濂囨暟Item(浠?寮濮嬬畻)
聽聽聽聽聽聽2.AlternatingItemTemplate錛屼氦鏇塊」錛屼唬琛ㄥ伓鏁癐tem
聽聽聽聽聽聽3.HeaderTemplate錛岄〉鐪夛紝鍦ㄦ帶浠剁殑鏈鍓?br />聽聽聽聽聽聽4.FooterTemplate錛岄〉鑴氾紝鍦ㄦ帶浠剁殑鏈鍚?br />聽聽聽聽聽聽5.SeparatorTemplate錛屽垎闅旈」錛屼綅浜庡悇Item涔嬮棿錛屽浣跨敤<br/>瀹炵幇鍚勯」鎹㈣
聽聽聽閫傜敤浜庯細(xì)
聽聽聽聽聽聽鏇夸唬鍙鏄劇ず瀹瑰櫒鍐呭鐨勫驚鐜紝濡傚皢涓涓猂esultSet鏄劇ず鎴愪竴寮犺〃銆?br />聽聽聽聽聽聽HeaderTemplate涓嬌鐢?lt;table><tr>錛孖temTemplate/AlternatingItemTemplate涓嬌鐢?lt;td></td>錛孲eparatorTemplate涓嬌鐢?lt;/tr><tr>錛孎ooterTemplate涓嬌鐢?lt;/tr></table>鍙互瀹炵幇涓涓?<table> 鍏冪礌鏁堟灉銆?br />
聽聽聽DataList鎺т歡錛?/strong>鍏辨湁涓冧釜妯℃澘
聽聽聽聽聽聽6.SelectedItemTemplate錛岄夋嫨欏?br />聽聽聽聽聽聽7.EditItemTemplate錛岀紪杈戦」
聽聽聽閫傜敤浜庯細(xì)
聽聽聽聽聽聽鍙紪杈戞暟鎹?/strong>鐨勬樉紺猴紝鍥犳鍦ㄦ櫘閫氱殑DataSource鎸囧畾鍚?006騫?鏈?4鏃ワ紝闇瑕佺粦瀹氭暟鎹簮鐨勪富閿垪(鎸囧畾鎺т歡鐨?strong>DataKeyField灞炴?銆?br />聽聽聽聽聽聽璇ユ帶浠舵彁渚涗簡(jiǎn)澶氱浜嬩歡錛岀敱鏀懼湪Item涓殑Button鎺т歡嬋鍙戙?br />聽聽聽聽聽聽Button鎺т歡灝嗕細(xì)嬋鍙慖temCommand浜嬩歡錛屽彲閫氳繃浼犲叆鐨勪簨浠跺弬鏁版潵寮曞彂鍏跺畠浜嬩歡錛屼緥濡備嬌鐢⊿electedItem妯℃澘錛?br />

聽聽聽聽 protected void 聽DataList1_ItemCommand( object 聽source,聽DataListCommandEventArgs聽e)聽{
聽聽聽聽聽聽聽聽
if 聽(e.CommandName聽 == " Select " )聽{聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 // 鍒ゆ柇嬋鍙戜簨浠剁殑Button.CommandName

聽聽聽聽聽聽聽聽聽聽聽聽 this .DataList1.SelectedIndex聽 = 聽e.Item.ItemIndex;聽聽 // 璁╂縺鍙戜簨浠剁殑琛岃閫変腑
聽聽聽聽聽聽聽聽聽聽聽聽myDataBind();聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 // 榪欓噷闇瑕佽繘琛岄噸鏂扮粦瀹?/span>
聽聽聽聽聽聽聽聽}
聽聽聽聽}

聽聽聽聽聽聽浣跨敤EditItemTemplate妯℃澘錛屽皢Button.CommandName鎸囧畾鎴?edit"鍗沖彲銆?/font>

聽聽聽聽 protected void 聽DataList1_EditCommand( object 聽source,聽DataListCommandEventArgs聽e)聽{
聽聽聽聽聽聽聽聽
this .DataList1.SelectedIndex聽 = - 1 ;聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 // 鏀懼純閫夋嫨

聽聽聽聽聽聽聽聽 this .DataList1.EditItemIndex聽 = 聽e.Item.ItemIndex;聽聽聽聽 // 璁╁綋鍓嶈榪涘叆緙栬緫鐘舵?/span>
聽聽聽聽聽聽聽聽myDataBind();
聽聽聽聽}

聽聽聽聽聽聽鍦‥ditItemTemplate妯℃澘涓彲浠ュ皢鍏佽淇敼鐨勫垪緇戝畾鍒板瓙鎺т歡涓婏紝騫舵斁鍏ヤ袱涓狟utton錛孋ommandName鍒嗗埆鎸囧畾涓?update","cancel"涓嶥ataList鐨勪簨浠剁浉瀵瑰簲錛屽啀鍦ㄥ搴旂殑鏁版嵁鏇存柊/鏀懼純浜嬩歡涓紪紼嬪嵆鍙?/font>

Cancel浜嬩歡

Update浜嬩歡

聽聽聽聽聽聽灝咮utton鎺т歡鐨凜ommandName鎸囧畾涓?delete"錛屽彲嬋鍙戞暟鎹垹闄や簨浠訛細(xì)
Delete浜嬩歡

聽聽聽聽聽聽閫氬父闇瑕佸湪Update/Delete鎸夐挳涓婂姞鍏ョ‘璁わ紝濡傛灉鏄潤鎬佹彁紺哄彲浠ョ洿鎺ュ湪Button鐨勫睘鎬т腑鍔犲叆錛?/font>

< asp:Button聽ID = " btnDelete " 聽runat = " server " 聽CommandName = " delete " 聽Text = " 鍒犻櫎 " OnClientClick = " return聽confirm( 'delete?' ); " />
聽聽聽聽聽聽鍦ㄨ繖閲屽彲浠ョ湅鍒幫紝鏄埄鐢ㄤ簡(jiǎn)Button鎺т歡鐨?OnClientClick 灞炴ц皟鐢ㄦ湰鍦扮殑 JS鍑芥暟 confirm() 鏉ュ疄鐜扮‘璁ょ殑鍔熻兘銆傚鏋滄兂鎻愮ず鍔ㄦ佹秷鎭?濡傛彁紺轟竴涓狪D)錛屽伓娌℃湁璇曞嚭鏉ワ紝涓嶈繃鍙互鍐欏湪浠g爜孌甸噷錛屽埄鐢↖temCreated浜嬩歡錛岃繖鏍鳳細(xì)
ItemCreated浜嬩歡

聽聽聽聽聽聽榪欐牱涓鏉ュ氨鍙互鍦˙utton嬋鍙慏ataList鐨勪簨浠朵箣鍓嶈繘琛岀畝鍗曠殑紜浜?jiǎn)锛屼笉杩囬渶瑕佹敞鎰忕殑鏄細(xì)
聽聽聽聽聽聽聽聽聽.鐢ㄨ繖縐嶆柟寮忔椂錛屽湪榪愯鏃跺鏋滄湁閿欒鏄?strong>涓嶄細(xì)鏈変粈涔堟彁紺烘秷鎭?/strong>鐨勶紝鑰屼笖嫻佺▼鐩存帴鍚戜笅榪涜錛?br />聽聽聽聽聽聽聽聽聽.濡傛灉鍚屾椂浣跨敤浜?jiǎn)涓たU嶏紝閭d箞Button涓婄殑OnClientClick灞炴т紭鍏堛?br />
聽聽聽聽聽聽璇ユ帶浠剁殑鏄劇ず鏂瑰紡涔熶笌Repeater鎺т歡澶т笉鐩稿悓錛屽畠鐨勬樉紺烘柟寮忓垎涓?琛?鍜?嫻?涓ょ錛岄粯璁や嬌鐢ㄨ〃甯冨眬銆?br />聽聽聽聽聽聽聽聽聽浣跨敤琛ㄥ竷灞鏃舵帶浠朵細(xì)鑷姩鐢熸垚涓涓?lt;table>鍏冪礌錛屾牱寮忓垯鐢卞悇妯℃澘瀵瑰簲鐨?lt;style>鎸囧畾錛屽湪璇ユ帶浠剁殑榪愮敤涓笉搴旇鍐嶄嬌鐢ㄥRepeater閭g鑷瀯閫?lt;table>鍏冪礌鐨勬柟娉曪紝鍥犱負(fù)璇ユ帶浠朵腑緇忓父闇瑕佺敤鍒癋indControls鏂規(guī)硶錛岃嚜琛屽姞鍏ュ厓绱犱細(xì)褰卞搷鍒拌鏂規(guī)硶銆?br />聽聽聽聽聽聽鍙互鐪嬪埌妯℃澘榪樺叿鏈夎嚜宸辨墍瀵瑰簲鐨凷tyle錛岃繖涓牱寮忎笌褰撳墠Item鎵浣跨敤鐨勬ā鍧楀搴旓紝渚嬪閫変腑絎?欏癸紝濡傛灉娌℃湁閰嶇疆<SelectedItemStyle>鎵嶄細(xì)浣跨敤<ItemStyle>鎵瀹氫箟鐨勬牱寮忋?br />
聽聽聽鎵嬪伐鍒嗛〉錛?/strong>
聽聽聽聽聽聽濡備笂闈㈡彁鍒扮殑Repeater銆丏ataList鎺т歡閮芥病鏈夋彁渚涘垎欏電殑鍔熻兘錛屾鏃跺彲浠ュ鏁版嵁婧愯繘琛屽垎欏靛啀閰嶅悎鑷畾涔夌殑瀵艱埅鏉℃潵瀹炵幇鍒嗛〉鏁堟灉銆?br />聽聽聽聽聽聽鎵嬪伐鍒嗛〉錛岄渶瑕佺敤鍒?System.Web.UI.WebControls.PagedDataSource 瀵硅薄銆?br />聽聽聽聽聽聽渚嬪錛氬湪欏甸潰涓姞鍏blPageNo鎺т歡浠ヤ繚瀛樺綋鍓嶉〉鍙?text="0")錛宐tnPrevious琛ㄧず涓婁竴欏碉紝btnNext琛ㄧず涓嬩竴欏點(diǎn)?/p>

鏂扮殑浠g爜

聽聽聽鎺掑簭錛?/strong>
聽聽聽聽聽聽鍒╃敤鏁版嵁瑙嗗浘DataView鐨凷ort灞炴ф潵瀹炵幇鎺掑簭錛屽皢鍏跺睘鎬ф寚瀹氫負(fù)涓涓瓧孌靛悕 + 鎺掑簭瑙勫垯銆?br />聽聽聽聽聽聽鍦℅ridView涓垪涓婂彲浠ヨ緗甋ortExpression鎺掑簭琛ㄨ揪寮忥紝騫跺湪Sorting浜嬩歡涓寚瀹欴ataView鐨凷ort涓鴻浜嬩歡鐨凷ortExpression鍗沖彲銆?br />
聽聽聽GridView錛?br />聽聽聽聽聽聽灝辨槸涓涓暟鎹〃鏍鹼紝鍦ㄤ互鍓嶇殑鐗堟湰涓彨DataGrid銆傚畠鐨勫姛鑳芥瘮DataList鏇翠負(fù)寮哄ぇ錛屾敮鎸佹暟鎹〃鏍兼樉紺恒佹寜鍒楃殑鎺у埗(DataList鎸夊悕瀛楀氨鍙敮鎸佷竴鍒?銆佸垪鐨勬帓搴忋佸垎欏點(diǎn)佺┖欏墊帶鍒剁瓑澶氱鍔熻兘錛屽彲浠ュ皢DataList鐪嬪仛鏄竴涓交閲忕駭鐨勬帶浠訛紝涓嶈繃浠庤繖涓ょ鎺т歡鐨勫睘鎬у強(qiáng)浣跨敤鏂瑰紡鏉ョ湅錛岄鏍煎畬鍏ㄤ笉鍚岋紝榪欏彲鑳戒篃鏄袱鎺т歡鍛藉悕涓嶄竴鐨勫師鍥犲惂銆?br />




]]>
鐢熸垚闅忔満鐮佹楠屽浘鐗?/title><link>http://www.tkk7.com/tw-ddm/articles/64936.html</link><dc:creator>澶уぇ姣?/dc:creator><author>澶уぇ姣?/author><pubDate>Mon, 21 Aug 2006 19:00:00 GMT</pubDate><guid>http://www.tkk7.com/tw-ddm/articles/64936.html</guid><wfw:comment>http://www.tkk7.com/tw-ddm/comments/64936.html</wfw:comment><comments>http://www.tkk7.com/tw-ddm/articles/64936.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/tw-ddm/comments/commentRss/64936.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/tw-ddm/services/trackbacks/64936.html</trackback:ping><description><![CDATA[     鎽樿: 緗戦〉涓渶瑕佺敤鍒拌繖鏍風(fēng)殑鍔熻兘錛屽弬鐓х綉涓婄殑浠嬬粛錛屽仛浜?jiǎn)涓涓斁鍦ㄨ繖閲屽鏌ャ偮犅犅犳晥鏋滃浘錛? 聽聽聽涓轟簡(jiǎn)鏂逛究璋冪敤錛屽啓鎴愪簡(jiǎn)涓涓被(RandomCodeImage.cs)銆? using 聽System; using 聽System.Drawing; /**/ /// 聽 ...  <a href='http://www.tkk7.com/tw-ddm/articles/64936.html'>闃呰鍏ㄦ枃</a><img src ="http://www.tkk7.com/tw-ddm/aggbug/64936.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/tw-ddm/" target="_blank">澶уぇ姣?/a> 2006-08-22 03:00 <a href="http://www.tkk7.com/tw-ddm/articles/64936.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>瀹炵幇鍗曢?澶氶夊姩鎬佽漿鍖?/title><link>http://www.tkk7.com/tw-ddm/articles/64088.html</link><dc:creator>澶уぇ姣?/dc:creator><author>澶уぇ姣?/author><pubDate>Thu, 17 Aug 2006 04:15:00 GMT</pubDate><guid>http://www.tkk7.com/tw-ddm/articles/64088.html</guid><wfw:comment>http://www.tkk7.com/tw-ddm/comments/64088.html</wfw:comment><comments>http://www.tkk7.com/tw-ddm/articles/64088.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/tw-ddm/comments/commentRss/64088.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/tw-ddm/services/trackbacks/64088.html</trackback:ping><description><![CDATA[ <font size="2"> <br />聽聽聽<strong>闂錛?/strong><br />聽聽聽欏甸潰涓細(xì)閬囧埌瀹炵幇鍗曢?澶氶夌殑鏂規(guī)硶錛屼笉騫哥殑鏄夋嫨鍗曢夋垨澶氶夋槸鍔ㄦ佸喅瀹氱殑錛屼緥濡傚疄鐜版姇紲紝闇瑕佷粠vote琛ㄤ腑鍙栧嚭鏁版嵁錛屼粠鑰屽喅瀹氬綋鍓嶇殑鎶曠エ鏄閫夎繕鏄崟閫夈?br />聽聽聽瀹炵幇榪欑鍔熻兘鏈綆鍗曠殑鏂規(guī)硶灝辨槸鏀句笂涓や釜panel瀹瑰櫒錛屼竴涓斁checkboxlist錛屼竴涓斁radiobuttonlist錛屾牴鎹绱㈠埌鐨勬暟鎹疄鐜板紑鍏蟲樉紺恒?br /><br />聽聽聽<strong>瑙e喅鏂規(guī)硶錛?/strong><br />聽聽聽浣跨敤System.Web.UI.WebControls.ListControl鍙互杞繪澗鐨勫疄鐜板姩鎬佺殑瀹氬埗銆?br /></font> <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"> <font size="2"> <span style="COLOR: #0000ff">protected</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">void</span> <span style="COLOR: #000000">聽Page_Load(</span> <span style="COLOR: #0000ff">object</span> </font> <font size="2"> <span style="COLOR: #000000">聽sender,聽EventArgs聽e)聽{<br />聽聽</span> <span style="COLOR: #0000ff">bool</span> <span style="COLOR: #000000">聽isSingle聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">false</span> </font> <font size="2"> <span style="COLOR: #000000">;<br />聽聽System.Web.UI.WebControls.ListControl聽list聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">null</span> </font> <font size="2"> <span style="COLOR: #000000">;<br />聽聽</span> <span style="COLOR: #0000ff">if</span> </font> <font size="2"> <span style="COLOR: #000000">(isSingle)聽{<br />聽聽聽聽list聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">new</span> </font> <font size="2"> <span style="COLOR: #000000">聽RadioButtonList();<br />聽聽}聽</span> <span style="COLOR: #0000ff">else</span> </font> <font size="2"> <span style="COLOR: #000000">聽{<br />聽聽聽聽list聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">new</span> </font> <font size="2"> <span style="COLOR: #000000">聽CheckBoxList();<br />聽聽}<br />聽聽</span> <span style="COLOR: #0000ff">this</span> </font> <font size="2"> <span style="COLOR: #000000">.Panel1.Controls.Add(list);<br /><br />聽聽</span> <span style="COLOR: #0000ff">if</span> <span style="COLOR: #000000">(</span> <span style="COLOR: #000000">!</span> </font> <font size="2"> <span style="COLOR: #000000">IsPostBack())聽{<br />聽聽聽聽rebindData(list);<br />聽聽}<br />}<br /><br /></span> <span style="COLOR: #0000ff">private</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">void</span> </font> <font size="2"> <span style="COLOR: #000000">聽rebindData(ListControl聽ctl)聽{<br />聽聽ctl.Items.Add(</span> <span style="COLOR: #0000ff">new</span> <span style="COLOR: #000000">聽ListItem(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">鏂囨湰</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">,</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">鍊?/span> <span style="COLOR: #000000">"</span> </font> <font size="2"> <span style="COLOR: #000000">);<br />聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000"> <img src="http://www.tkk7.com/images/dot.gif" />鎴栬呭湪榪欓噷榪涜鏁版嵁緇戝畾ctl.DataSource<img src="http://www.tkk7.com/images/dot.gif" />.</span> </font> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000"> <font size="2">}</font> </span> </div> <br /> <font size="2">聽聽聽<strong>鍚庤錛?/strong><br />聽聽聽ASP.NET涓瀹氭湇鍔$鎺т歡蹇呴』鏀劇疆鍦‵orm runat="server"涔嬪唴錛屽洜姝ゅ姩鎬佹坊鍔犳椂錛宼his.Controls.Add(new Control())鏄笉鍙互鐨勶紝蹇呴』鏀懼叆瀹瑰櫒涓紝渚嬪涓婇潰鐨凱anel鎴栬呴〉闈㈢殑Form涓璽his.form1.Controls.Add...銆?/font> <img src ="http://www.tkk7.com/tw-ddm/aggbug/64088.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/tw-ddm/" target="_blank">澶уぇ姣?/a> 2006-08-17 12:15 <a href="http://www.tkk7.com/tw-ddm/articles/64088.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>ASP.NET瀛︿範(fàn)絎旇--02http://www.tkk7.com/tw-ddm/articles/62259.html澶уぇ姣?/dc:creator>澶уぇ姣?/author>Mon, 07 Aug 2006 16:04:00 GMThttp://www.tkk7.com/tw-ddm/articles/62259.htmlhttp://www.tkk7.com/tw-ddm/comments/62259.htmlhttp://www.tkk7.com/tw-ddm/articles/62259.html#Feedback0http://www.tkk7.com/tw-ddm/comments/commentRss/62259.htmlhttp://www.tkk7.com/tw-ddm/services/trackbacks/62259.html


聽聽聽ASP.NET鎻愪緵鐨刉EB鎺т歡鍒嗙被
聽聽聽聽聽聽鍐呴儴鎺т歡錛屽熀浜嶩TML鎺т歡錛屽叿鏈?runas=server 鐨勫睘鎬э紱
聽聽聽聽聽聽鍒楄〃鎺т歡錛岀敤浜庡湪WEB欏典腑鍒涘緩鏁版嵁鍒楄〃錛屽父鐢ㄧ殑鏈?Repeater, DataList, DataGrid
聽聽聽聽聽聽澶嶆潅鎺т歡錛岀敤綆鍗曟帶浠惰仛鍚堣屾垚錛屽鏃ュ巻
聽聽聽聽聽聽楠岃瘉鎺т歡錛屽杈撳叆鏁版嵁榪涜鍑嗙‘鎬у拰鑼冨洿鐨勬鏌?楠岃瘉宸ヤ綔鍦?Server 绔繘琛?


聽聽聽鏂囨湰杈撳叆
聽聽聽聽聽聽textbox
聽聽聽聽聽聽閫氳繃璁劇疆璇ユ帶浠剁殑 TextMode 灞炴у彲浠ュ疄鐜?1.鍗曡鏂囨湰 2.澶氳鏂囨湰 3.瀵嗙爜鏂囨湰 涓夌VIEW錛屽琛屾枃鏈ā寮忔椂灞炴?cols,rows鐢熸晥銆?br />
聽聽聽
鎺у埗杞Щ
聽聽聽聽聽聽1.Button
聽聽聽聽聽聽2.LinkButton
聽聽聽聽聽聽3.ImageButton
聽聽聽聽聽聽4.
HyperLink
聽聽聽聽聽聽1 - 3 閮藉睘浜?button 錛屽彲浠ュ搷搴斾簨浠訛紝鑰?HyperLink 鍒欎笉琛屻侶yperLink 涓?HTML 涓殑閿氫竴鏍鳳紝鐐瑰嚮瀹冨茍涓嶄細(xì)浜х敓鍚戞湇鍔″櫒鐨勬彁浜わ紝鑰屽皢鍦ㄥ鎴風(fēng)瀹屾垚璺寵漿錛屼笌閿氭爣璁扮浉姣旂殑濂藉鍦ㄤ簬錛屽畠灞炰簬鏈嶅姟鍣ㄦ帶浠訛紝鍥犳鍙互鍦ㄧ被涓嬌鐢?this 鎸囬拡鍔犱互寮曠敤錛屾柟渚跨紪紼嬨?br />聽聽聽聽聽聽Button 鏈変釜 commandName 灞炴э紝鍦ㄦ紨紺轟腑璁╁畠鍏呭綋浜?TAG 鐨勮鑹詫紝鐢ㄤ簬涓涓簨浠跺搷搴斿涓?Button 鎺т歡鏃跺瀵硅薄鐨勫尯鍒細(xì)
聽聽聽聽聽聽聽聽聽if( ((System.Web.UI.WebControls.Button)sender).CommandName == "b1" )
聽聽聽聽聽聽LinkButton錛屾牱瀛愪笌 HyperLink宸笉澶氾紝浣嗘槸鏈夌潃鏄庢樉鐨勫尯鍒紝瀹冩槸鍙互鍝嶅簲浜嬩歡鐨?浼?xì)漶旂敓瀵规湇鍔″櫒鐨勬彁浜?錛?br />聽聽聽聽聽聽ImageButton錛屽叿鏈変竴涓狪mageURL灞炴у彲浠ュ姞杞藉浘鐗囷紝AlternateText灞炴ф寚瀹氬浘鐗囨棤娉曟壘鍒版椂鏄劇ず鐨勬枃瀛楋紝鍙﹀瀹冪殑浜嬩歡鍝嶅簲褰㈠弬綾誨瀷涔熸湁鐫涓嶅悓錛屾槸 ImageClickEventArgs 綾誨瀷錛岃綾誨瀷鍏鋒湁鐨?x,y灞炴у彲浠ヤ嬌浜嬩歡瀵逛簬鐐瑰嚮鍒板浘鐗囦笂鐨勫叿浣撳尯鍩熷仛鍑哄弽搴斻?/font>

聽聽聽閫夋嫨
聽聽聽聽聽聽1.CheckBox
聽聽聽聽聽聽2.RadioButton
聽聽聽聽聽聽3.ListBox
聽聽聽聽聽聽4.
DropDownList
聽聽聽聽聽聽CheckBox錛屽閫夋錛屽睘鎬?Checked 琛ㄧず璇ュ閫夋鏄惁琚変腑錛屽彟澶栬繕鎻愪緵涓涓?CheckBoxList 浣滀負(fù)涓涓泦鍚堟帶浠舵柟渚挎搷浣滐紱
聽聽聽聽聽聽RadioButton錛屽崟閫夋錛屽睘鎬?Checked 琛ㄧず璇ュ崟閫夋鏄惁琚変腑錛岄氳繃璁懼畾澶氫釜 RadioButton 灞炴?GroupName 涓虹浉鍚屽鹼紝鍙互寰堟柟渚跨殑灝嗗涓帶浠剁粍鍚堟垚涓涓狦roup錛屽彟澶栬繕鎻愪緵涓涓泦鍚堟帶浠?RadioButtonList
聽聽聽聽聽聽鏈夊緢澶氭帶浠墮兘鍏鋒湁涓涓?AutoPostBack 灞炴э紝璇ュ睘鎬ц〃紺烘槸鍚﹀搷搴旀湇鍔″櫒浜嬩歡錛屽鏋滀負(fù)false鍒欎笉浼?xì)鍝嶅簲浜嬩挥灱岃屼負(fù)true鏃朵竴鏃﹁Е鍙戜簨浠跺氨浼?xì)鍚戞湇鍔″櫒鎻愪氦锛屽洜姝ら渶瑕侀伩鍏嶆帶浠剁粡甯告х殑鍚戞湇鍔$鎻愪氦銆?br />
聽聽聽瀹瑰櫒
聽聽聽聽聽聽Panel錛岄潰鏉褲傞氬父鐢ㄤ簬鍦ㄥ悓涓欏典腑瀹炵幇鍒囨崲(杞祦鏄劇ず)銆?br />
聽聽聽澶嶆潅鎺т歡
聽聽聽聽聽聽1.ADRotator錛屽箍鍛婃帶浠躲侫dvertisementFile 灞炴у彲浠ヤ負(fù)鎺т歡鎸囧畾涓涓猉ML閰嶇疆鏂囦歡錛孠eywordFilter 灞炴ц兘澶熸牴鎹厤緗枃浠朵腑鍚勫箍鍛婄殑 key 榪涜絳涢夈?br />聽聽聽聽聽聽璇ュ箍鍛婃帶浠?strong>涓嬈″彧鑳芥樉紺轟竴寮?/strong>鍥劇墖錛屽彧鏈夊綋鍒鋒柊欏甸潰鎴栭噸榪炴椂浼?xì)閫夊彇鍏跺畠鐨勫浘鐗囷紝鐩稿悓浜嶢SP涓敤鐨勯偅涓殢鏈哄浘鐗?br />聽聽聽聽聽聽閰嶇疆鏂囦歡錛屼竴涓?lt;AD>鏍囩浠h〃涓涓箍鍛娿?/font>

XML閰嶇疆鏂囦歡

聽聽聽聽聽聽2.Calendar錛屾棩鍘嗘帶浠躲?br />
聽聽聽涓婁紶鎺т歡
聽聽聽聽聽聽FileUpload錛屾枃浠朵笂浼犮侾ostedFile 灞炴ц〃紺哄凡緇忎笂浼犵殑鏂囦歡瀵硅薄錛屽彲浠ラ氳繃璇ュ璞$殑灞炴у強(qiáng)鏂規(guī)硶鑾峰彇涓婁紶鏂囦歡鐨勫悇縐嶅睘鎬с侳ileName 灞炴ц〃紺轟笂浼犳枃浠剁殑鏂囦歡鍚?PostedFile瀵硅薄涔熷叿鏈変竴涓狥ileName灞炴э紝浣嗘槸琛ㄧず鐨勬槸涓婁紶鏂囦歡鐨勫叏璺緞鍚嶏紝闇瑕佹墜宸ユ彁鍙栨枃浠跺悕)銆侾ostedFile.SaveAs(path) 鏂規(guī)硶鍙互灝嗕笂浼犵殑鏂囦歡淇濆瓨鍦ㄦ湇鍔$鐨勬寚瀹氳礬寰勪笅錛屾敞鎰忚繖閲岀殑 path 蹇呴』鏄竴涓粷瀵瑰湴鍧錛屽洜姝や嬌鐢ㄦ椂闇瑕佽繘琛岀浉瀵硅礬寰?->緇濆璺緞鐨勮漿鎹紝鍙互浣跨敤 Server.MapPath(path) 鏂規(guī)硶銆?br />
聽聽聽楠岃瘉鎺т歡
聽聽聽聽聽聽1.RequiredFieldValidator錛岀┖鍊奸獙璇侊紱
聽聽聽聽聽聽2.CompareValidator錛屾瘮杈冮獙璇併傝鎺т歡鏈変笁縐嶅伐浣滄柟寮?br />聽聽聽聽聽聽聽聽聽.鍊兼瘮杈冿紝ValueToCompare聽灞炴х敤浜庤瀹氱壒寰佸鹼紝Type 鎸囧畾鐗瑰緛鍊肩殑綾誨瀷錛孫perator 灞炴ф寚瀹氭瘮杈冭繍綆楃 (Value Operator Control.value)錛?br />聽聽聽聽聽聽聽聽聽.綾誨瀷媯(gè)楠岋紝Type 鎸囧畾綾誨瀷錛孫perator 灞炴т嬌鐢?"DataTypeCheck"錛?br />聽聽聽聽聽聽聽聽聽.鎺т歡姣旇緝錛孴ype錛孫perator錛孋ontrolToValidate錛孋ontrolToCompare灞炴у嵆鍙?br />聽聽聽聽聽聽3.RangeValidator錛屽煎煙楠岃瘉錛?br />聽聽聽聽聽聽4.RegularExpressionValidator錛屾鍒欒〃杈懼紡楠岃瘉錛?br />聽聽聽聽聽聽5.CustomValidator錛岃嚜瀹氫箟楠岃瘉銆傚畠鏀寔瀹㈡埛绔強(qiáng)鏈嶅姟绔嚜瀹氫箟楠岃瘉錛孲erver 绔獙璇佹椂璇ユ帶浠舵彁渚涗竴涓猄erverValidate浜嬩歡錛岃浜嬩歡鐨凷erverValidateEventArgs瀵硅薄綾誨瀷鍙傛暟鐨?Value 灞炴ц〃紺鴻鎺т歡緇戝畾鐨勮楠岃瘉鎺т歡鐨?Value錛孖sValid 灞炴ц〃紺烘槸鍚﹂氳繃楠岃瘉錛屽彧闇鍦ㄤ簨浠朵腑鏍規(guī)嵁鑷畾涔夌殑瑙勫垯璁劇疆 IsValid灞炴у嵆鍙紱
聽聽聽聽聽聽6.ValidationSummary錛屽垪涓鵑〉闈腑鐨勫叏閮ㄩ獙璇侀敊璇俊鎭傜敤浜庡皢閿欒淇℃伅闆嗕腑鏄劇ず銆?br />聽聽聽聽聽聽鍦ㄩ〉闈腑浣跨敤楠岃瘉鎺т歡鏃訛紝闄や簡(jiǎn)絎?縐嶏紝2-4閮戒笉浼?xì)瀵菇I哄艱繘琛岄獙璇侊紝鍥犳闇瑕佹牴鎹儏鍐墊惌閰嶄嬌鐢ㄣ?br />聽聽聽聽聽聽緙虹渷鎯呭喌涓嬶紝鏈変簺楠岃瘉闇瑕佸湪 server 绔繘琛?濡侰ustomValidator)錛屾祦紼嬩細(xì)鎴愪負(fù) 鍏堟彁浜ゅ悗楠岃瘉錛岃繖鏃跺湪緙栫▼鏃跺氨闇瑕佺敤鍒?Page.IsValid 灞炴э紝鍙湁褰撹灞炴т負(fù)true鏃舵墠琛ㄧず閫氳繃浜?jiǎn)鍏ㄩ儴鐨勯獙璇併?br />聽聽聽聽聽聽瀵逛簬IE鐨勪綆鐗堟湰鏉ヨ錛屽鎴風(fēng)楠岃瘉浼?xì)鍑虹幇闂锛屾鏃跺彲浠ュ鉴櫋屾寚瀹氬叏閮ㄤ娇鐢ㄦ湇鍔$楠岃?lt;%@ page ClientTarget="DownLevel" %>
聽聽聽聽聽聽鍦ㄩ〉闈腑甯稿父鍖呭惈澶ч噺鐨勯獙璇佹帶浠訛紝鍦ㄤ嬌鐢ㄦ椂甯稿父闇瑕佹牴鎹渶瑕佷嬌涓緇勯獙璇佺敓鏁堛傛鏃墮獙璇佹帶浠剁殑 ValidationGroup 灞炴у氨鍙互媧句笂鐢ㄥ満錛岃灞炴у彲浠ュ楠岃瘉鎺т歡榪涜鍒嗙粍錛屽悓鏃跺湪浣跨敤鏃跺湪鑳藉寮曡搗鎻愪氦鐨勬帶浠朵笂鎸囧畾ValidationGroup灞炴?璇ュ睘鎬у悓鏍蜂細(xì)褰卞搷鍒癙age.IsValid鐨勭粨鏋?銆傚綋鐒跺鏋滃湪欏甸潰涓婁嬌鐢ㄤ簡(jiǎn)ValidationSummary鎺т歡鐨勮瘽錛屼篃闇瑕佹寚瀹氳灞炴э紝涓嶇劧瀹冧笉浼?xì)鏄窘C哄搴旂粍鎺т歡鐨勯敊璇彁紺轟俊鎭?br />



]]>
ASP.NET瀛︿範(fàn)絎旇--01http://www.tkk7.com/tw-ddm/articles/62213.html澶уぇ姣?/dc:creator>澶уぇ姣?/author>Mon, 07 Aug 2006 09:51:00 GMThttp://www.tkk7.com/tw-ddm/articles/62213.htmlhttp://www.tkk7.com/tw-ddm/comments/62213.htmlhttp://www.tkk7.com/tw-ddm/articles/62213.html#Feedback0http://www.tkk7.com/tw-ddm/comments/commentRss/62213.htmlhttp://www.tkk7.com/tw-ddm/services/trackbacks/62213.html 聽聽聽鍒氬垰寮濮嬪涔?fàn)ASP.NET錛岀幆澧冿細(xì)XP,VS2005,SQLServer2000錛屽涔?fàn)璧勬枡锛?xì)鍖楀ぇ闈掗笩鐨勮棰戞暀紼?br />
聽聽聽ASP.NET涓嶢SP鐨勫尯鍒?/strong>
聽聽聽聽聽聽asp.net 榪愯浜?.net 妗嗘灦涔嬩笂錛岀粡榪囦簡(jiǎn)浼紪璇戯紝鑰?asp 鍒欐槸鐩存帴榪愯鍦↖IS涓婄殑錛屽湪璋冪敤鏃剁敱DLL榪涜瑙i噴錛?br />聽聽聽聽聽聽asp.net 鏀寔涓夌寮鍙戣璦錛歷b.net,c#,j#錛岃?asp 浠呮敮鎸?vbscript 鐨勮娉曪紱
聽聽聽聽聽聽asp.net 鎻愪緵浜?jiǎn)鎺т欢鏀寔锛岃?asp 鍒欐病鏈夛紱
聽聽聽聽聽聽asp.net 鏀寔OOP錛屼唬鐮佷篃鏄寜綾繪潵緇勭粐鐨勶紝asp 鍙兘渚濋潬綺懼閥鐨勪唬鐮佸疄鐜幫紱
聽聽聽聽聽聽asp.net 鍦ㄩ〉闈㈢殑澶勭悊涓婇噰鐢ㄤ簡(jiǎn)VB鐨勪簨浠墮┍鍔紝澶уぇ綆鍖栦簡(jiǎn)寮鍙戦毦搴︼紝asp 渚濋潬鐨勬槸鎵嬪伐椹卞姩錛?br />聽聽聽聽聽聽asp.net 鎻愪緵鐨刅IEWSTATE鏈哄埗錛屼嬌寰楅〉闈㈠厓绱犲彲浠ヤ繚鎸佸師鏈夌殑鍊鹼紝asp 蹇呴』渚濋潬鎵嬪伐浠g爜錛?br />聽聽聽聽聽聽asp.net 浣跨敤浜?jiǎn)浠g爜鍒喖浕锛宎sp 鍒欐病鏈夛紝鐜板湪鑰佹澘灝辮兘鐪嬫竻妤氫綘鍐欑殑閭e爢鍨冨溇鍦ㄥ摢鍎夸簡(jiǎn)錛?br />聽聽聽聽聽聽asp.net 鐨処DE鍔熻兘涓婂己澶ц澶氾紝涓嶈繃鍦℉TML鍏冪礌鐨勮璁′笂鎴愪簡(jiǎn)涓鍙浮鑲嬶紝璁稿鍦版柟淇鴻繕鏄範(fàn)鎯墜宸ユ敼鍐欙紱

聽聽聽ASP.NET鎻愪緵鐨勬帶浠?/strong>
聽聽聽聽聽聽鎻愪緵鐨勫父鐢ㄦ帶浠墮兘鍦╒S宸ュ叿綆辯殑"鏍囧噯"鍙?HTML"鏍忎腑錛屾墍璋撴爣鍑嗘帶浠跺氨鏄寚鏈嶅姟鍣ㄦ帶浠訛紝涓鎷栧嚭鏉ュ氨鏈変釜 runas="server" 鐨勫睘鎬э紝褰撶劧HTML鎺т歡涔熷彲浠ュ姞涓婅繖涓睘鎬у彉韜負(fù)鏈嶅姟鍣ㄦ帶浠訛紝涓鏃︽嫢鏈夎繖涓猺unas閭d箞璇ユ帶浠跺氨浼?xì)鎴愪负绫荤殑涓欏瑰睘鎬э紝鍦ㄧ被鎴愬憳涓嬌鐢╰his鎸囬拡灝卞彲浠ョ洿鎺ュ紩鐢紝鏋滅劧鏄柟渚垮揩鎹楓備笉榪囩晫闈㈠厓绱犵殑鍔ㄤ綔涔熺浉搴旂潃鍙戠敓浜?jiǎn)鍙樺寲锛屽鏋滄槸鏅氱殑HTML鍏冪礌錛岄偅涔堝搷搴斿畠浜嬩歡鐨勫彧鑳芥槸鏈湴 script 浠g爜錛岃屼竴鏃︽垚涓烘湇鍔″櫒鎺т歡錛岄偅涔堟墍鏈夐拡瀵瑰畠鐨勪簨浠跺搷搴旈兘浼?xì)鍦ㄦ湇鍔″櫒绔畬鎴愩?br />
聽聽聽甯哥敤鐨勪簨浠訛細(xì)
protectedvoid聽Page_Load(object聽sender,聽EventArgs聽e)聽{
}
聽聽聽聽聽聽榪欎釜浜嬩歡鏈涓哄父鐢紝鍦ㄨ璁″櫒涓弻鍑婚〉闈㈠氨浼?xì)鍒囧埌璇ヤ簨錃g鏂規(guī)硶涓潵銆傝浜嬩歡鍙戠敓鍦ㄩ〉闈㈡瘡嬈¤瑁呰澆鏃訛紝涓嶈繃榪欓噷鐨凩oad璺熸湰鍦癆pp鐨凩oad涓嶄竴鏍鳳紝鐢變簬HTTP鐨勭壒鎬у喅瀹氫簡(jiǎn)瀹㈡埛/鏈嶅姟绔殑鑱旀帴涓嶅彲鑳芥槸鎸佺畫鍜屽弻鍚戠殑銆傚洜姝ゅ鎴風(fēng)嫻忚鍣ㄦ瘡鍙戜竴嬈¤姹傦紝鏈嶅姟绔氨浼?xì)Load欏甸潰涓嬈°?br />聽聽聽聽聽聽榪欎釜浜嬩歡閫氬父閰嶅悎 Page.IsPostBack 灞炴т嬌鐢紝璇ュ睘鎬у湪Load瀹屾垚涔嬪悗鎵嶄細(xì)琚涓?true 鍊鹼紝鍥犳鍙湁絎竴嬈$殑Load錛岃灞炴у兼墠涓?false錛岀湅鏁欑▼涓殑紺轟緥錛岄渶瑕佸垵濮嬪寲鐜鏃訛紝闇瑕佸皢鍒濆鍖栦唬鐮佺疆鍏?if(!Page.IsPostBack) 鍧椾腑銆?br />
protectedvoid聽Page_Init(object聽sender,聽EventArgs聽e)聽{
}
聽聽聽聽聽聽Page_Init 浜嬩歡鍦?Load 浜嬩歡涔嬪墠鍙戠敓錛岄〉闈㈠湪鍔犺澆鏃剁殑欏哄簭鏄?鎺т歡Init(),欏甸潰Init(),欏甸潰Load(),鎺т歡Load()


聽聽聽ASP.NET浠庢彁浜ょ殑鏁版嵁涓彇鍊?/strong>
1string聽userName聽=聽Request["userName"].ToString();

2string聽userName聽=聽Request.Form.Get("userName");

3string聽userName聽=聽Request.QueryString["userName"];

聽聽聽聽聽聽鍙栧肩殑鏂規(guī)硶涓?asp 鐩稿悓銆?br />聽聽聽聽聽聽絎?琛屾柟娉曢傜敤浜?Post/Get 涓ょ鎻愪氦鏂瑰紡錛涚2琛屽彧鑳界敤浜?Post 鎻愪氦錛岃繖閲屼嬌鐢ㄤ簡(jiǎn)闆嗗悎鐨凣et鏂規(guī)硶錛涚3琛屽彧鑳界敤浜?Get 鎻愪氦錛岃繖閲屼嬌鐢ㄥ彟澶栦竴縐嶈幏鍙栭泦鍚堟垚鍛樼殑鏂規(guī)硶銆?br />
聽聽聽ASP.NET鏌ヨMsSQL鏁版嵁搴?/strong>
聽聽聽聽聽聽闇瑕佸紩鐢ㄧ殑鍛藉悕絀洪棿(鐩稿綋浜嶫AVA涓殑鍖?:System.Data.SqlClient;
聽聽聽聽聽聽姝ラ:
聽聽聽聽聽聽聽聽聽1.鏂板緩涓涓?SqlConnection 榪炴帴瀵硅薄錛屽茍鎵撳紑錛?br />聽聽聽聽聽聽聽聽聽聽聽聽new SqlConnection("server=鏈嶅姟鐨勫湴鍧;database=鏁版嵁搴撳悕;uid=sa;pwd=")錛?br />聽聽聽聽聽聽聽聽聽聽聽聽con.Open();
聽聽聽聽聽聽聽聽聽2.鏂板緩涓涓?SqlCommand 鍛戒護(hù)瀵硅薄錛?br />聽聽聽聽聽聽聽聽聽聽聽聽new SqlCommand(SQL璇彞,con);
聽聽聽聽聽聽聽聽聽3.閫氳繃璋冪敤 SqlCommand 瀵硅薄鐨勬柟娉曡幏寰楁暟鎹?br />聽聽聽聽聽聽聽聽聽聽聽聽渚嬪錛?br />聽聽聽聽聽聽聽聽聽聽聽聽SqlDataReader sdr = cmd.ExecuteReader();聽聽聽//鑾峰緱涓涓彧鍚戝墠鐨勬父鏍?br />聽聽聽聽聽聽聽聽聽聽聽聽while(sdr.Read()) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽...
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽4.閲婃斁璧勬簮
聽聽聽聽聽聽聽聽聽聽聽聽浣跨敤 using 璇彞錛屽睘浜?.net 鐨勪笓鏈夎娉曚簡(jiǎn)錛屽湪鍧楃殑緇撴潫灝嗙敱 using 璇硶璋冪敤 IDisposable聽鎺ュ彛瀹氫箟鐨?Dispose()鏂規(guī)硶銆傚洜姝ゅ寘鍚湪 using 璇彞鍐呯殑瀵硅薄閮藉簲璇ュ疄鐜?IDisposable 鎺ュ彛銆?br />聽聽聽聽聽聽聽聽聽聽聽聽浣跨敤聽finally聽錛岃繖涓柟娉曡繕鏄瘮杈冨鏄撴帴鍙椾竴浜涳紝try/catch/finally緇勫悎闄や簡(jiǎn)鍙互閲婃斁璧勬簮澶栬繕鍙互鎹曡幏寮傚父銆?br />聽聽聽聽聽聽聽聽聽鏌ヤ簡(jiǎn)涓涓嬭祫鏂欙紝MS灝嗚繛鎺ユ睜涔熷偦鐡滀簡(jiǎn)涓鎶?鍙湁浣跨敤System.Data.SqlClient鍖呮椂)錛岄櫎闈炲湪 SqlConnection 瀵硅薄鐨勮繛鎺ュ瓧涓蹭腑鏄懼紡鎸囧畾錛屽惁鍒欒嚜鍔ㄩ厤緗繛鎺ユ睜銆傚洜姝ゅ湪 SqlConnection 瀵硅薄鐨勪嬌鐢ㄤ笂搴旇鍋氬埌闅忔墜鍏抽棴鐨勫ソ涔?fàn)鎯Q屽懙銆?/p>


]]>
主站蜘蛛池模板: 东北美女野外bbwbbw免费| 亚洲男人都懂得羞羞网站| 国产精品无码免费视频二三区| 无限动漫网在线观看免费| 黄页网站在线看免费| 欧美男同gv免费网站观看| 免费无码A片一区二三区 | 亚洲精品视频在线观看视频| 久久久亚洲欧洲日产国码aⅴ| 麻豆亚洲AV永久无码精品久久 | 日韩免费观看一级毛片看看| 色视频色露露永久免费观看| 日韩在线看片免费人成视频播放| 日韩成人免费aa在线看| 亚洲av无码成人精品区在线播放| 亚洲免费一区二区| 国产亚洲色婷婷久久99精品| 国产V亚洲V天堂无码久久久| 亚洲欧洲日韩不卡| 亚洲国产中文在线二区三区免| 国产成人精品日本亚洲18图| 亚洲风情亚Aⅴ在线发布| 添bbb免费观看高清视频| 亚洲阿v天堂在线2017免费 | 亚洲AV成人一区二区三区观看| 亚洲人成电影网站色www| 粉色视频成年免费人15次| 亚洲精品国产日韩无码AV永久免费网 | 夭天干天天做天天免费看| 国产乱子伦精品免费女| 亚洲无码高清在线观看| 亚洲AV无码国产精品色午友在线| 亚洲黄色片在线观看| 亚洲人成电影网站免费| 污污视频免费观看网站| 无码A级毛片免费视频内谢| 精品久久久久成人码免费动漫| 四虎影视免费永久在线观看| 亚洲中文字幕在线乱码| 亚洲成AV人片久久| 最新亚洲人成无码网www电影|