ASP.Net/Mobile Control/Calendar

Материал из .Net Framework эксперт
Версия от 11:52, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Get Mobile calendar selected date (VB.net)

<%@ Page 
    Inherits="System.Web.UI.MobileControls.MobilePage" 
    Language="VB" 
%>
<%@ Register 
    TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" 
%>
<script runat="server" language="VB">
Sub calSelectChange(ByVal Sender as Object, _
    ByVal E as EventArgs)
    Dim i as Integer
    lbl1.Text = "You selected:"
    For i = 0 to Cal1.SelectedDates.Count - 1
        lbl1.Text = lbl1.Text & " " _
            & Cal1.SelectedDates(i).ToShortDateString()
    Next    
End Sub
</script>
<mobile:form 
    id="FirstPage" 
    runat="server">
    <mobile:calendar  
        id="Cal1"
        selectionmode="DayWeekMonth"
        onselectionchanged="calSelectChange"
        runat="server"
    />
    <mobile:label
        id="lbl1"
        runat="server"
    />
</mobile:form>



Mobile calendar selection mode (VB.net)

<%@ Page 
    Inherits="System.Web.UI.MobileControls.MobilePage" 
    Language="VB" 
%>
<%@ Register 
    TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" 
%>
<script runat="server" language="VB">
</script>
<mobile:form 
    id="FirstPage" 
    runat="server">
    <mobile:calendar  
        id="cal1"
        selectionmode="DayWeekMonth"
        runat="server"
    />
</mobile:form>



Mobile date selection changed event (VB.net)

<%@ Page 
    Inherits="System.Web.UI.MobileControls.MobilePage" 
    Language="VB" 
%>
<%@ Register 
    TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" 
%>
<script runat="server" language="VB">
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
    If Not IsPostBack Then
        Cal1.SelectedDate = DateAdd( _
            Microsoft.VisualBasic.DateInterval.Year, _
            1, Today())
        Cal1.VisibleDate = DateAdd( _
            Microsoft.VisualBasic.DateInterval.Year, _
            1, Today())
    End If
End Sub
Sub calSelectChange(ByVal Sender as Object, _
    ByVal E as EventArgs)
    lbl1.Text = "You selected " _
        & Cal1.SelectedDate
End Sub
</script>
<mobile:form 
    id="FirstPage" 
    runat="server">
    <mobile:calendar  
        id="Cal1"
        runat="server"
        onselectionchanged="calSelectChange"
    />
    <mobile:label
        id="lbl1"
        runat="server"
    />
</mobile:form>



Simplest mobile calendar (VB.net)

<%@ Page 
    Inherits="System.Web.UI.MobileControls.MobilePage" 
    Language="VB" 
%>
<%@ Register 
    TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" 
%>
<script runat="server" language="VB">
</script>
<mobile:form 
    id="FirstPage" 
    runat="server">
    <mobile:calendar  
        id="cal1"
        runat="server"
    />
</mobile:form>