Export (0) Print
Expand All

SelectedDatesCollection.Remove Method

Removes the specified System.DateTime from the SelectedDatesCollection.

[Visual Basic]
Public Sub Remove( _
   ByVal date As DateTime _
)
[C#]
public void Remove(
 DateTime date
);
[C++]
public: void Remove(
 DateTime date
);
[JScript]
public function Remove(
   date : DateTime
);

Parameters

date
The System.DateTime to remove from the SelectedDatesCollection.

Remarks

Use this method to remove the specified System.DateTime from the SelectedDatesCollection.

Example

[Visual Basic, C#] The following example demonstrates how to use the Remove method to remove an item from the SelectedDatesCollection.

[Visual Basic] 
<%@ Page Language="VB" AutoEventWireup="True" %>
<html>
 <head>
 
    <script language="VB" runat="server">

        Sub Button_Click(sender As Object, e As EventArgs)
            
            If Calendar1.SelectedDates.Count > 0 Then
                Calendar1.SelectedDates.Remove(Calendar1.SelectedDates(0))
            End If
            
        End Sub

    </script>
 
 </head>     
 <body>
 
    <form runat="server">
 
       <asp:Calendar ID="Calendar1" runat="server"  
            SelectionMode="DayWeekMonth"/>
 
       <hr>
    
       Select some dates then click the button below <br><br>
 
       <asp:Button id="Button1"
            text="Remove First Date" 
            OnClick="Button_Click"  
            runat=server  /> <br>
 
       <asp:Label id="Label1" runat=server />
 
    </form>
 </body>
 </html>
    

[C#] 
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
 <head>
 
    <script language="C#" runat="server">
 
       void Button_Click(Object sender, EventArgs e) 
       {
 
          if (Calendar1.SelectedDates.Count > 0)
             Calendar1.SelectedDates.Remove(Calendar1.SelectedDates[0]);
 
       }
 
    </script>
 
 </head>     
 <body>
 
    <form runat="server">
 
       <asp:Calendar ID="Calendar1" runat="server"  
            SelectionMode="DayWeekMonth"/>
 
       <hr>
    
       Select some dates then click the button below <br><br>
 
       <asp:Button id="Button1"
            text="Remove First Date" 
            OnClick="Button_Click"  
            runat=server  /> <br>
 
       <asp:Label id="Label1" runat=server />
 
    </form>
 </body>
 </html>
    

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

SelectedDatesCollection Class | SelectedDatesCollection Members | System.Web.UI.WebControls Namespace | System.DateTime

Show:
© 2014 Microsoft