閲覧総計:5519  (本日:1  昨日:0)

 カレンダの日付クリックでその日付をTextBoxに入力する法  10/08/08

【ポイント】

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    TextBox1.Text = Calendar1.SelectedDate
End Sub

開発環境:VWD2008 + Access2003
サーバ:ASP.NET3.5 + Access2003

【機能】DetailsViewで1件を1ページで新規データの入力を行う。
データ一覧表示はGridViewで行う。GridViewの「編集」機能も動作する。

【稼働画面】

CalTextInp01.jpg

【CalTextInp.aspx】

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        TextBox1.Text = Calendar1.SelectedDate
    End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>カレンダから日付入力</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        カレンダの日付クリックで日付入力  10/08/08<br />
        <br />
        【機能】カレンダの日付をクリックするとその日付がTextBoxに入力される<br />
        <asp:TextBox ID="TextBox1" runat="server" Width="151px"></asp:TextBox>
        <br />
        <asp:Calendar ID="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged"></asp:Calendar>
        <br />
    
    </div>
    </form>
</body>
</html>

【参考にしたページ】
  Calendarコントロール上で選択された日付について処理を行うには?  05/08/12
http://www.atmarkit.co.jp/fdotnet/dotnettips/337aspcalendarsel/aspcalendarsel.html



トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS