Complete your ASP.NET program immediately

xiaoxiao2021-03-06  48

The emergence of computer security supervision of the Nanhai Public Security Bureau in Guangdong Province, so that the network programmer is fully found in the design of the "design program", of course, more, they feel asp.net Handheld. However, there is no progress that you don't want to be lazy. If you rely on ASP.NET's powerful features and don't want other means, you will soon find that someone else's design prior is much faster and easier. Now, let's learn a few tricks to lazy means, let others follow you behind you. Friends who have used ASP must remember that many of the ASPs require some third-party component implementation, such as the implementation of the file upload function, often use the ASPCNUP component implementation. Use these components, not only can expand the functionality of the ASP program, but also greatly improve program development speed. The lazy means introduced here is to introduce several components that are closely related to our usual design. I. Super Data Form: SuperdataGrid ASP.NET comes with powerful DATGRID function, customization is also very convenient, but because it is not specifically designed for database applications. So, when you connect the database, we have to connect to the database first, then bind data. SuperDataGrid is specifically designed for database, so those cumbersome connection databases, we don't have to write. Need SuperDataGrid to simplify some properties of DataGrid, use this control, we can easily implement the display, sorting, modifying data of database data, and implement the implementation of these functions, as long as you simply a few lines of code. We now look at its use. A) Display Data Sheet The following code demonstrates how to use SuperDataGrid to simply display all data in the data table: <% @ register tagprefix = "super" namespace = "sar" name "assembly =" superexpert.superDataGrid "%> see specific effects: http://www.superexpertcontrols.com/superdatagrid/samples /sample1.aspx now, let's simply analyze the above code. The first exercise calls the SuperDataGrid control, and we will use in future examples. The second line, and the standard DataGrid use is similar, let's take a look at some properties of SuperDataGrid: Connectionstring: Because it is a connection database, it is certainly less than the database connection statement. This parameter is the statement to connect data; TABLENAME: To display a specific table, we are defined here. Seeing this, we have already felt "simple", but in actual applications, there is very little situation like this directly displaying a table. So, we need more functions. Directly, we need the return result of the SELECT statement.

<% @ Register TagPrefix = "Super" Namespace = "Superexpert.Data" Assembly = "Superexpert.SuperDataGrid"%> see specific effects: The above code returns http://www.superexpertcontrols.com/superdatagrid/samples/sample2.aspx The result of the SELECT statement. Here, we have seen a new attribute: COMMANDTEXT: and Command, it is a SELECT statement; 2) Data Sort in DataGrid, the data sort is simple, but the code is still a lot. We now look at how to sort the data in SuperDataGrid: <% @ Register TagPrefix = "Super" Namespace = "Superexpert.Data" Assembly = "Superexpert.SuperDataGrid"%>

Specific effect, please see: http://www.supeRexpertControls .com / superdataGrid / samples / sample3.aspx carefully viewed the above code, in fact, set an enablesortinga property is true. That is to open the sort function. A point you need to pay carefully should be included in the Form.

3) Data Page in ASP, many friends will worry about paging, now, we look at how to paginate in SuperDataGrid: <% @ register tagprefix = "super" name "asmbly =" superexpert.superDataGrid "%>%>%>%>%> Specific results Please see: http://www.superexpertControls.com/superDataGrid/samples/sample4.aspx Let's take a look at several new properties of SuperDataGrid: Enablepaging: First We must now open the data paging; Data,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,. Now, SuperDataGrid also provides this feature. Of course, we don't need to write so many codes, just need simple settings, others, superDataGrid all help us. <% @ Register TagPrefix = "Super" Namespace = "Superexpert.Data" Assembly = "Superexpert.SuperDataGrid"%> specific effects see: http://www.superexpertcontrols.com/superdatagrid/samples /sample5.aspx looks at the above code, if you need to edit the data, just add the enableEDITING attribute. Is it particularly simple? Of course, we still have to put superDataGrid in Form.

