Dreamweaver Construction Blog Full record (5): The implementation of columns and replies

Source: Internet
Author: User
Tags filter definition insert integer modify dreamweaver
Dreamweaver

In the fourth chapter of the completion of the home page is actually very imperfect, one is the note menu columns do not have links, can not click; the second is to click the note title, can not link to the reply page; Third, click on the author, can not link the author's information. These features will be perfected in this chapter.

5.1 Note Menu Columns implementation

Design idea: Modify the hyperlink in the menu column in the template bkblog.dwt.aspx, and then update all the pages; When you open the first page, browse to display the contents of the notes in descending order, click on the menu columns, and then sort the contents of the notes in descending chronological order according to the columns.

  5.1.1 Create Template Menu

(1) Open the template bkblog.dwt.aspx, select dynamic text (MENUDA.LM), create hyperlinks, link to the home page (index.aspx), select Code display view, and move the mouse to the red vertical line shown in Figure 5-1-1. (There is no special indication that all symbols are in English characters)

Figure 5-1-1 Mouse move to link properties

(2) Enter "? menanw=" (MENANW is the parameter variable), switch to the bindings panel, drag the field under the DataSet (Menuda) Lmid to the equals number you just entered, the result is shown in Figure 5-1-2:

Figure 5-1-2 Insert dynamic Property (A.HREF)

(3) switch to the server behavior panel to see that a server behavior has been added: Dynamic Properties (A.HREF), as shown in Figure 5-1-3:

Figure 5-1-3 Server Behavior panel

(4) Select "Home" menu, create link to index.aspx, select "Contact Us", create link to mailto:wen110@21cn.com.

(5) Save the bkblog.dwt.aspx template, which will pop up the dialog shown in Figure 5-1-4.

Figure 5-1-4 Update template file dialog box.

(6) Click the "Update" button, complete the note menu compartment, and update the home index.aspx.

  5.1.2 in the first page to implement the column display

(1) Open the first page index.aspx, switch to the Server Behaviors Panel, double-click the DataSet (Ztre), and in the pop-up DataSet dialog box, click the Advanced button, as shown in Figure 5-1-5. Select the SQL command in the SQL text area for replication, and it is recommended that you paste it into the newly created Notepad or word text, which will work well in the next step (familiar with the SQL language, you can skip this step).

Figure 5-1-5 Data Set Advanced dialog box

(2) Click the "Simple" button, select the Filter field in the Filter Drop-down menu lmid, choose "url parameter" as the parameter pass mode, input parameter variable is MENANW, press "OK" key, the result is as shown in Figure 5-1-6:

Figure 5-1-6 Modifying ztre datasets for filtering

(3) on the home page for IE browsing, browsing results are not recorded, as shown in Figure 5-1-7

Figure 5-1-7 first page Browse map

(4) in the home page IE browsing, click the link "network programming", the result as shown in Figure 4-3-3 of the previous chapter, shows all the learning notes of network programming.

"Wait, this is not in line with the original design idea!" Only by column display, can't show all learning notes! "There's also a problem with asp.net data delivery: data transfer between form forms in a Windows application can be implemented by defining a global variable (public static variable). However, these methods cannot be used to asp.net the various web page data. For example: When you click on the dataset navigation bar there will be a ztre_currentpage of data transmission, but can not pass MENANW data, that is, when you click on the dataset navigation bar of any hyperlink, Menan pass the data is always null, this can not only achieve the column display, At the same time, the pagination displayed under the column. Here is to take the session for parameter transfer method to solve.

(5) In order to pass the parameter variable MENANW to the session ("MENANW"), switch to the Code view, before the

Figure 5-1-8 Insert Page load default function for Index.aspx

(6) In the Server Behaviors Panel, select the dataset (Ztre), as shown in Figure 5-1-9, where the black part is the data set (ztre) definition code.

Figure 5-1-9 Data set Ztre code

(7) Find the code:

commandtext= ' <%# ' select * from ztre WHERE lmid =? ORDER by Zitime ASC "%> '

Change the code above to read:

Commandtext= ' <%# IIf ((Request). QueryString ("Menanw") <>nothing) or Request.QueryString ("Ztre_currentpage") <> Nothing), "select * from Ztre WHERE lmid =? ORDER by Zitime DESC "," select * from Ztre, zitime DESC ")%> '

(8) Find the code:

