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??
views:
165answers:
6C# doesn't have that anything really like that. Are you sure you aren't referring to JavaScript like @crescentfresh's answer?
there is no such thing as $get('') in C#, you might be talking about ASP.NET AJAX
$get
is a JavaScript "shortcut" function:
The
$get
shortcut function points to theSys.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).
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.
The underlying properties in C# are generated as Type.get_Property
and Type.set_Property
but I have never seen $get() anywhere.
$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.