5) Cache Function of Cache ASP.NET We already know very powerful, but, specific to SuperDataGrid, you will find it more convenient. When using SuperDataGrid, you will automatically cache the displayed data to improve program efficiency. Setting the cache feature You can use the cachescope property, we can set the cache type to Application, SESSION, and NONE. SuperDataGrid default cache type is Application, which is all users share caches; if the session is used, the cache is only for special users; if set to none, that is not to cache the function. The default, the cache will remain for 30 minutes, of course, we can set the cache time using the cacheduration property, in minutes. Second, Super Form: SUPEREXPERT DATAFORM Just now we have seen SuperDataGrid already has data modification, but due to data browsing and modification, we actually use that way, more, we also say to use a single record to modify. In the past, we need a lot of work in using a form to modify or add database data, such as setting data format, etc. If there are more data, it is more cumbersome. Now, using SUPEREXPERT DATAFORM, we can simply implement these features. SUPEREXPERT DATAFORM automatically saves or modifies database data, and it can also be automatically generated from the database (actually browsing data), and we can even custom style to move modifications and update the database table. A) automatically generate forms from database suppose we use the following SQL statement generates a call CustomerSurveys data table: Create Table CustomerSurvey (Customer_ID INT NOT NULL IDENTITY Primary Key, Customer Varchar (50) NOT NULL, Age INT NOT NULL, Birthdate DateTime NOT NULL Comments text) This data table has five fields for Customer_ID, Customer, AGE, BIRTHDATE, and Comments. We can automatically generate a form using SUPEREXPERT DATAFORM, using this form, we can add data directly to the data table.

