ASPxDateEdit.PopupCalendarOwnerID Property
Gets or sets the ID of a date editor whose popup window (with a calendar and a time edit) should be used by the current date editor.
Namespace: DevExpress.Web
Assembly:
DevExpress.Web.v22.2.dll
NuGet Package:
DevExpress.Web
Declaration
Property Value
Type |
Default |
Description |
String |
String.Empty
|
A string value specifying the donor date editor’s ID.
|
Editors of the ASPxDateEdit type enable an individual date editor’s popup calendar (and a time edit if it is visible) and its settings to be shared between several date editors. This feature allows you to decrease the size of the HTML code rendered into the web page by date editors, since a popup window is rendered only once, and can then be used (invoked) by all date editors on the page.
Use the PopupCalendarOwnerID property to refer to a date editor control whose popup calendar should be used by the current editor. Note that if the PopupCalendarOwnerID property is set, the popup calendar’s settings are taken from the ASPxDateEdit.CalendarProperties property of the specified date editor. If the time edit is visible (the DateEditTimeSectionProperties.Visible is set to true
) its settings are taken from the ASPxDateEdit.TimeSectionProperties property of the specified date editor.
Note
The PopupCalendarOwnerID property should not refer to a date editor whose PopupCalendarOwnerID property is also set.
Example
This example shows how to minimize the amount of rendered HTML code by using the same calendar control for every date editor within the ASPxGridView.
View Example
using System;
using DevExpress.Web.Data;
using DevExpress.Web;
public partial class _Default : System.Web.UI.Page {
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
if(!IsPostBack)
Grid.StartEdit(0);
}
protected void Grid_RowUpdating(object sender, ASPxDataUpdatingEventArgs e) {
e.Cancel = true;
}
protected void Grid_CellEditorInitialize(object sender, DevExpress.Web.ASPxGridViewEditorEventArgs e) {
SetupCalendarOwner(e.Editor as ASPxDateEdit);
}
protected void Grid_AutoFilterCellEditorInitialize(object sender, DevExpress.Web.ASPxGridViewEditorEventArgs e) {
SetupCalendarOwner(e.Editor as ASPxDateEdit);
}
void SetupCalendarOwner(ASPxDateEdit editor) {
if(editor == null) return;
editor.PopupCalendarOwnerID = "__ReferenceDateEdit";
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v15.1" Namespace="DevExpress.Web" 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>Example</title>
</head>
<body>
<form id="form1" runat="server">
<dx:ASPxGridView runat="server" ID="Grid" AutoGenerateColumns="False" DataSourceID="AccessDataSource1" KeyFieldName="OrderID" OnAutoFilterCellEditorInitialize="Grid_AutoFilterCellEditorInitialize" OnCellEditorInitialize="Grid_CellEditorInitialize" OnRowUpdating="Grid_RowUpdating">
<Columns>
<dx:GridViewCommandColumn VisibleIndex="0" ShowEditButton="True" ShowClearFilterButton="True"/>
<dx:GridViewDataTextColumn FieldName="OrderID" ReadOnly="True" VisibleIndex="1">
<EditFormSettings Visible="False" />
</dx:GridViewDataTextColumn>
<dx:GridViewDataDateColumn FieldName="OrderDate" VisibleIndex="2" />
<dx:GridViewDataDateColumn FieldName="RequiredDate" VisibleIndex="3" />
<dx:GridViewDataDateColumn FieldName="ShippedDate" VisibleIndex="4" />
</Columns>
<Settings ShowFilterRow="True" />
</dx:ASPxGridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/nwind.mdb"
SelectCommand="SELECT [OrderID], [OrderDate], [RequiredDate], [ShippedDate] FROM [Orders]">
</asp:AccessDataSource>
<dx:ASPxDateEdit runat="server" ID="__ReferenceDateEdit" ClientVisible="false">
<CalendarProperties>
<Style BackColor="LightYellow" />
</CalendarProperties>
</dx:ASPxDateEdit>
</form>
</body>
</html>
Imports System
Imports DevExpress.Web.Data
Imports DevExpress.Web
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Overrides Sub OnLoad(ByVal e As EventArgs)
MyBase.OnLoad(e)
If Not IsPostBack Then
Grid.StartEdit(0)
End If
End Sub
Protected Sub Grid_RowUpdating(ByVal sender As Object, ByVal e As ASPxDataUpdatingEventArgs)
e.Cancel = True
End Sub
Protected Sub Grid_CellEditorInitialize(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridViewEditorEventArgs)
SetupCalendarOwner(TryCast(e.Editor, ASPxDateEdit))
End Sub
Protected Sub Grid_AutoFilterCellEditorInitialize(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridViewEditorEventArgs)
SetupCalendarOwner(TryCast(e.Editor, ASPxDateEdit))
End Sub
Private Sub SetupCalendarOwner(ByVal editor As ASPxDateEdit)
If editor Is Nothing Then
Return
End If
editor.PopupCalendarOwnerID = "__ReferenceDateEdit"
End Sub
End Class
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v15.1" Namespace="DevExpress.Web" 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>Example</title>
</head>
<body>
<form id="form1" runat="server">
<dx:ASPxGridView runat="server" ID="Grid" AutoGenerateColumns="False" DataSourceID="AccessDataSource1" KeyFieldName="OrderID" OnAutoFilterCellEditorInitialize="Grid_AutoFilterCellEditorInitialize" OnCellEditorInitialize="Grid_CellEditorInitialize" OnRowUpdating="Grid_RowUpdating">
<Columns>
<dx:GridViewCommandColumn VisibleIndex="0" ShowEditButton="True" ShowClearFilterButton="True"/>
<dx:GridViewDataTextColumn FieldName="OrderID" ReadOnly="True" VisibleIndex="1">
<EditFormSettings Visible="False" />
</dx:GridViewDataTextColumn>
<dx:GridViewDataDateColumn FieldName="OrderDate" VisibleIndex="2" />
<dx:GridViewDataDateColumn FieldName="RequiredDate" VisibleIndex="3" />
<dx:GridViewDataDateColumn FieldName="ShippedDate" VisibleIndex="4" />
</Columns>
<Settings ShowFilterRow="True" />
</dx:ASPxGridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/nwind.mdb"
SelectCommand="SELECT [OrderID], [OrderDate], [RequiredDate], [ShippedDate] FROM [Orders]">
</asp:AccessDataSource>
<dx:ASPxDateEdit runat="server" ID="__ReferenceDateEdit" ClientVisible="false">
<CalendarProperties>
<Style BackColor="LightYellow" />
</CalendarProperties>
</dx:ASPxDateEdit>
</form>
</body>
</html>
See Also