Monday, October 12, 2009

Dreamweaver compose builds memoir of Blog whole journey (10) : Collection  bursts

The 10th chapter The implementation of BLOG incident calendar

  Since Doking ' S BLOG is study note, so it is OK to press calendar fish is all note and note reply.

Difficulty analysis: Should add Calendar calendar to accuse directly in pattern plate? Not! That is no good! Because Calendar calendar accuses it is the server accuses, should be in contain Runat="server" to express sheet this server accuses, but there can be to contain Runat="server" to express sheet only in one page, the mistake that if graph 10-1 place is shown,can appear sometimes otherwise shows.

Graph 10-1 The page can have an error that contains Runat="server" to express sheet only

How does that do? It is to adopt here embedded frame undertakes transferring.

10.1 Add Calendar calendar to accuse

(1) build dynamic page of a blank ASP.NET VB.

(2) insert take a Runat="server" to express sheet, install ID= " Calfrm " .

(3) those who click ASP.NET quick menu to fall " more label " pushbutton, playing piece [label selector] the choice in the dialog box " ASP.NET label " below " Asp Calendar " , if pursue,10-2 place is shown.

Graph 10-2 Insert " Asp Calendar " label

(4) by " insert " pushbutton, play piece [label editor, Calendar] dialog box, if pursue,10-3 place is shown. In this dialog, can accuse to Calendar calendar the style undertakes installing, because have Chinese, did not tell more here.

(5) save ASP.NET VB dynamic page to be DkCalendar.aspx. Browse in IE, if pursue,10-4 place is shown.

Graph 10-3 [label editor, Calendar] dialog box

           Graph 10-4 DkCalendar.aspx is browsed mediumly in IE

In graph 10-1-4, can see the indication of the week is too long, very ugly! If show,be " day, one, 2, 3, 4, 5, 6 " , that is good.

10.2 The week of modification Calendar shows

(1) DkCalendar.aspx is opened in Dreamweaver, switch arrives code view, search following code:

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="gb2312" %>

its instead:

<%@ Page Language="VB" Debug="true" Culture="zh-CN"%>

(2) those who click ASP.NET quick menu to fall " а : Xy " pushbutton, insert name a space, if pursue,10-5 place is shown.

(3) this stylish adds code:

<%@ Import Namespace="" %>

The input name a space System.Globalization, namely code instead:

<%@ Import Namespace="System.Globalization" %>

(4) add again name a space System.Threading, if pursue,as a result 10-6 place is shown.

Graph 10-5 Insert name a space

Graph 10-6 Insert the code after naming a space

(5) in code:

<%@ Import Namespace="System.Treading" %>

Later, empty group, insert following code:

<script Runat="server">

Dim Dkday ' the links string overall situation that defines generation of option date place is variable

' changes week of shown function

Private Sub Calendar1_PreRender(ByVal Sender As Object, byVal E As System.EventArgs) Handles Calendar1.PreRender

Dim Dkwek = System.Threading.Thread.CurrentThread

Dim Dknew = System.Globalization.CultureInfo.CurrentCulture.Clone()

" of day of Dknew.DateTimeFormat.DayNames = New String() {" , "One " , "2 " , "3 " , "4 " , "5 " , "6 "}

Dknew.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday

Dkwek.CurrentCulture = Dknew

End Sub

</script>

(6) the former code that chooses calendar to accuse a Calendar1, switch arrives [label] of face plate [attribute] option gets stuck, spread out " the exterior " option, choice " DayNameFormat " next pulling menu, choose " Full " , if pursue,10-7 place is shown.

(7) save DkCalendar.aspx, undertake browsing in IE, if pursue,as a result 10-8 place is shown.

  

Graph 10-7 Choice " DayNameFormat " the value is " Full "        Graph 10-8 After DkCalendar.aspx is revised, browse in IE

10.3 Add calendar incident

(1) DkCalendar.aspx is opened in Dreamweaver, switch arrives code view, choose the former code of Calendar1, right key clicks it, choose in playing the quick menu that go out " editor label (E)<asp:cAlendar> " , if pursue,10-9 place is shown.

Graph 10-9 Choose " editor label (E)<asp:cAlendar> "

(2) playing piece [editor label, Calendar] in the dialog box, spread out " incident " , choose " OnSelectionChanged " , be in " Calendar, OnSelectionChanged " in incident text area, input " Calendar1_SelectionChanged " , press " affirmatory " pushbutton, if pursue,10-10 place is shown.

Graph 10-10 Edit OnSelectionChanged incident

(3) the code that if graph 10-11 red encircles place to show,adds in label of code <script Runat="server"> .

Graph 10-11 Add Calendar1_SelectionChanged incident

(4) between label <head></head> , if graph 10-12 red encircles shows code,insert.

(5) look for label <body> , its instead is like graph 10-13 red to encircle shows code.

Graph 10-12 Insert Javascript function Dkwk

Graph 10-13 Modification label <body>

(6) again Calendar1 " DayNameFormat " set for " Full " , consult 10.2 medium the 6th measure.

(7) save DkCalendar.aspx, open Index.aspx, following code add in Page_load function:

If Request.QueryString("dkday")<>nothing Then

Ztre.CommandText="SELECT * FROM ZTRE WHERE Cstr(ZITIME) LIKE '%" &Request.QueryString("dkday")&"%' ORDER BY ZITIME DESC "

Else

If (request.QueryString("menanw")<>nothing) Or (session("menanw")<>nothing) Then

Ztre.CommandText="SELECT * FROM ZTRE WHERE LMID = ? ORDER BY ZITIME DESC "

Else

Ztre.CommandText="SELECT * FROM ZTRE ORDER BY ZITIME DESC "

End If

End If

If pursue,as a result 10-14 place is shown.

Graph 10-14 Code is added in Page_load function

(8) the former code that finds record volume Ztre, the command that deletes its CommanText place goes, if pursue,as a result 10-15 red encircles place to show.

Graph 10-15 Amend the former code of the adscript Ztre that record part

(9) save Index.aspx.

10.4 Add embedded frame

(1) open pattern plate Dkblog.dwt.aspx, in ASP.NET quick menu, click " more label " quick pushbutton, playing piece [label selector] in the dialog box, choose " HTML label " , choose " Iframe " , if pursue,10-16 place is shown.

Graph 10-16 Insert Iframe label (namely embedded frame)

(2) click " insert " pushbutton, playing piece [label editor, Iframe] what insert to wanting in the dialog box is embedded frame undertakes place is shown concerned installing is like graph 10-17.

Graph 10-17 Right embedded frame undertakes concerned installing

(3) press " affirmatory " pushbutton, return [label editor, Iframe] dialog box, press again " shut " pushbutton.

(4) save pattern plate Dkblog.dwt.aspx, update all webpages.

(5) Index.aspx is browsed in IE, if pursue,as a result 10-18 place is shown.

Graph 10-18 Index.aspx is browsed in IE

  Remind: Actually the implementation of calendar incident is very complex incident, a simple case just gives out here. It is embedded that this one still has a difficulty frame is right advocate the control of window object, just lifted in here with "Parent.location.href" control advocate of window webpage be on the move. These left readers to study slowly.

No comments:

Post a Comment