{"id":200,"date":"2007-01-28T06:50:37","date_gmt":"2007-01-28T06:50:37","guid":{"rendered":"http:\/\/www.jason695.idv.tw:81\/wordpress\/?p=200"},"modified":"2010-11-25T23:56:28","modified_gmt":"2010-11-25T15:56:28","slug":"gridview","status":"publish","type":"post","link":"https:\/\/jason695.why3s.tw\/wordpress\/2007\/01\/28\/gridview\/","title":{"rendered":"GridView"},"content":{"rendered":"<p>GridView\u662f2.0\u624d\u6709\u7684\u65b0\u73a9\u610f,\u662fMS\u63a8\u51fa\u4f86\u53d6\u4ee3DataGrid\u7684,<br \/>\n\u914d\u5408\u65b0\u7684DataSource,\u8981\u5beb\u7684CODE\u66f4\u5c11\u4e86,<br \/>\n\u4ee5\u4e0b\u662f\u6211\u5728\u4f7f\u7528DataSource\u3001GridView\u4e0a\u9047\u5230\u7684\u554f\u984c<br \/>\n<strong>\u4f5c\u6cd5\u4e00\uff1a <\/strong><\/p>\n<blockquote><p>\u5982\u679cGridView\u7684DataSource\u662f\u5728\u7a0b\u5f0f\u4e2d\u7d66gridview\u7684\uff0c\u90a3\u6392\u5e8f\u8ddf\u63db\u9801\u7b49\u7a0b\u5f0f\u90fd\u8981\u81ea\u5df1\u64b0\u5beb\uff0c\u8981\u5728\u5b83\u7684\u5169\u500b\u4e8b\u4ef6\u4e2d\u5beb\u7a0b\u5f0f\u78bc\uff0c\u6211\u7684\u505a\u6cd5\u662f\uff1a<br \/>\n&#8216;==========================<br \/>\n&#8216;GridView \u7684\u63db\u9801\u52d5\u4f5c<br \/>\n&#8216;==========================<br \/>\nProtected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging<\/p>\n<p>Me.GridView1.PageIndex = e.NewPageIndex<br \/>\nBindGridView()<\/p>\n<p>End Sub<\/p>\n<p>&#8216;==========================<br \/>\n&#8216;GridView \u7684\u6392\u5e8f\u52d5\u4f5c<br \/>\n&#8216;==========================<br \/>\nProtected Sub GridView1_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView1.Sorting<br \/>\nDim strSort As String = ViewState(&#8220;sort&#8221;)<\/p>\n<p>If Right(strSort, 4) = &#8220;desc&#8221; Then<br \/>\nViewState(&#8220;sort&#8221;) = e.SortExpression<br \/>\nElse<br \/>\nViewState(&#8220;sort&#8221;) = e.SortExpression + &#8221; desc&#8221;<br \/>\nEnd If<\/p>\n<p>BindGridView()<\/p>\n<p>End Sub<\/p><\/blockquote>\n<p><strong>\u4f5c\u6cd5\u4e8c\uff1a <\/strong><\/p>\n<blockquote><p>1. \u9084\u662f\u62c9\u4e00\u500bSQLDataSource, \u53ea\u9023\u5230\u8cc7\u6599\u5eab, \u4e26\u4e0d\u505aSelect, update, insert, delete command\u7684\u8655\u7406.<br \/>\n2. \u4e26\u628aGridview\u7684datasource\u53ea\u5230\u9019\u500bSQLDataSource<br \/>\n3. \u8981\u7570\u52d5Gridview\u7684\u5167\u5bb9\u6642, \u5c07SQLDataSource.SelectCommand = SQL \u6307\u4ee4, \u91cd\u65b0\u505aGridview.DataBind()\u5373\u53ef<\/p><\/blockquote>\n<p><strong>\u76f8\u95dc\u53c3\u8003\uff1a<\/strong><\/p>\n<blockquote><p>http:\/\/phone.idv.tw\/cs2\/forums\/thread\/274.aspx <\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>GridView\u662f2.0\u624d\u6709\u7684\u65b0\u73a9\u610f,\u662fMS\u63a8\u51fa\u4f86\u53d6\u4ee3DataGrid\u7684, \u914d\u5408\u65b0\u7684DataSource,\u8981\u5beb &hellip; <a href=\"https:\/\/jason695.why3s.tw\/wordpress\/2007\/01\/28\/gridview\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587 <span class=\"screen-reader-text\">GridView<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-200","post","type-post","status-publish","format-standard","hentry","category-net","no-featured-image"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/posts\/200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/comments?post=200"}],"version-history":[{"count":0,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/posts\/200\/revisions"}],"wp:attachment":[{"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/media?parent=200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/categories?post=200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/tags?post=200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}