How to Find Controls on the Client Side

Use these expression parameters in a form's view expressions.

ParameterDescription
Expression Parameters
@ncontainerReference to a naming container that has an expression.
@bcontainerReference to a binding container that has an expression.
@templateReference to the template (form view) that contains an expression
@pageReference to a page.

Code Sample

The JavaScript code snippet demonstrates how to find a grid control, using client side code, that has the ID Grid1, which sits inside a form with the ID Form1. Each lever is prefixed with an underscore, so the path to Grid1 is _Form1_Grid1.

<%@ Control %>
<script>
function pageLoad()
{
    var grid = $find("<%= { @ncontainer.ClientID } %>_Form1_Grid1");
    //put your logic here....
}
 
</script>
<sq:Form runat="server" ID="Form1">
    <ContentTemplate>
 
        <sq:Grid runat="server" ID="Grid1">
        </sq:Grid>
 
    </ContentTemplate>
</sq:Form>

 
<sq:Grid runat="server" ID="Grid1"></sq:Grid>