untitled

Similar documents
untitled

untitled

untitled

IsPostBack 2

untitled

untitled

1

個人教室 / 網路硬碟

untitled

untitled

untitled

untitled

untitled

臺灣地區的警察教育現況與展望

untitled

了 立 連 立 量 領 來 例 蘭 便 不 數 不 論 更 更 更 力 更 參 例 來 例 見 量 度 量 量 參 論 量 行 量 量 瑩 理 來 錄 量 量 不 力 省 力 立 力 量 量 量 了 量 便 錄 錄 錄 料 說 省 6

untitled

untitled

untitled

untitled

untitled

untitled

untitled

untitled

隱形眼鏡的世界

龍華科技大學

untitled

untitled

Slide 1

人身保險業務員資格測驗方案

第五章 實例個案

untitled

untitled

untitled

4-04 論文封面(樣式)

untitled

untitled

九十三年第三期檔案管理工作研習營學員建議事項答覆情形彙整表

地方公共服務績效比較評量之探討—標竿學習策略的觀點

untitled

untitled

untitled

血管內裝置感染管制作業規範

大陸黨報集團化發展之研究

untitled

廉 樂 不 廉 倫 理 廉 倫 理 領 不 參 領 不 若 不 不 不 不 利 聯 行 李 聯 例 律

untitled

untitled

untitled

untitled

國立中山大學學位論文典藏.PDF

untitled

untitled

untitled

untitled

十四、特殊需求的嬰兒

嘉義市都市計畫保護區農業區土地使用審查要點(草案)

台南縣全民學區數位學習課程進階班—PhotoImpact 10

untitled

untitled

untitled

PowerPoint 簡報

中華人民共和國殘疾人保障法(2008年修訂)

untitled

untitled

untitled

untitled

untitled

untitled

1209 th New Territories East Group Scout Troop 讀 練 理論 參 立臨 立 療 行 理 量 理 料 留 度 練 理 理 理 冷 練 理 力 理 不 不

untitled

國立故宮博物院九十三年提升服務品質績效報告

untitled

untitled

untitled

中華民國第45屆中小學科學展覽會

untitled

untitled

untitled

untitled

九十四年度提升服務品質績效報告

untitled

untitled

吃寒天真的能減肥嗎

untitled

untitled

untitled

2011台灣高中職專題暨小論文競賽

四湖鄉志纂修

untitled

壹、世界音樂導聆與文化探索

untitled

1-2岁宝宝的游戏和活动指南

untitled

STANDARD

untitled

untitled

untitled

第三章 我國非營業特種基金制度及運作現況

I/O Files讀寫檔案:

Transcription:

1

.NET

利 [] [] 來 說 切 切 理

[] [ ] 來 說 拉 類 類

[] [ ] 列 連

Web 行流 來 了 不 不 不 流 立 行

Page 類 Load 理

Response 類 Write 料 Redirect URL Response.Write("!! ives!!"); Response.Redirect("WebForm2.aspx");

(1)

(2) Web Form

aspx

例 sample5-a1 (1) WebForm2.aspx WebForm2.aspx 列 WebForm1.aspx private void Page_Load(object sender, System.EventArgs e) { Response.Redirect("WebForm2.aspx"); }

例 sample5-a1 (2) WebForm2.aspx private void Page_Load(object sender, System.EventArgs e) { Response.Write("!! 臨!!"); }

Label Label 來 Text ForeColor Visible

Button Button Text Visible Click

MSDN Library MSDN Library 量 例 參 列 [ 說 ] [] [ 索 ] [] 來 MSDN Library 了 類 類 利 F1 http://msdn.microsoft.com/library/ http://msdn.microsoft.com/library/cht/

例 sample5-a2 列 private void submitbtn_click(object sender, system.eventargs e) { string[] fatestr = new string[5] {""," "," "," ",""}; Random rnd = new Random(); fatelb.text = fatestr[rnd.next(0,5)]; }

TextBox TextBox 料 Text ReadOnly MaxLength 度 TextMode SingleLine 行 MultiLine 行 Password TextChanged 更