<parameter name= "@LMID" Value= ' <%# IIf (request. QueryString ("Menanw") <> Nothing), request. QueryString ("Menanw"), "" "%>" type= "Integer"/></parameters></mm:dataset>

Change the code above to read:

<parameter name= "@LMID" Value= ' <%# IIf (Session ("MENANW") <> Nothing), session ("MENANW"), "" "%>" type= " Integer "/></parameters></mm:dataset>

(9) For IE browsing, the result is shown in Figure 4-3-3 of the fourth chapter. Complete the established design ideas.

  

5.2 The implementation of the reply page

Design idea: To be able to achieve the title of the click Notes, you can link out a page, including this note and all corresponding replies. From the previous section, this is no longer difficult, and only the code parameter passes for this note on the hyperlink to the note header can be implemented.

  5.2.1 Basic Page Design

(1) New asp.net VB dynamic page hf.aspx generated by template bkblog.dwt.aspx, insert Table Ztre in mainbody editable region, and design the results as shown in Figure 5-2-1:

Figure 5-2-1 table ztre design diagram

(2) Start Access2003, set up FH table, YH table connection query Hfre, in fact, the connection view and display fields as shown in Figure 5-2-2.

Figure 5-2-2 The design of query Hfre

(3) in the section (1)-(3) of the 4.2.2 DataSet, add the DataSet Ztre, drag the field to the appropriate position, and make the dynamic text (ztre.zytext) formatting, as shown in Figure 5-2-3:

Figure 5-2-3 binding data to a table Ztre

(4) Modify the dataset Ztre to filter, filter field ztid, select URL parameter as the parameter passing way, input parameter variable is ZTANW.

(5) Add DataSet Hfre, filter field ztid, select URL parameter as the parameter passing way, input parameter variable is ZTANW, the result is as shown in Figure 5-2-4:

Graph 5-2-4 Data Set Hfre design

(6) Drag the DataSet Hfre field to the table ztre corresponding position, set dynamic text (HTRE.HFTEXT) format "encoding-html encoding format", the table Ztre 5th, 6, 7 rows, defined as a repeating region, the definition of data paging to the table Ztre, The result is as shown in Figure 5-2-5:

Figure 5-2-5 bound DataSet htre to table Ztre

(7) Open the home index.aspx, select dynamic text (ztre.ztname), create hyperlinks, link to hf.aspx, switch to Code view, change the link property to: hf.aspx?ztanw=, drag the field ztre the dataset Ztid to the equals number , the results are shown in Figure 5-2-6:

Figure 5-2-6 Adding dynamic hyperlinks to your code

(8) Save hf.aspx and Index.asps, in Access to the corresponding HF table, YH table random input a few records, in IE browser browsing Index.asps, point out the reply to the topic of learning notes, as shown in Figure 5-2-7:

Figure 5-2-7 Reply page display

(9) Click any hyperlink in the dataset navigation, and the result is as shown in Figure 5-2-8:

Figure 5-2-8 Click the data set to navigate the page results

Ah! It's all gone! This is the problem of data transmission between ASP.net web pages. It has to be changed as in section 5.1.

(10) Switch to Code view, before

Figure 5-2-9 Insert Page load default function for Hf.aspx

(11) Locate the code in the dataset Ztre:

<parameter name= "@ZTID" Value= ' <%# IIf (request. QueryString ("Ztanw") <> Nothing), request. QueryString ("Ztanw"), "" "%>" type= "Integer"/>

Put the above code in the request. QueryString ("Ztanw") instead of Session ("ZTANW"), the resulting code is modified to

<parameter name= "@ZTID" Value= ' <%# IIf (Session ("ZTANW") <> Nothing), session ("ZTANW"), "" "%> ' type= ' in Teger "/>

(12) Locate the code in the dataset Hfre:

<parameter name= "@ZTID" Value= ' <%# IIf (request. QueryString ("Ztanw") <> Nothing), request. QueryString ("Ztanw"), "" "%>" type= "Integer"/>

Put the above code in the request. QueryString ("Ztanw") instead of Session ("ZTANW"), the resulting code is modified to

<parameter name= "@ZTID" Value= ' <%# IIf (Session ("ZTANW") <> Nothing), session ("ZTANW"), "" "%> ' type= ' in Teger "/>

(13) Save hf.aspx.

  



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.