實驗三_運用服務(wù)器控件完成頁面設(shè)計_()_第1頁
實驗三_運用服務(wù)器控件完成頁面設(shè)計_()_第2頁
實驗三_運用服務(wù)器控件完成頁面設(shè)計_()_第3頁
實驗三_運用服務(wù)器控件完成頁面設(shè)計_()_第4頁
實驗三_運用服務(wù)器控件完成頁面設(shè)計_()_第5頁
已閱讀5頁,還剩9頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、實驗報告課程名稱Web程序設(shè)計實驗名稱實驗三、運用服務(wù)器控件完成頁面設(shè)計日期2014.3.24學(xué)生學(xué)號姓名班級實驗?zāi)康模菏煜こR姺?wù)器控件的使用方法,理解服務(wù)器控件的概念。實驗條件: 電腦一臺、能上網(wǎng)查閱資料。實驗內(nèi)容與步驟:1新建名字為“ServerControlExperiment”網(wǎng)站,在此網(wǎng)站中創(chuàng)建實現(xiàn)以下功能的網(wǎng)頁。2在default.aspx頁面中,添加1個TextBox控件、2個Button控件、一個ListBox控件,如圖3-1所示。將2個Button控件的Text屬性分別改為“增加”和“刪除”。當(dāng)單擊【增加】按鈕時,將TextBox文本框中的輸入值添加到ListBox中,但單

2、擊【刪除】按鈕時,刪除ListBox中當(dāng)前選定項。圖3-13添加一個網(wǎng)頁,要求將Label控件、LinkButton控件、HyperLink控件放在Panel控件中,當(dāng)單擊一組Button按鈕時改變Panel控件的背景色,單擊另一組Button控件時改變Panel控件中文字的大小。單擊LinkButton和HyperLink控件時分別導(dǎo)航到新的網(wǎng)頁或網(wǎng)站。單擊RadioButton控件時隱藏Panel控件,單擊另一個RadioButton控件時顯示Panel控件。如圖3-2所示。圖3-24添加一個網(wǎng)頁,在MultiView控件添加3個View控件,在每個View控件中各添加Image控件,再添

3、加3個RadioButton控件切換各個View視圖,每個View視圖顯示不同的圖像。5添加一個網(wǎng)頁,在頁面中添加AdRotator控件,鏈接XML廣告數(shù)據(jù)源,實現(xiàn)廣告圖像顯示,當(dāng)單擊廣告圖像時導(dǎo)航到相應(yīng)的網(wǎng)頁。6添加一個網(wǎng)頁,在頁面中添加CheckBoxList控件,單擊Button按鈕時將CheckBoxList的選項寫到ListBox中。7添加一個網(wǎng)頁,在頁面中添加RadioButtonList控件,單擊Button按鈕時將CheckBoxList的選項寫到ListBox中。8添加一個網(wǎng)頁,選擇DropDownList控件的選項時導(dǎo)航到相應(yīng)的網(wǎng)站。9添加一個網(wǎng)頁,在頁面中添加AdRota

4、tor控件,鏈接XML廣告數(shù)據(jù)源,實現(xiàn)廣告圖像顯示,當(dāng)單擊廣告圖像時導(dǎo)航到相應(yīng)的網(wǎng)頁。10添加一個網(wǎng)頁,在頁面中添加CheckBoxList控件,單擊Button按鈕時將CheckBoxList的選項寫到ListBox中。11添加一個網(wǎng)頁,在頁面中添加RadioButtonList控件,單擊Button按鈕時將CheckBoxList的選項寫到ListBox中。12添加一個網(wǎng)頁,選擇DropDownList控件的選項時導(dǎo)航到相應(yīng)的網(wǎng)站。13添加一個網(wǎng)頁,在頁面中添加TextBox、RequiredFieldValidator和CompareValidator控件,實現(xiàn)CompareValida

5、tor控件的Operator行為的Equal、GreaterThan等屬性值的驗證。源代碼題目1:結(jié)果如圖所示圖1題目2:結(jié)果如圖:圖2主要代碼如下:public partial class _Default : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) protected void addbtn_Click(object sender, EventArgs e) string input = inputtxt.Text; ListBox1.Items.Add(input); protecte

6、d void delbtn_Click(object sender, EventArgs e) ListBox1.Items.Remove(ListBox1.SelectedValue); 題目3:圖3主要代碼如下: protected void Page_Load(object sender, EventArgs e) this.Panel1.Visible = true; protected void yelbtn_Click(object sender, EventArgs e) this.Panel1.ForeColor = System.Drawing.Color.Yellow; p

7、rotected void Button3_Click(object sender, EventArgs e) this.Panel1.ForeColor = System.Drawing.Color.Red; protected void blubtn_Click(object sender, EventArgs e) this.Panel1.ForeColor = System.Drawing.Color.Blue; protected void whibtn_Click(object sender, EventArgs e) this.Panel1.ForeColor = System.

8、Drawing.Color.White; protected void bigbtn_Click(object sender, EventArgs e) Panel1.Font.Size = 100; protected void modbtn_Click(object sender, EventArgs e) Panel1.Font.Size = 50; protected void smabtn_Click(object sender, EventArgs e) Panel1.Font.Size = 20; protected void hidradiobtn_CheckedChanged

9、(object sender, EventArgs e) this.Panel1.Visible = false; protected void showradiobtn_CheckedChanged(object sender, EventArgs e) this.Panel1.Visible = true; 題目4:圖4主要代碼如下:public partial class _4_Default : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) this.MultiView1.ActiveVi

10、ewIndex = 2; /if(RadioButton.Checked) protected void RadioButton1_CheckedChanged(object sender, EventArgs e) this.MultiView1.ActiveViewIndex = 0; protected void RadioButton2_CheckedChanged(object sender, EventArgs e) this.MultiView1.ActiveViewIndex = 1; protected void RadioButton3_CheckedChanged(obj

11、ect sender, EventArgs e) this.MultiView1.ActiveViewIndex = 2; 題目5:結(jié)果如圖:圖5.1主要代碼如下: /ServerControlExperiment/5/5.jpg Ad for baidu, Ltd. Web site 100 /ServerControlExperiment/5/1.jpg Ad for Google Web site 50 題目6:結(jié)果如圖:主要代碼如下:public partial class ServerControlExperiment_6_Default : System.Web.UI.Page p

12、rotected void Page_Load(object sender, EventArgs e) protected void decbtn_Click(object sender, EventArgs e) ListBox1.Items.Clear(); /for (int i = 0; i CheckBoxList1.Items.Count; i+) / / if (CheckBoxList1.SelectedItem.= i) ListBox1.Items.Add(CheckBoxList1.SelectedValue); / 題目7:結(jié)果如圖:主要代碼如下:public part

13、ial class ServerControlExperiment_7_Default : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) protected void decbtn_Click(object sender, EventArgs e) ListBox1.Items.Clear(); ListBox1.Items.Add(RadioButtonList1.SelectedValue); 題目8:結(jié)果如圖:主要代碼如下:public partial class ServerControl

14、Experiment_8_Default : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) switch (DropDownList1.SelectedIndex) case 1: Response.Redirect(); break; case 2: Response.Redirect(); break; case 3: Response.R

15、edirect(); break; case 4: Response.Redirect(); break; 題目9:主要代碼如下:public partial class ServerControlExperiment_9_Default : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) Label4.Text = ; protected void Button1_Click(object sender, EventArgs e) if (Page.IsValid) Label4.Text = 你

16、?的?預(yù)定已?處鋦理?; Label4.ForeColor = System.Drawing.Color.Red; 相關(guān)屬性設(shè)置如下:                 *                                                        

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論