練 sample5-b1 易 留 料 念 立 利 料 利 Response.Redirect 料

Session 念 連 Session ID 料 料 Server Request 都 Session ID Server ID 來索 Session

Session Session.SessionID 來識 Session ID Session.Timeout Session () Session.Clear() Session Session.Add(string name, object value) Session

Session 立 Session.Add(string name, object value) Ex.Session.Add( name, Alice ); Session[string name] Ex Label1.Text = Session[ name ].ToString();

例 sample5-a3 (1) 列 WebForm1.aspx private void loginbtn_click(object sender, System.EventArgs e) { if((idtb.text == "alice" && pwtb.text == "alice") (idtb.text == "bob" && pwtb.text == "bob")) { Session.Add("id",idTB.Text); Response.Redirect("WebForm2.aspx"); } }

例 sample5-a3 (2) WebForm2.aspx private void Page_Load(object sender, System.EventArgs e) { Response.Write(Session["id"].ToString()); Response.Write(" 臨!!"); }

列 列 WebForm2.aspx 不 若 離 Session

練 sample5-b2 列 念 WebForm1.aspx WebForm2.aspx Session ( null) 不 login.aspx Session 料

(1) 了!? Session 利

(2) Response.CacheControl = "no-cache"; 不 Page_Load

練 sample5-b3 sample5-b2 " " 念 利 Response.CacheControl = no-cache ;

錄 (1) Web (C:\Inetpub\wwwroot) 料 錄 錄 [ ] [ 理 ] [Internet Information Services]

錄 (2) Internet Information Services 料 [ ] 錄

錄 (3) [ ] 立 錄

錄 (4) 錄 錄 URL http://localhost/aspnet/

錄 (5) 錄

錄 (6)

錄 (7) 錄

立 錄 (1) 錄 錄 錄 錄 列

立 錄 (2) IIS 錄 料 []

立 錄 (3) [ 立 ] 錄 立

行 例 (1) 行 例 更 例 (.sln) (.csproj.webinfo) 錄 例 行 例 sample5-b6 D:\ 行 URL http://localhost/sample/

行 例 (2) 立 錄 sample

行 例 (3) 立 錄 錄 D:\sample5-b6

行 例 (3) 錄 錄 sample

行 例 (4) (.csproj.webinfo) Web URLPath 路

行 例 (5) (.sln) 若 例 立 不

行 例 (6) 行 例 利 例 行 行 若 不 更 例 URL IIS 立 例 URL 錄

LinkButton LinkButton 連 Button Text Visible Click

HyperLink HyperLink 來 立 連 Text ImageUrl ( ) NavigateUrl 連 Target 連 _blank _parent frameset _search _self 連 _top

例 sample5-a4 易 連 WebForm1.aspx private void Page_Load(object sender, System.EventArgs e) { yahoohl.navigateurl = "http://tw.yahoo.com"; yahoohl.target = "_blank"; }

Image Image 來 ImageUrl AlternateText

ImageButton ImageButton Button ImageUrl AlternateText Click ( 理 參數 滑 )

例 sample5-a5 (1) 利 onmouseover onmouseout WebForm1.aspx <asp:imagebutton onmouseover="this.src='carlogo.jpg' " onmouseout="this.src='cartext.jpg' "

例 sample5-a5 (2) WebForm1.aspx private void carib_click(object sender, System.Web.UI.ImageClickEventArgs e) { if(e.x<=100) textlb.text = " 來 BMW!!"; else textlb.text = " 來 BENZ!!"; }

練 sample5-b4 念 數 Label Label Visible false 數 Session

DropDownList DropDownList 拉 Items 拉 (items ListItemCollection 類 ) ( ListItem 類 ) AutoPostBack 更 SelectedIndexChanged 更 ( AutoPostBack true)

ListItemCollection 類 DropDownList items ListItemCollection 類 () 索 ex DropDownList1.Items[1] Count ListItem 數 SelectedItem SelectedIndex 索 Add (ListItem string) Clear Remove (ListItem string) RemoveAt 索 (int)

