简体   繁体   中英

Use of $get in C# ASP.NET AJAX

What is the use of $get('').value in ASP.NET AJAX? Is it different from the usual C# get and set properties of the same??

$get is a JavaScript "shortcut" function :

The $get shortcut function points to the Sys.UI.DomElement.getElementById JavaScript function which is defined as part of the ASP.NET AJAX client side library (which means you will need to include a ScriptManager on the page to be able to use it).

C# doesn't have that anything really like that. Are you sure you aren't referring to JavaScript like @crescentfresh's answer?

C#中没有$ get('')之类的东西,您可能正在谈论ASP.NET AJAX

When using ASP.NET Ajax, $get('') is the equivalence of document.getElementById(''). It is used in javascript code. Note, the page must include a script manager control.

C#中的基础属性是作为Type.get_PropertyType.set_Property生成的,但是我从未在任何地方看到$ get()。

$get is a shorthand used to get DOM-elements by their ID's (shorthand for document.getElementById). It's the ASP.NET AJAX way to avoid too many conflicts with other JavaScript frameworks/API's such as jQuery and Prototype. It simply returns the JavaScript DOM element for direct manipulation according to the WC3 spec (intepreted differently by different browsers unfortunately).

Developing components (GUI etc.) in ASP.NET AJAX makes another shorthand, $find, rather useful. It will return the "object" representing the component.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM