




下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、ASP.NET中RadioButtonList綁定后臺數據后觸發點擊大事_ 本文實例為大家分享了RadioButtonList綁定后臺數據,觸發點擊大事的方法 首從前臺頁面放置一個RadioButtonList 控件 asp:RadioButtonList runat=server ID=RadioButtonList1 BorderStyle=None RepeatColumns=3 CssClass= RepeatLayout=Flow AutoPostBack=true OnSelectedIndexChanged=RadioButtonList1_SelectedIndexChange
2、d /asp:RadioButtonList .cs文件 后臺綁定數據 namespace BTApp public partial class Technology : System.Web.UI.Page string Id; protected void Page_Load(object sender, EventArgs e) if (!IsPostBack) AspNetPager1.PageSize = 10; if (Request.QueryStringId != null) Id = Request.QueryStringId; else Id = ; GetDataBind
3、(Id); DropDownListDataBind(); /RadioButtonList綁定后臺數據 private void DropDownListDataBind() ExpertInfoBLL bll = new ExpertInfoBLL(); DataTable dt = bll.GetDepInfo(); foreach (DataRow dr in dt.Rows) RadioButtonList1.Items.Add(drName.ToString();/循環讀出數據庫的數據 this.RadioButtonList1.DataSource = dt; this.Radi
4、oButtonList1.DataTextField = Name; this.RadioButtonList1.DataValueField = Id; this.RadioButtonList1.RepeatDirection = RepeatDirection.Horizontal; this.RadioButtonList1.DataBind(); private void GetDataBind(string Id) /這里寫解碼和數據庫返回結果 TechnologyBLL bll = new TechnologyBLL(); string strWhere = 1=1 ; if (
5、Id != Id != null) strWhere += string.Format( and a.Depinfo_Id = 0, Id); AspNetPager1.RecordCount = bll.GetCountList(strWhere); /綁定數據 DataTable dt = bll.GetList(AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize, AspNetPager1.PageSize, strWhere, CreateTime); this.Repeater1.DataSource = dt; th
6、is.Repeater1.DataBind(); protected void AspNetPager1_PageChanged(object sender, EventArgs e) GetDataBind(Id); /依據選擇單選按鈕的不同id,觸發大事 protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e) string Id; Id = RadioButtonList1.SelectedValue; GetDataBind(Id); TechnologyBLL 層的方法 names
7、pace BTAppBLL public class TechnologyBLL TechnologyDAL dal = new TechnologyDAL(); public DataTable GetList(int startPage, int pageSize, string where, string orderby) DataTable dTable = dal.GetList(startPage, pageSize, where, orderby); return dTable; public int GetCountList(string where) int record =
8、 dal.GetCountList(where); return record; public DataTable GetListShow(string TechnologyId) DataTable dTable = dal.GetModel(TechnologyId); return dTable; public DataTable GetPicture(string TechnologyId) DataTable dTable = dal.GetPicture(TechnologyId); return dTable; TechnologyDAL層的方法 namespace BTAppD
9、AL public class TechnologyDAL public DataTable GetList(int startPage, int pageSize, string where, string orderby) string strSql = string.Format(SELECT a.TechnologyId,a.TechnologyName,a.Summarize,a.Effect,a.MainPoint,a.AppropriateArea,a.Attention,a.CreateTime,a.CreatUser,a.UpdateTime,b.Name FROM Tech
10、nology AS a n + left join Sys_DepInfo AS b ON a.Depinfo_Id=b.Id n + where a.IsActive=1 and 0 , where); string proc = proc_CommonPagerWithStatement; SqlConnection con = SqlDbHelper.Connection; SqlParameter sp = new SqlParameter(intStartIndex, startPage), new SqlParameter(intPageSize, pageSize), new S
11、qlParameter(varStatement, strSql), new SqlParameter(varSortExpression, orderby+ DESC) ; DataTable dt = SqlDbHelper.GetDataSet(proc, sp, con); return dt; public int GetCountList(string where) int countRecord = 0; string strSql = string.Format(select COUNT(TechnologyId) as countRecord from(SELECT a.Te
12、chnologyId,a.TechnologyName,a.Summarize,a.Effect,a.MainPoint,a.AppropriateArea,a.Attention,a.CreateTime,a.CreatUser,a.UpdateTime,b.Name FROM Technology AS a n + left join Sys_DepInfo AS b ON a.Depinfo_Id=b.Id n + where a.IsActive=1 and 0 ) as c, where); SqlConnection con = SqlDbHelper.Connection; tr
13、y if (con.State = System.Data.ConnectionState.Closed) con.Open(); DataTable dt = SqlDbHelper.GetDataTable(strSql); if (dt.Rows.Count 0) countRecord = int.Parse(dt.Rows0countRecord.ToString(); catch (Exception) throw; finally if (con.State = ConnectionState.Open) con.Close(); return countRecord; publ
14、ic DataTable GetModel(string TechnologyId) string strSql = string.Format(SELECT a.TechnologyId,a.TechnologyName,a.Summarize,a.Effect,a.MainPoint,a.AppropriateArea,a.Attention,a.CreateTime,a.CreatUser,a.UpdateTime,b.Name FROM Technology AS a n + left join Sys_DepInfo AS b ON a.Depinfo_Id=b.Id n + whe
15、re a.IsActive=1 and a.TechnologyId = 0 , TechnologyId); DataTable dataTable = SqlDbHelper.GetDataTable(strSql); return dataTable; public DataTable GetPicture(string TechnologyId) string strSql = string.Format(SELECT TOP 5 a.Files_Id,a.Files_Name,a.Files_Path FROM dbo.Com_Files AS a n + LEFT JOIN dbo
16、.Technology AS b ON a.ForeignKey_Id=b.TechnologyId n + WHERE b.IsActive=1 and a.ForeignKey_Id = 0 , TechnologyId); DataTable dataTable = SqlDbHelper.GetDataTable(strSql); return dataTable; ExpertInfoBLL 層的方法 public DataTable GetDepInfo() DataTable dTable = dal.GetDepInfo(); return dTable; ExpertInfoDAL層的方法 public DataTable GetDepInfo() try StringBuilder str = new StringBuilder(SELECT Id,Name FROM dbo.Sys_DepInfo WHERE Is_Active=1 AND DepinfoType=1); DataTable data = SqlDbHelper.GetDataTable(str.ToString(); if (data.Rows.Count 0) return data; else return null; catch (Exception) return null;
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 自動控制系統【直流】課設指導書-野瑩瑩要點
- 設備費用核算管理
- 財務會計綜合考試試卷 (一)
- 2024年中考押題預測卷02(武漢卷)-道德與法治(考試版)A3
- 2024-2025學年下學期高一生物滬科版期末必刷常考題之有性生殖中的遺傳信息傳遞
- 建筑施工特種作業-高處作業吊籃安裝拆卸工真題庫-1
- 山東社區招聘題目及答案
- 剖切面的種類與剖切方法2
- 2023-2024學年山東省青島市膠州市高二下學期期末學業水平檢測數學試題(解析版)
- 2023-2024學年湖北省新高考聯考協作體高二下學期7月期末考試數學試題(解析版)
- 消費者態度的形成與改變
- 大學生人際交往調查報告課件
- 湖南省長沙市望城區2020-2021學年八年級下學期期末考試歷史試卷
- 教學質量檢測質量分析表
- 10kv線路巡視檢查表
- 施工單通用范本
- 六合散-春腳集卷二-方劑加減變化匯總
- 慶陽市北部城區控制性詳細規劃—說明書
- 趣味英語(課堂PPT)
- 五年級語文下學期課文內容填空專項習題含答案
- 食品質量安全溯源系統技術方案
評論
0/150
提交評論