ListItem 類 ListItemCollection 類 ListItem 類 Text Value 聯 Selected

例 sample5-a6 (1) WebForm1.aspx struct star { public string name; public string country; public string imgurl; }

例 sample5-a6 (2) WebForm1.aspx star[] mystar = new star[3]; private void Page_Load(object sender, System.EventArgs e) { mystar[0].name = "S.H.E"; mystar[0].country = ""; mystar[0].imgurl = "she.jpg"; mystar[1].name = " "; mystar[1].country = ""; mystar[1].imgurl = ".jpg";

例 sample5-a6 (3) WebForm1.aspx mystar[2].name = " "; mystar[2].country = " "; mystar[2].imgurl = ".jpg"; } if(!ispostback) { foreach(star staritem in mystar) starddl.items.add(staritem.name); starddl.autopostback = true; changeinfo(); }

例 sample5-a6 (4) WebForm1.aspx private void starddl_selectedindexchanged(object sender, System.EventArgs e) { changeinfo(); } private void changeinfo() { namelb.text = mystar[starddl.selectedindex].name; countrylb.text = mystar[starddl.selectedindex].country; pictureimg.imageurl = mystar[starddl.selectedindex].imgurl; }

ListBox ListBox DropDownList Items ( ListItemCollection 類 ) SelectionMode Single Multiple ( 利 Selected true)

例 sample5-a7 (1) WebForm1.aspx private void purchasebtn_click(object sender, System.EventArgs e) { shoppinglb.items.add(itemlb.selecteditem); itemlb.items.remove(itemlb.selecteditem); shoppinglb.selectedindex = -1; totallb.text = total().tostring(); }

例 sample5-a7 (2) WebForm1.aspx private void cancelbtn_click(object sender, System.EventArgs e) { itemlb.items.add(shoppinglb.selecteditem); shoppinglb.items.remove(shoppinglb.selecteditem); itemlb.selectedindex = -1; totallb.text = total().tostring(); }

例 sample5-a7 (3) WebForm1.aspx private int total() { int sum = 0; foreach(listitem item in shoppinglb.items) { sum += int.parse(item.value); } return sum; }

練 sample5-b5 (1) 類 拉 說 神 龍 C# JAVA 料 料理 料理 料理

練 sample5-b5 (2) 念 拉 SelectedIndexChanged ListBox 拉 AutoPostBack true

CheckBox CheckBox Text TextAlign Checked CheckedChanged 狀 ( AutoPostBack true)

CheckBoxList CheckBoxList Items ( ListItemCollection 類 ) RepeatColumns 料欄 數 RepeatDirection SelectedIndexChanged 更 ( AutoPostBack true)

RadioButton RadioButton Text TextAlign Checked GroupName CheckedChanged 狀 ( AutoPostBack true)

RadioButtonList RadioButton 來 立 Items ( ListItemCollection 類 ) RepeatColumns 料欄 數 RepeatDirection SelectedIndexChanged 更 ( AutoPostBack true)

例 sample5-a8 (1) 料 WebForm1.aspx private void submitbtn_click(object sender, System.EventArgs e) { Session.Add("name",nameTB.Text); Session.Add("sex",sex1RB.Checked?"":""); Session.Add("education", educationrbl.selecteditem.text);

例 sample5-a8 (2) WebForm1.aspx string hobby = ""; foreach(listitem item in hobbycbl.items) if(item.selected) hobby+= item.text +" "; if(hobby == "") hobby = " "; Session.Add("hobby", hobby); } Response.Redirect("WebForm2.aspx");

例 sample5-a8 (3) WebForm2.aspx private void Page_Load(object sender, System.EventArgs e) { Response.Write(Session["name"].ToString()); Response.Write(Session["sex"].ToString() + "!!<br>"); Response.Write(" 歷 "+Session["education"].ToString() + "<br>"); Response.Write(" "+Session["hobby"].ToString()); }

練 sample5-b6 念 ListItem Value