views:

165

answers:

6

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??

+2  A: 

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

Daniel A. White
+2  A: 

there is no such thing as $get('') in C#, you might be talking about ASP.NET AJAX

BlackTigerX
+9  A: 

$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).

Crescent Fresh
+1  A: 

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.

Bradley
A: 

The underlying properties in C# are generated as Type.get_Property and Type.set_Property but I have never seen $get() anywhere.

mikeschuld
A: 

$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.

TigerShark