DataGrid page "Non-control Edition"

zhaozj2021-02-16  54

First of all, I added the previous published: When you use the user control I have made in your creation: State Protected DataGridPage1 As DataGridPage, the previous control name you dragged in, after you Define user controls. Then use your control in your code:

DataGridPage1.SetTarget (MyDataGrid, New Binddata) DataGridpage1.setStyle (10, FALSE)

The underscore section is a mandatory of a binding of yourself. Sub, Function, etc.

The following is the code when I don't do control:

HTML:

<% @ Page language = "vb" autoeventwireup = "false" codebehind = "flye.aspx.vb" inherits = "DataGridtitle.fenye"%> fenye </ title> <meta name =" generator "content =" Microsoft Visual Studio .NET 7.1> <meta name = "code_language" content = "Visual Basic .NET 7.1 "> <meta name =" vs_defaultClientScript "content =" JavaScript "> <meta name =" vs_targetSchema "content =" http://schemas.microsoft.com/intellisense/ie5 "> </ HEAD> <body MS_POSITIONING =" GridLayout > <Form id = "form1" method = "post" runat = "server"> <font face = "ms ui gothic"> <ask: DataGrid id = "MyDataGrid" style = "z-index: 101; Left: 0px; Position: absolute; top: 112px "Runat =" server "width =" 744px "Height =" 224px "allowpaging =" true "> <PagersTyle visible =" false> </ pageerstyle> </ ask: dataGrid> < ASP: LINKBUTTON ID = "LinkButton1" Style = "Z-Index: 102; Left: 8px; Position: absolute; top: 96px" Runat = "server" width = "48px" Height = "8px"> Page </ ASP: LINKBUTTON> <as P: linkbutton id = "linkbutton2" style = "z-index: 103; Left: 64px; position: absolute; top: 96px" runat = "server" width = "56px"> Previous page </ asp: linkbutton> < asp: linkbutton id = "linkbutton3" style =</p> <p>Z-Index: 104; Left: 120px; Position: absolute; top: 96px "Runat =" server "width =" 48px "> Rear page </ asp: linkbutton> <ask: linkbutton id =" linkbutton4 "style = Z-Index: 105; Left: 176px; Position: absolute; top: 96px "runat =" server "width =" 80px "> Last page </ asp: linkbutton> <ask: label id =" label1 "style = Z-Index: 106; Left: 552px; Position: absolute; top: 80px "Runat =" server "width =" 56px "> Jump to: </ asp: label> <ask: textbox id =" txtGopage "style = "Z-Index: 107; Left: 624px; position: absolute; top: 80px" Runat = "server" width = "48px" Height = "24px"> </ asp: textbox> <ask: button id = "btngo" Style = "z-index: 108; Left: 680px; position: absolute; top: 80px" runat = "server" height = "24px" width = "56px" text = "button"> </ asp: button> <asp : Label id = "LBLCurrentIndex" style = "z-index: 109; Left: 296px; position: absolute; top: 88px" runat = "server" height = "24px" width = "120px"> label </ asp: label > <Ask: label id = "lblpagecount" style = "z-index: 110; Left: 424px; position: absolute; top: 88px" Runat = "Server" width = "112px"> label </ ask: label> </ font> </ form> </ body> </ html> web code:</p> <p>Private sub page_load (byval sender as system.Object, byval e as system.eventargs) Handles mybase.load 'ペ ペ ジ を 初 化 化 ユ ユ ザ ザ コ ド を ここ に し ま ま. ま ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユ ユIF not ispostback.</p> <p>ViewState ("strsort") = "ORDERID" mydatagrid.datasource = getdv (ViewState ("strsort"). Tostring ())</p> <p>MyDataGrid.Database () showstatspage () 'call orderbind () enddiff (byval strsrt as string) AS dataView</p> <p>DIM DV AS DATAVIEW</p> <p>DIM CN AS New SqlConnection</p> <p>Try</p> <p>Cn.connectionstring = "data source = yangchangquan; initial catalog = northwind; persist security info = false; user id = sa; password = pass;"</p> <p>Cn.open ()</p> <p>DIM ADP As SqldataAdapter = New Sqldataadapter ("Select * from Orders", CN)</p> <p>DIM DS AS New DataSet</p> <p>ADP.FILL (DS)</p> <p>DV = ds.tables (0) .defaultview</p> <p>Catch exception</p> <p>#If debug the</p> <p>Session ("error") = ex.toString ()</p> <p>Response.Redirect ("../ error.aspx")</p> <p>#End IF</p> <p>Finally</p> <p>'???</p> <p>Cn.close ()</p> <p>END TRY</p> <p>'Sort</p> <p>Dv.sort = strsort</p> <p>Return DV</p> <p>END FUNCTION</p> <p>Private sub mydatagrid_sortcommand (Byval Source as system.Object, byval e as system.Web.ui.WebControls.DataGridsortCommandeventAgs) MyDataGrid.currentpageIndex = 0</p> <p>'Get the column</p> <p>ViewState ("strsort") = E.Sortexpression.toString ()</p> <p>MyDataGrid.datasource = getDV (ViewState ("strsort"). TOSTRING ())</p> <p>MyDataGrid.Database</p> <p>Showstatspage () End Sub</p> <p>Private Sub btnGo_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click Dim pageI As Integer If (txtGoPage.Text <> "") Then pageI = CInt (Trim (txtGoPage.Text)) - 1 If (pageI> = 0 And pageI <(MyDataGrid.PageCount)) Then MyDataGrid.CurrentPageIndex = pageI End If End If ViewState ( "strSort") = "orderid" MyDataGrid.DataSource = GetDv (ViewState ( "strSort"). ToString ( ))</p> <p>MyDataGrid.Database () showstatspage () end sub</p> <p>Private Sub showstatspage () lblcurrentindex.text = "[<font color = 'blue'> The current page is:" & (MyDataGrid.currentpageIndex 1) & "page </ font>]" lblpagecount.text = "[<font color = 'Blue'> A total of: "& myDataGrid.pagecount &" page </ font>] "</p> <p>End Sub</p> <p>Private sub linebutton1_click (byval e as system.EventArgs) handles linkbutton1.click mydatagrid.currentpageindex = 0 viewState ("strsort") = "OrderID"</p> <p>MyDataGrid.datasource = getDV (ViewState ("strsort"). TOSTRING ())</p> <p>MyDataGrid.Database () showstatspage () end sub</p> <p>Private Sub LinkButton4_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton4.Click MyDataGrid.CurrentPageIndex = (MyDataGrid.PageCount - 1) ViewState ( "strSort") = "orderid"</p> <p>MyDataGrid.datasource = getDV (ViewState ("strsort"). TOSTRING ())</p> <p>MyDataGrid.Database () showstatspage () end sub</p> <p>Private Sub LinkButton2_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton2.Click If (MyDataGrid.CurrentPageIndex> 0) Then MyDataGrid.CurrentPageIndex = MyDataGrid.CurrentPageIndex - 1 ViewState ( "strSort") = "orderid" MyDataGrid.datasource = getDV (ViewState ("strsort"). TOSTRING ())</p> <p>MyDataGrid.Database () showstatspage () end if End Sub</p> <p>Private Sub LinkButton3_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton3.Click If (MyDataGrid.CurrentPageIndex <(MyDataGrid.PageCount - 1)) Then MyDataGrid.CurrentPageIndex = MyDataGrid.CurrentPageIndex 1 ViewState ( "strSort ") =" OrderID "</p> <p>MyDataGrid.datasource = getDV (ViewState ("strsort"). TOSTRING ())</p> <p>MyDataGrid.Database () showstatspage () end if End Sub</p> <p>carry out;</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-21951.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="21951" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.067</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'YDMA0Wwkin_2BHFbrmK8Yuw5jwUNtF_2B6h_2F2ZMHZCn8nrcRu7dk7rIRpsUQxZNXTZbk0gBiyn0_2FFGYbccWbCD_2FWcg_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>