General Information
.NET Subscription
Desktop
Web
Controls and Extensions
Mainteinance Mode
Enterprise and Analytic Tools
Quality Assurance and Productivity
Frameworks and Libraries
All docs
V19.2
General Information
.NET Subscription
Desktop
Web
Controls and Extensions
Mainteinance Mode
Enterprise and Analytic Tools
Quality Assurance and Productivity
Frameworks and Libraries
19.2
19.1
18.2
18.1
17.2
ASPxClientControl.GetControlCollection Method
Returns a collection of client web control objects.
Declaration
static GetControlCollection(): ASPxClientControlCollection
Returns
Type | Description |
---|---|
ASPxClientControlCollection | An ASPxClientControlCollection object representing the client-side collection of web controls. |
Remarks
Use the GetControlCollection method on the client side to gain access to the collection of all DevExpress client object instances..
A particular web control object can be accessed either by its unique hierarchically-qualified identifier, using the ASPxClientControlCollection.GetByName method.
Online Example
Examples
This example illustrates how to emulate the Tab key using the Enter key.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-navigate-between-editors-by-pressing-the-enter-key-like-by-the-tab-key-e3558
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page {
protected void Page_Load (object sender, EventArgs e) {
}
protected void btn_Click (object sender, EventArgs e) {
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>How to navigate between editors by pressing the Enter key like by the Tab key
</title>
<script type="text/javascript">
function DoProcessEnterKey(htmlEvent, editName) {
if (htmlEvent.keyCode == 13) {
ASPxClientUtils.PreventEventAndBubble(htmlEvent);
if (editName) {
ASPxClientControl.GetControlCollection().GetByName(editName).SetFocus();
} else {
btn.DoClick();
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
Focus the first editor and press the Enter key
</td>
</tr>
<tr>
<td>
<dx:ASPxTextBox ID="ASPxTextBox1" runat="server" ClientInstanceName="tb1" Width="170px">
<ClientSideEvents KeyDown="function(s, e) { DoProcessEnterKey(e.htmlEvent, 'tb2'); }" />
</dx:ASPxTextBox>
</td>
</tr>
<tr>
<td>
<dx:ASPxTextBox ID="ASPxTextBox2" runat="server" ClientInstanceName="tb2" Width="170px">
<ClientSideEvents KeyDown="function(s, e) { DoProcessEnterKey(e.htmlEvent, 'tb3'); }" />
</dx:ASPxTextBox>
</td>
</tr>
<tr>
<td>
<dx:ASPxTextBox ID="ASPxTextBox3" runat="server" ClientInstanceName="tb3" Width="170px">
<ClientSideEvents KeyDown="function(s, e) { DoProcessEnterKey(e.htmlEvent, ''); }" />
</dx:ASPxTextBox>
</td>
</tr>
<tr>
<td>
<dx:ASPxButton ID="btn" runat="server" AutoPostBack="False" ClientInstanceName="btn" UseSubmitBehavior="true"
OnClick="btn_Click" Text="Do PostBack">
</dx:ASPxButton>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>How to navigate between editors by pressing the Enter key like by the Tab key
</title>
<script type="text/javascript">
function DoProcessEnterKey(htmlEvent, editName) {
if (htmlEvent.keyCode == 13) {
ASPxClientUtils.PreventEventAndBubble(htmlEvent);
if (editName) {
ASPxClientControl.GetControlCollection().GetByName(editName).SetFocus();
} else {
btn.DoClick();
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
Focus the first editor and press the Enter key
</td>
</tr>
<tr>
<td>
<dx:ASPxTextBox ID="ASPxTextBox1" runat="server" ClientInstanceName="tb1" Width="170px">
<ClientSideEvents KeyDown="function(s, e) {DoProcessEnterKey(e.htmlEvent, 'tb2');}" />
</dx:ASPxTextBox>
</td>
</tr>
<tr>
<td>
<dx:ASPxTextBox ID="ASPxTextBox2" runat="server" ClientInstanceName="tb2" Width="170px">
<ClientSideEvents KeyDown="function(s, e) {DoProcessEnterKey(e.htmlEvent, 'tb3');}" />
</dx:ASPxTextBox>
</td>
</tr>
<tr>
<td>
<dx:ASPxTextBox ID="ASPxTextBox3" runat="server" ClientInstanceName="tb3" Width="170px">
<ClientSideEvents KeyDown="function(s, e) {DoProcessEnterKey(e.htmlEvent, '');}" />
</dx:ASPxTextBox>
</td>
</tr>
<tr>
<td>
<dx:ASPxButton ID="btn" runat="server" AutoPostBack="False" ClientInstanceName="btn" UseSubmitBehavior="true"
OnClick="btn_Click" Text="Do PostBack">
</dx:ASPxButton>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Protected Sub btn_Click(ByVal sender As Object, ByVal e As EventArgs)
End Sub
End Class
See Also
Feedback