




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、實訓七 產品小類治理實訓目的:實訓內容:實訓過程:界面制作(smallClass.aspx頁面)該頁面全部靜態(tài)代碼如下: 無標題頁 小類名稱: 所屬大類: 小類編號: asp:Label ID=Label1 runat=server Text= asp:HiddenField ID=HiddenField2 runat=server Value= / asp:HiddenField ID=HiddenField1 runat=server Value= / asp:Label ID=Label1 runat=server Text= asp:HiddenField ID=HiddenField
2、2 runat=server Value= / 動態(tài)代碼編寫(smallclass.aspx.cx)using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.W
3、ebControls.WebParts;using System.Xml.Linq;public partial class bigClass : System.Web.UI.Page public DBfunction db = new DBfunction(); protected void Page_Load(object sender, EventArgs e) db.isLogin(); if (!IsPostBack) binddata(); db.initDropDownList(DropDownList1, select * from bigclass, bigName, bi
4、gID, null); void binddata() GridView1.DataSource = db.getDataView(select * from smallClass); GridView1.DataBind(); protected void Button1_Click(object sender, EventArgs e) if (Sessionquanxian != null & Sessionquanxian.ToString() != 0) ScriptManager.RegisterStartupScript(this, GetType(), , alert(對不起,
5、您的權限不夠!), true); return; else if (TextBox1.Text.Trim().Length 0 & TextBox2.Text.Trim().Length 0) if (!db.isExist(select * from smallClass where smallID= + TextBox2.Text.Trim() + and smallName= + TextBox1.Text.Trim() + and bigid= + DropDownList1.SelectedValue.ToString()+) db.sqlExecute(insert into sm
6、allClass(smallName,smallID,bigID) values( + TextBox1.Text.Trim() + , + TextBox2.Text.Trim() + , + DropDownList1.SelectedValue.ToString() + ); binddata(); else ScriptManager.RegisterStartupScript(this, GetType(), , alert(小類編號或小類名稱不能相同!), true); else ScriptManager.RegisterStartupScript(this, GetType()
7、, , alert(小類名稱和小類編號不能為空), true); protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) TextBox tbsmallName, tbsmallID; DropDownList drpBigClass; string sqlcheck=,sqlupdate=; tbsmallID = (TextBox)GridView1.Rowse.RowIndex.Cells2.Controls0; tbsmallName = (TextBox)GridView1.Rows
8、e.RowIndex.Cells1.Controls0; drpBigClass = (DropDownList)GridView1.Rowse.RowIndex.Cells0.FindControl(DropDownList2); if (tbsmallName.Text.Trim().Length 0 & tbsmallID.Text.Trim().Length 0) sqlcheck=select * from (select * from smallclass where id + GridView1.DataKeyse.RowIndex.Value + ) as t1 where s
9、mallid=+ tbsmallID.Text.Trim()+ or smallname=+tbsmallName.Text.Trim()+; if (!db.isExist(sqlcheck) db.sqlExecute(update smallClass set smallName= + tbsmallName.Text.Trim() + ,smallID= + tbsmallID.Text.Trim() + ,bigID= + drpBigClass.SelectedValue.ToString() + where id= + GridView1.DataKeyse.RowIndex.V
10、alue); GridView1.EditIndex = -1; binddata(); else ScriptManager.RegisterStartupScript(this, GetType(), , alert(小類編號或小類名稱不能相同), true); /GridView1.EditIndex = -1; / binddata(); return; else ScriptManager.RegisterStartupScript(this, GetType(), , alert(小類名稱和小類編號不能為空), true); protected void GridView1_Row
11、Editing(object sender, GridViewEditEventArgs e) if (Sessionquanxian != null & Sessionquanxian.ToString() != 0) ScriptManager.RegisterStartupScript(this, GetType(), , alert(對不起,您的權限不夠!), true); return; else GridView1.EditIndex = e.NewEditIndex; binddata(); protected void GridView1_RowDeleting1(object
12、 sender, GridViewDeleteEventArgs e) if (Sessionquanxian != null & Sessionquanxian.ToString() != 0) ScriptManager.RegisterStartupScript(this, GetType(), , alert(對不起,您的權限不夠!), true); return; else db.sqlExecute(delete from smallClass where id= + GridView1.DataKeyse.RowIndex.Value); binddata(); protecte
13、d void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) GridView1.EditIndex = -1; binddata(); protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) DataRow dr; Label Lb; DropDownList ddl; HiddenField hf; if (e.Row.RowType = DataControlRowType.DataRow) e
14、.Row.Attributes.Add(onmouseover, bg=this.style.backgroundColor; this.style.backgroundColor=#dddddd); e.Row.Attributes.Add(onmouseout, this.style.backgroundColor=bg); if (e.Row.RowState = DataControlRowState.Alternate | e.Row.RowState = DataControlRowState.Normal) Lb = (Label)e.Row.Cells0.FindControl(Label1); hf = (HiddenField)e.Row.Cells0.FindControl(HiddenField2); dr = db.getDataRow(select * from bigClass where bigid= + hf.Value.ToString() + ); Lb.Text = drbigname.ToString(); if (e.Row.RowState = DataControlRowState.Edit | e.Row.RowState = (DataControlRowState.Alternate
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二年級數學下冊教案-7 角的初步認識(46)-蘇教版
- Unit 5 Section B 3a - selfcheck 教學設計 2024-2025學年人教版八年級英語下冊
- 3-復式統(tǒng)計表-人教版三年級數學下冊單元測試卷(含答案)
- 2024年折射儀項目資金籌措計劃書代可行性研究報告
- 2025年安全員C證(專職安全員)考試題庫
- 2024年包裝檢測儀器項目投資申請報告代可行性研究報告
- 2025年甘肅衛(wèi)生職業(yè)學院單招職業(yè)適應性測試題庫匯編
- 2025年度教育行業(yè)資金監(jiān)管賬戶委托管理合同
- 2025年度城市綠地經營權轉讓及生態(tài)維護合同
- 2025年度員工住宿安全與設施改造協議
- 太陽能光電轉換西安交通大學PP課件
- 新生兒肺透明膜病的影像與臨床探討
- 動力觸探檢測報告超重型圓錐動力觸探試驗
- 職業(yè)素養(yǎng)的內容(含事例)課件
- 工藝美術專業(yè)-工藝品設計課程標準
- 環(huán)衛(wèi)市場化運營方案PPT
- 二年級下冊綜合實踐活動說課稿-我是清潔小衛(wèi)士 全國通用
- 教師師德考核表
- 人教版(2023)必修三 Unit 3 Diverse Cultures 單元整體教學設計(表格式)
- 兩人合伙開旅行社合同范本
- 小學生漫畫獨立學習力(全3冊)
評論
0/150
提交評論