<% @ Register tagprefix = "super" namespace = "superexpert.data" askEMBLY = "superexpert.dataform"%> simpledataform.aspx </ title> </ head> <body> <super : SqlDataForm Tablename = "Customersurvey" Connectionstring = "Server = localhost; uid = sa; pwd = secret; database = pubs" mode = "addrecord" runat = "server" /> </ body> </ html> The specific effect is as follows: http://www.superexpertControls.com/DataForm/Samples/Sample1.aspx To better understand SupersterT DataForm, we must understand those things that can be generated: 1. The TextBox width in the form is automatically based on the data table data width. Generated; 2, verification of data in the form is automatically generated. If the data table requires the data is not null, the input is required to enter the form; if the data is int, the request is required to fill in the DateTime, which is required to fill in DateTime data. 3. After clicking the submit button, the data is automatically saved to the data sheet. All we have to do just provide a data sheet name and database connection string. 2) Setting the DataForm mode DataForm has the following modes: 1. AddRecord: Add data mode; 2. UpdateRecord: Modify single data mode; 3. UpdateTable: Batch modified data mode; 4, Custom: When you submit data, you can set your own logic Verify; in order to modify a already existing data, we must set the DataForm mode to UpdateRecord. Then, we must determine the modified data, we uniquely determine a data through DataKeyField and DataKeyValue, DatakeyField is the data table master key; DatakeyValue is the value of the primary key of a data.</p> <p>The following code modifies the third record in the data table: <% @ register tagprefix = "super" namespace = "superexpert.data" assembly = "superexpert.dataform"%> <html> <head> <title> dataformupdateRecord.asp </ title> </ head> <body> <super: SqlDataForm TableName = "CustomerSurvey" ConnectionString = "Server = Localhost; UID = sa; PWD = secret; Database = Pubs" DataKeyField = "Customer_ID" DataKeyValue = "3" Mode = " UpdateRecord "runat =" server "/> </ body> </ html> The specific effect is as follows: http://www.supeRexpertControls.com/dataForm/Samples/Sample2.aspx Or above the code set Mode as UpdateRecord, set DATAKEYFIELD for Customer_ID, Set DatakeyValue to 3. If we need to modify all the data in the data table, set the DataForm mode to UpdateTable. After setting to modify the entire table, generate a navigation bar above the data form, through this navigation bar, we can browse all the data in the data table. <% @ Register tagprefix = "super" namespace = "superexpert.data" assembly = "superexpert.dataform"%> <html> <head> <title> dataformupdatetable.aspx </ title> </ head> <body> <super> <SUPER : SqlDataForm TableName = "CustomerSurvey" ConnectionString = "Server = Localhost; UID = sa; PWD = secret; Database = Pubs" DataKeyField = "Customer_ID" Mode = "updateTable" runat = "Server" /> </ body> </ html > The specific effects are as follows: http://www.supeRexpertControls.com/dataForm/Samples/Sample3.aspx If we set the mode to Custom, we can set the action after submitting the form. For example, the following code is implemented to the THANKYOU.ASPX page after the submission form is submitted.</p> <p><% @ Register TagPrefix = "Super" Namespace = "Superexpert.Data" Assembly = "Superexpert.DataForm"%> <Script runat = "Server"> Sub Form_Submit (s As Object, e As EventArgs) myForm.Save () Response .Redirect ("THANKYOU.ASPX") End Sub </ script> <html> <head> <title> dataformcustom.aspx </ title> </ head> <body> <super: SqlDataForm ID = "MyForm" TableName = " Customersurvey "Connectionstring =" server = localhost; uid = sa; pwd = second; database = pubs "mode =" custom "onSubmit =" form_submit "runat =" server "/> </ body> </ html> The specific effect is as follows: Http://www.superexpertControls.com/dataform/samples/sample4.aspx 3) Setting DataForm Style DataForm There are four styles we can modify: 1. Headerstyle: Define the header style of the data form; 2, labelstyle: Define data forms Label style; 3, FieldStyle: Define the field style of the data form; 4, Footerstyle: Define the Footer style of the data form; DataForm also supports the following property settings: GridLines: Defines the line format of the data form, including: None, Both, Horizontal and Vertical .</p> <p>Height: Data Form Control Height; Width: Data Form Control Width; Boderstyle: Data Table Single Box Format; BorderWidth: Data State Single Box Width; BorderColor: Data State Single Box Color; Cellpadding: Data Form Control Size; Cellspacing: Data Form Control Interval; We now look at an example: <% @ register tagprefix = "super" namespace = "superexpert.data" assembly = "superexpert.dataform"%> <html> <head> <title> dataformstyle.aspx </ title> </ head > <body> <super: SqlDataForm HeaderStyle-backColor = "Salmon" FieldStyle-backColor = "yellow" LabelStyle-Font-Name = "Script" LabelStyle-Font-Size = "28pt" FooterStyle-backColor = "blue" Cellpadding = " 10 "Cellspacing =" 0 "GridLines =" Both "BorderStyle =" Dashed "BorderColor =" red "BorerWidth =" 10px "LabelStyle-BackColor =" lightgreen "TableName =" CustomerSurvey "ConnectionString =" Server = Localhost; UID = sa; PWD = Secret; Database = PUBS "runat =" server "/> </ body> </ html> The specific effects are as follows: http://www.superexpertControls.com/dataform/samples/sample5.aspx 4) Custom layout DataForm We can also add control design data form layout, which can increase the controls as follows: ● DataTextBox ● DataDropdownList ● DataraDiobutton ● DataCheckbox ● DataListbox ● DataraDiobuttonList ● DataLabel No control has extended standard control The function of the part. These controls have two properties: DataField and DataType. DataField allows controls and database specific fields, DataType defines the type of input data.</p> <p>The following is an example of adding data: <% @ register tagprefix = "super" namespace = "superexpert.data" Assembly = "superexpert.dataform"%> <script runat = "server"> Sub Form_Submit (s AS Object, e as Eventargs) MyForm.Save () Response.Redirect ("Thankyou.aspx") End Sub </ script> <html> <head> <title> dataformcustomLayout.aspx </ title> </ head> <body> <super: SqlDataForm id = "myForm" TableName = "CustomerSurvey" ConnectionString = "Server = Localhost; UID = sa; PWD = secret; Database = Pubs" runat = "Server"> Customer Name: <br> <super: DataTextBox DataField = "Customer" Runat = "server" /> <p> agextbox datafield = "agn" runat = "server" /> <p> birthdate: <br> <super: DataTextBox datafield = "birthdate" runat = "Server" /> <p> <asp: button text = "address =" form_submit "runat =" server "/> <p> </ super: SqlDataForm> </ body> </ html> specific Please see: http://www.superexpertControls.com/dataForm/Samples/sample6.aspx 3 In terms of these functions. SuperExpert ImageText allows us to make text to generate images very simple. We can generate images using any of the fonts installed on the server, or you can use all of the image special effects to be mentioned below to generate images. We can use SUPEREXPERT ImageText to quickly generate images, it is the advantage that we can fully control the style of text. A) Automatically generate an image to use SUPEREXPERT ImageText, and we only provide a unique ID and text that needs to be transformed.</p> <p>The following example will generate "Hello World": <% @ register tagprefix = "super" namespace = "superexpert" assembly = "superspert.imagetext"%> <super: imagetext id = "ctrlhello" text = "Hello World!" Runat = "Server" /> Please see: http://www.superexpertControls.com/imagetextbeta2/samples/sample1.aspx To achieve better results, we can set fonts and colors for words, or set image background The example below is this: <% @ register tagprefix = "super" namespace = "superspert" assembly = "superspert.imagetext"%> <super: imagetext id = "ctrlcomic" text = "Hello World!" Font-name = "COMIC SANS MS" font-size = "34" forcolor = "DARKBLUE" runat = "server" /> <p> <super: imagext id = "ctrlimpact" text = "Hello World!" Font-name = "ompact" Font-size = "24" forecolor = "red" backcolor = "black" runat = "server" /> Specific results Please see: http://www.superexpertControls.com/imagetext.aspx Need to know No matter what font is used, as long as the font used is installed, all browsers can be displayed correctly as they have been converted to images.</p> <p>2) The shadow effect is set by setting the DROPSHADOW attribute, we can convert words to images with shadow effects: <% @ register tagprefix = "super" namespace = "superexpert" assembly = "superexpert.imagetext"%> <super: iMageText ID = "ctrldrop" text = "Hello World!" Font-name = "impact" font-size = "34" DROPSHADOW-Display = "true" dropshadow-xoffset = "3" runat = "server" /> The specific effect is as follows : Http://www.superexpertControls.com/imagetextbeta2/samples/sample3.aspx For shadow effects, we can also set the following properties to enhance: ● DROPSHADOW-XOFFSET: horizontal direction offset ● Dropshadow-yoffset: Vertical direction offset ● Dropshadow-alpha: Set Shadow Transparency ● DROPSHADOW-Color: Set Shadow Colors 3) Rotating the text effect By setting the text's RotateFlip property, we can rotate the text: <% @ register tagprefix = "super" namespace = "superexpert" Assembly = "Superexpert.imagetext"%> <super: imagetext id = "ctrlhello" text = "Hello World!" Font-size = "24" ROTEFLIP = "rotate90flipnone" runat = "server" /> <p> <super: imagetext ID = "ctrlhello2" text = "Hello World!" font-size = "24" rotateflip = "rotate180flipnone" runat = "server" /> Specific effect, please see: http://www.supeRexpertControls.com/imagetextbeta2/samples/sample4 .aspx 4) Control Image Background We can set up background for gradual color, picture or special pattern, the following is an exemplary color background: <% @ r egister TagPrefix = "Super" Namespace = "Superexpert" Assembly = "Superexpert.ImageText"%> <Super: ImageText ID = "ctrlHello" BackGround-Gradient = "True" CellPadding = "4" Text = "! Hello World" Runat = "Server" /></p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-62534.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="62534" 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.144</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 = 'Nxt59f5hQ070qh8XxSg0AkZHl1LKm9U3VYDyBIOPm_2FEMNSR5j2POAjTdYAnO7RZNeLzwnGJlefdg59bA6gSLzg_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>