In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to understand ASP.NET AJAX". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to understand ASP.NET AJAX".
Re-examine ASP.NET AJAX client Development with the idea of component
Default.aspx:
DOCTYPEhtmlPUBLIC "- / / W3C//DTDXHTML1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" >
< htmlxmlns= "http://www.w3.org/1999/xhtml" >
< headrunat= "server" >
< title > UntitledPagetitle >
Head >
< body >
< formid= "form1" runat= "server" >
< asp:ScriptManagerID= "ScriptManager1" runat= "server" >
< Scripts >
< asp:ScriptReferencePath= "~ / ajax.js" / >
Scripts >
< Services >
< asp:ServiceReferencePath= "~ / SayHelloService.asmx" / >
Services >
Asp:ScriptManager >
< div >
< inputid= "btnSayHello" type= "button" value=
"SayHello" onclick= "btnSayHello_onClick ()" / >
< divid= "result" > div >
< / div >
< / form >
< / body >
< / html >
Ajax.js:
/ / JS function called when btnSayHello is clicked functionbtnSayHello_onClick () {SayHelloService.SayHello (OnSucceeded,OnFailded);} / callback function functionOnSucceeded (reusltText) {$get ("result") [xss_clean] = reusltText;} / / callback function functionOnFailded (error) {$get ("result") [xss_clean] = "failed. Error message:" + error.get_message ();}
This is a familiar JavaScript programming model: based on DOM operations. In this programming mode, all page elements are treated as a tree-like collection of DOM elements, and the corresponding DOM operations are used to obtain data or change the attributes of page elements. For example, if we want to get a value in a text box, we first use the document.getElementById (abbreviated to $get in the ASP.NET AJAX framework) method to get the DOM reference of the text box, and then get the value of its value property.
This programming mode can easily confuse us, such as text boxes, check boxes, submit buttons, DOM representations of ordinary buttons are all "input" elements, and we have to set the value of div or span using a name that is not very intuitive, such as innerHTML. In fact, for developers, especially those who have been engaged in server-side development for a long time, we prefer to think of text boxes as TextBox, check boxes as CheckBox, buttons as Button, div or span as Label, and we prefer to use statements like label1.text to set up the text in div rather than using innerHTML.
Fortunately, ASP.NET AJAX developers have obviously taken this into account, and the ASP.NET AJAX framework now allows us to use a server-side component-like programming model for client-side programming.
Thank you for your reading, the above is the content of "how to understand ASP.NET AJAX". After the study of this article, I believe you have a deeper understanding of how to understand ASP.NET AJAX, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.