Asp. NET Learning Notes 002--asp.net server-side control what did 2

Source: Internet
Author: User

Asp. NET Learning Notes 002--asp.net server-side control what did 2

Previously written courses are not attached to the source code, I am sorry!
In the course of the source code can add QQ request: 1606841559
Technical Exchange QQ1 Group: 251572072
Technical Exchange QQ2 Group: 170933152
You can also download it yourself:
Asp. NET Learning Notes 002asp.net server-side controls do what 2.zip
Http://credream.7958.com/down_20144361.html
1. Program Structure
In the project:
There are two files under WebForm1.aspx:
Code in WebForm1.aspx:
<title></title>
<body>
<form id= "Form1" runat= "Server" >
<div>
</div>
The original HTML code can also be written together with the controls in the ASP.net engine
<input type = "button;" name = "/>
1. Note the button here; you need to enclose the quotation mark, or you may receive a warning due to an XML rule
2.
<asp:textbox id= "TextBox1" runat= "Server" ></asp:TextBox>
<asp:textbox id= "TextBox2" runat= "Server" ></asp:TextBox>
<asp:button id= "Button1" runat= "Server" onclick= "Button1_Click" text= "button"/>
<asp:textbox id= "TextBox3" runat= "Server" ></asp:TextBox>
</form>
</body>
------------------------------------------------------
<input id = "ABC" type= "button" value = "Tuzhu" runat= "Server"/>
<!--
1.runat= "Server" has this sentence is the server control, no this is the HTML control
-->
-------------------------------------------------------------------
WebForm1.aspx.cs for writing logic
WebForm1.aspx.designer.cs
-----------------------------------------------------------
For example in class, the ASP.net engine automatically generates the following HTML code:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
</title><body>
<form method= "POST" action= "WebForm1.aspx" Id= "Form1" >
<div class= "Aspnethidden" >
<input type= "hidden" name= "__viewstate" id= "__viewstate"/ wepdwujodcwnjaxnti1zgriib7rvqurxn6psjzoeycrkp00d6r1puuxdi+hakhllw== "/>
</div>
<div class= "Aspnethidden" >
<input type= "hidden" name= "__eventvalidation" id= "__eventvalidation"/ Wewbqlu3v3pdals0blrbgls0fbzdakm54rgbgls0yq1bz6qsf/ecv2iwbxy0tytlvnomezfjdi8yj+pesyxhzgi "/>
</div>
<div>
</div>
<input name= "TextBox1" type= "text" value= "2" id= "TextBox1"/>
<input name= "TextBox2" type= "text" value= "3" id= "TextBox2"/>
<input type= "Submit" Name= "Button1" value= "button" id= "Button1"/>
<input name= "TextBox3" type= "text" value= "5" id= "TextBox3"/>
</form>
</body>


-------------------------------------------------------------------
Asp. NET can be written into the original ecology of HTML and JavaScript
Like what:
<%@ Page language= "C #" autoeventwireup= "true" codebehind= "WebForm1.aspx.cs" inherits= "Webform.webform1"%>


<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">


<title></title>
<body>
<form id= "Form1" runat= "Server" >
<script src = "scripts/jquery-1.4.1.min.js" type= "Text/javascript" ></script>
<script type = "Text/javascript" language = "JavaScript" >
$ (function () {
$ ("#TextBox3"). MouseOver (function () {
$ (this). CSS ("Color", "Red");
});
});


</script>
<div>
</div>
<!--<input id = "ABC" type= "button" value = "Tuzhu" runat= "Server"/>
1.runat= "Server" has this sentence is the server control, no this is the HTML control
server controls, which can be in code.
<asp:button ID = "mycontrol" runat = "server"/>
1.asp.net controls can also write themselves
-->
<asp:textbox id= "TextBox1" runat= "Server" ></asp:TextBox>
<asp:textbox id= "TextBox2" runat= "Server" ></asp:TextBox>
<asp:button id= "Button1" runat= "Server" onclick= "Button1_Click" text= "button"/>
<asp:textbox id= "TextBox3" runat= "Server" ></asp:TextBox>
</form>
</body>
------------------------------------------------------------------

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.