protected void Bind() { string id = QueryString.GetId; DropDownList1.DataSource = da.GetDv("select id,cn_name,en_name from tm_path where myParent=0 and id in(select distinct myParent from tm_path where id in(-1" + Session["AdminPurview"].ToString() + "-1)) order by sequence "); DropDownList1.DataTextField = "cn_name"; DropDownList1.DataValueField = "id"; DropDownList1.DataBind(); if (id == null) { id = DropDownList1.SelectedValue; } else { DropDownList1.Items.FindByValue(id).Selected = true; } DataSet ds = new DataSet(); ds = da.GetDs("select id,cn_name,en_name,backchar,realID,ntype,zlevel,sequence from tm_path where barID=" + id + " and (id in (-1" + Session["AdminPurview"].ToString() + "-1) or myParent in (-1" + Session["AdminPurview"].ToString() + "-1)) order by sequence "); DataList1.DataSource = ds; DataList1.DataBind(); leiType.Text = DropDownList1.SelectedItem.Text; }
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e) { if (Convert.ToString(Session["vote"]) != string.Empty) { Response.Write(bc.MessageBox("每人只有一次投票机会,谢谢!!")); //Response.Write("<script>history.go(-1)</script>"); return; } else { int voteQty = 0; int str = (int)DataList1.DataKeys[e.Item.ItemIndex]; //检索 原有票 +1 DataSet ds = bc.GetDataSet("select * from tb_vote where id='" + str + "'", "vote"); DataRow[] row = ds.Tables[0].Select(); foreach (DataRow rs in row) //将检索到的数据逐一,循环添加到Listbox1中 { voteQty = Convert.ToInt16(rs["voteQty"]); } voteQty = voteQty + 1; //更新投票 bool bl; bl = bc.ExecSQL("update tb_vote set voteQty='" + voteQty + "' where id='" + str + "'"); if (bl) { Response.Write(bc.MessageBox("投票成功!")); } DataList1.DataSource = bc.GetDataSet("select * from tb_vote", "vote"); DataList1.DataKeyField = "id"; DataList1.DataBind(); //标记本浏览器已经投过票 Session["vote"] = "vote"; } }
protected void BindData() { try { var strConn = System.Configuration.ConfigurationManager.ConnectionStrings["JUIZO"].ConnectionString; SqlConnection sqlcon = null; sqlcon = new SqlConnection(strConn); sqlcon.Open(); DataSet tbl = new DataSet(); SqlCommand cmd = new SqlCommand("Select * from Juizofinal_jazigo where ID_cliente = @ID_cliente order by Nivel_parentesco asc", sqlcon); cmd.Parameters.AddWithValue("@ID_cliente", Usuario); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(tbl); DataList1.DataSource = tbl.Tables[0]; DataList1.DataBind(); } catch (Exception) { //throw; } }
protected void loadPIDetails() { DataSet ds = BLL_TMSA_PI.Get_KPI_Detail(UDFLib.ConvertIntegerToNull(hdnKPIID.Value)); DataTable dt = new DataTable(); DataTable dtPIDtl = ds.Tables[1]; dt.Columns.Add(new DataColumn("sno", typeof(int))); dt.Columns.Add(new DataColumn("PID", typeof(string))); dt.Columns.Add(new DataColumn("value", typeof(string))); dt.Columns.Add(new DataColumn("PIName", typeof(string))); string exp = ""; foreach (DataRow row in dtPIDtl.Rows) { dt.Rows.Add(new object[] { Convert.ToInt32(row["SerialNumber"].ToString()), row["PI_ID"].ToString(), row["value"].ToString(), row["Name"].ToString() }); exp = exp + row["value"].ToString(); } lblFormula.Text = "KPI Formula : " + exp; DataTable dt_PI = dt; dt_PI.DefaultView.RowFilter = "PID <> ''"; DataList1.DataSource = dt_PI.DefaultView; DataList1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { id = Request.QueryString["Kategoriid"]; islem = Request.QueryString["islem"]; SqlCommand komut = new SqlCommand("Select * from Tbl_Kategoriler", bgl.baglanti()); SqlDataReader oku = komut.ExecuteReader(); DataList1.DataSource = oku; DataList1.DataBind(); Panel2.Visible = false; Panel4.Visible = false; if (islem == "silme") { if (IsPostBack == false) { SqlCommand kmtsil = new SqlCommand("Delete from Tbl_Kategoriler where Kategoriid=@k1", bgl.baglanti()); kmtsil.Parameters.AddWithValue("@k1", id); kmtsil.ExecuteNonQuery(); bgl.baglanti().Close(); } } }
private void getTInfoList() { try { DataSet ds = new DataSet(); AirTicketWeb.BLL.TInfo GetTInfo = new AirTicketWeb.BLL.TInfo(); ds = GetTInfo.GetAllList(); PagedDataSource objPds = new PagedDataSource(); objPds.DataSource = ds.Tables[0].DefaultView; objPds.AllowPaging = true; objPds.PageSize = 12; int CurPage; if (Request.QueryString["Page"] != null) { CurPage = Convert.ToInt32(Request.QueryString["Page"]); } else { CurPage = 1; } objPds.CurrentPageIndex = CurPage - 1; lblCurrentPage.Text = CurPage.ToString(); lblSumPage.Text = objPds.PageCount.ToString(); DataList1.DataSource = objPds; DataList1.DataBind(); } catch { } }
protected void BtnSearchItem_Click(object sender, EventArgs e) { try { SqlConnection MyCon = new SqlConnection(conString); MyCon.Open(); SqlCommand MyCmd = new SqlCommand(); MyCmd.Connection = MyCon; MyCmd.CommandText = "select * from View_Category_Item where ItemCode like N'%" + TxtSearchItem.Text + "%' or ItemName like N'%" + TxtSearchItem.Text + "%' or ProductNameEng like N'%" + TxtSearchItem.Text + "%' or ItemGroupName like N'%" + TxtSearchItem.Text + "%'"; SqlDataAdapter MyAdapter = new SqlDataAdapter(MyCmd); DataSet MyDateSet = new DataSet(); MyAdapter.Fill(MyDateSet, "Category_Item"); DataList1.DataSource = MyDateSet.Tables["Category_Item"]; DataList1.DataBind(); MyCon.Close(); } catch (Exception ex) { LblMessage.Text = ex.Message.ToString(); } }
private void SearchState() { using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand()) { string sql = "SELECT * FROM StateData"; if (!string.IsNullOrEmpty(searchfield.Text.Trim())) { sql += " WHERE SName LIKE @SName + '%'"; cmd.Parameters.AddWithValue("@SName", searchfield.Text.Trim()); } cmd.CommandText = sql; cmd.Connection = con; using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) { DataTable dt = new DataTable(); sda.Fill(dt); DataList1.DataSource = dt; DataList1.DataBind(); } } } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { Panel2.Visible = false; Panel4.Visible = false; id = Request.QueryString["Yemekid"]; islem = Request.QueryString["islem"]; //Kategori Listesi SqlCommand komut2 = new SqlCommand("Select * From Tbl_Kategoriler", conn.baglanti()); SqlDataReader dr2 = komut2.ExecuteReader(); DropDownList1.DataTextField = "KategoriAd"; DropDownList1.DataValueField = "Kategoriid"; DropDownList1.DataSource = dr2; DropDownList1.DataBind(); } //Yemek Listesi SqlCommand komut = new SqlCommand("Select * From Tbl_Yemekler", conn.baglanti()); SqlDataReader dr = komut.ExecuteReader(); DataList1.DataSource = dr; DataList1.DataBind(); if (islem == "sil") { SqlCommand komut2 = new SqlCommand("Delete From Tbl_Yemekler where Yemekid=@p1", conn.baglanti()); komut2.Parameters.AddWithValue("@p1", id); komut2.ExecuteNonQuery(); conn.baglanti().Close(); } }
protected void Button1_Click(object sender, EventArgs e) { if (DropDownList3.Text == "Tümü") { string sorgu1 = "Select * From Araba "; SqlCommand cmd1 = new SqlCommand(sorgu1, cnn); cnn.Open(); SqlDataReader dr1 = cmd1.ExecuteReader(); DataList1.DataSource = dr1; DataList1.DataBind(); cnn.Close(); } if (DropDownList3.Text != "Tümü") { string sorgu = "Select * From Araba Where Yakıt= '" + DropDownList2.Text + "'"; SqlCommand cmd = new SqlCommand(sorgu, cnn); cnn.Open(); SqlDataReader dr = cmd.ExecuteReader(); DataList1.DataSource = dr; DataList1.DataBind(); cnn.Close(); } if (DropDownList2.Text != "Tümü") { string sorgu = "Select * From Araba Where VitesTürü= '" + DropDownList3.Text + "'"; SqlCommand cmd = new SqlCommand(sorgu, cnn); cnn.Open(); SqlDataReader dr = cmd.ExecuteReader(); DataList1.DataSource = dr; DataList1.DataBind(); cnn.Close(); } }
protected void Button1_Click(object sender, EventArgs e) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(txtFieldValue.Text); XmlNodeList nodeList = xmlDoc.SelectNodes("/FieldValue/Item"); warring.Text = ""; if (nodeList.Count > 0) { //先清除舊的,再新增 foreach (XmlNode nd in nodeList) { xmlDoc.SelectSingleNode("/FieldValue").RemoveChild(xmlDoc.SelectSingleNode("/FieldValue/Item")); } } allClear.Enabled = false; nowvbeln.Value = ""; txtFieldValue.Text = xmlDoc.OuterXml; DataList1.DataSource = BindGrid2(); DataList1.DataBind(); GVGetData1(); }
public void LoadData() { DataTable dt; DataSet ds; SqlDataAdapter sqlDa; int sobantintrongtrang = 9; dt = cls.LoadDuLieuPKN("select * from tbProduct"); lbTongsobantin.Text = dt.Rows.Count.ToString(); int sotrang = dt.Rows.Count % sobantintrongtrang == 0 ? dt.Rows.Count / sobantintrongtrang : dt.Rows.Count / sobantintrongtrang + 1; lbSobantintrongtrang.Text = Convert.ToString(sotrang); int bantin = int.Parse(lbBanTin.Text); if (bantin <= sotrang) { ds = cls.GetDataSet(); sqlDa = cls.GetDataAdapter(); sqlDa.Fill(ds, (bantin - 1) * sobantintrongtrang, sobantintrongtrang, "tb"); DataList1.DataSource = ds.Tables["tb"]; DataList1.DataBind(); } if (bantin == sotrang) { lkbNext.Enabled = false; } if (bantin == 1) { lkbPreview.Enabled = false; lkbNext.Enabled = true; } else { lkbPreview.Enabled = true; } }
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e) { long lngEmpNo = Convert.ToInt64(((Label)e.Item.FindControl("lblemp_id")).Text); switch (strdlstchk) { case "Accept": try { string strQry = "Update leave_request set leave_req_status='Accept' where [leave_req_id]=" + lngEmpNo.ToString(); if (objPayroll.updatedata(strQry) > 0) { sdsLeaveList.DataBind(); DataList1.DataBind(); //Response.Redirect("Admin_Loan_Detail.aspx"); } } catch { } break; case "Reject": try { string strQry = "Update leave_request set leave_req_status='Reject' where [leave_req_id]=" + lngEmpNo.ToString(); if (objPayroll.updatedata(strQry) > 0) { sdsLeaveList.DataBind(); DataList1.DataBind(); } } catch { } break; } }
protected void Page_Load(object sender, EventArgs e) { DataTable Table = new DataTable();//created an instance Table.Columns.Add("FirstName :"); Table.Columns.Add("LastName :"); Table.Columns.Add("Designation :"); Table.Columns.Add("Location :"); Table.Columns.Add("Country :"); Table.Rows.Add("Shaik", "Firdos", "TechnicalLead", "Hyderabad", " India"); Table.Rows.Add("Bandaru", "Bharagavi", "HR", "Chennai", " India"); Table.Rows.Add("Syed", "Nayima", "IT Head", "Mumbai", " India"); Table.Rows.Add("Sarvasiddi", "Ramya", "Manager", "kolkata", " India"); Table.Rows.Add("Moka", "Sailakshmi", "Sales", "Vizag", " India"); Table.Rows.Add("Damini", "Priya", "ExecutiveOfficer", "Hyderabad", " India"); Table.Rows.Add("Bandaru", "Vamsi", "OperatingOfficer", "Karanataka", " India"); Table.Rows.Add("Priya", "Chowday", "FinancialOfficer", "Bangalore", " India"); Table.Rows.Add("Sudanshu", "Sharma", "MarketingOfficer", "Noida", " India"); Table.Rows.Add("Rahul", "Sharma", "CEO", "Chennai", " India"); DataList1.DataSource = Table; DataList1.DataBind(); }
private void BindGrid() { string country = rblCountries.SelectedItem.Value; string sql = "SELECT * FROM stock WHERE Category=@Category OR @Category = ''"; string constr = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand cmd = new SqlCommand(sql)) { cmd.Parameters.AddWithValue("@Category", country); cmd.Connection = con; using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) { using (DataTable dt = new DataTable()) { sda.Fill(dt); DataList1.DataSource = dt; DataList1.DataBind(); } } } } }
protected void Button2_Click(object sender, EventArgs e) { var ite = from b in db.tbl_BlockedBooks select b.BookId; var item = from b in db.tbl_Books join c in db.tbl_Categories on b.CategoryID equals c.CategoryId where !ite.Contains(b.BookId) && b.BookTitle.Contains(@TextBox2.Text) && b.Author.Contains(@TextBox3.Text) && b.CategoryID == int.Parse(DropDownList1.SelectedValue.ToString()) select new { b.BookId, b.BookTitle, b.Author, desc = b.BookDesc.Substring(0, 46) + "...", b.Year, b.Publisher, b.ImagePath, c.CategoryName, b.CategoryID }; DataList1.DataSource = item; DataList1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { //实例化一个连接字符串类 SqlConnection sqlCon; //连接字符串 string strCon = "Data Source=.\\SQLEXPRESS;AttachDbFilename=E:\\C#资料\\ASP.NET\\[ASP.NET从入门到精通].MR\\SL\\10\\DATABASE\\DB_STUDENT.MDF;Integrated Security=True;Connect Timeout=30;User Instance=True"; sqlCon = new SqlConnection(strCon); //定义SQL语句 string SqlStr = "select * from tb_StuInfo"; //实例化一个适配器对象 SqlDataAdapter da = new SqlDataAdapter(SqlStr, sqlCon); //实例化一个数据集 DataSet ds = new DataSet(); //填充数据集 da.Fill(ds, "tb_StuInfo"); DataList1.DataSource = ds;//设置数据源,用于填充控件中的项的值列表 DataList1.DataBind(); }
private void FindNodesByString() { try { SqlConnection MyCon = new SqlConnection(conString); MyCon.Open(); SqlCommand MyCmd = new SqlCommand(); MyCmd.Connection = MyCon; MyCmd.CommandText = "select * from View_Item_Display where IsDisplayed='0' and IsOffer='1' "; SqlDataAdapter MyAdapter = new SqlDataAdapter(MyCmd); DataSet MyDateSet = new DataSet(); MyAdapter.Fill(MyDateSet, "Category_Item"); DataList1.DataSource = MyDateSet.Tables["Category_Item"]; DataList1.DataBind(); MyCon.Close(); } catch (Exception ex) { LblMessage.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { id = Request.QueryString["KategoryId"]; islem = Request.QueryString["islem"]; } SqlCommand komut = new SqlCommand("Select * From Tbl_Kategoriler", bgl.Baglanti()); SqlDataReader dr = komut.ExecuteReader(); DataList1.DataSource = dr; DataList1.DataBind(); //Silme şlemi if (islem == "sil") { SqlCommand komutsil = new SqlCommand("Delete * From Tbl_Kategoriler where KategoryId=@p1", bgl.Baglanti()); komutsil.Parameters.AddWithValue("@p1", id); komutsil.ExecuteNonQuery(); bgl.Baglanti().Close(); } Panel2.Visible = false; Panel4.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = 1; DataTable dt = new DataTable(); dt = bus.Show8AProduct(id); DataTable dt2 = new DataTable(); DataTable dt3 = new DataTable(); dt2 = bus.Show8AProduct(2); dt3 = bus.Show8AProduct(3); DataList1.DataSource = dt; DataList1.DataBind(); DataList2.DataSource = dt2; DataList2.DataBind(); DataList3.DataSource = dt3; DataList3.DataBind(); DataTable dt4 = new DataTable(); dt4 = bus.Show3Product(); DataList4.DataSource = dt4; DataList4.DataBind(); } }
void BindList() { PagedDataSource objPage = new PagedDataSource(); try { string tim = Request.QueryString["TimKiem"].ToString(); objPage.DataSource = aBUS.timKiem(tim).DefaultView; objPage.AllowPaging = true; objPage.PageSize = 16; objPage.CurrentPageIndex = CurrentPage; btnSau.Enabled = !objPage.IsLastPage; btnTruoc.Enabled = !objPage.IsFirstPage; DataList1.DataSource = objPage; DataList1.DataBind(); } catch (Exception) { } finally { objPage = null; } }
protected void btsearch_Click(object sender, ImageClickEventArgs e) { try { database database = new database(); database.openConnection(); MySqlCommand cmd = new MySqlCommand("select id, nome, preco, imagens, url from databasempb.produtos where nome like '%' @nome '%' ", database.getConnection()); cmd.Parameters.AddWithValue("@nome", txtsearch.Text); using (MySqlDataAdapter da = new MySqlDataAdapter(cmd)) { DataTable dt = new DataTable(); da.Fill(dt); DataList1.DataSource = dt; DataList1.DataBind(); txtsearch.Text = ""; if (DataList1.Items.Count == 0) { error.Text = "Não foi encontrado Produtos relacionados"; } else { error.Text = ""; } } database.closeConnection(); } catch (System.Exception ex) { MessageBox.Show(ex.Message, "AVISO !", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
protected void Page_Load(object sender, EventArgs e) { UrunID = Request.QueryString["UrunID"]; islem = Request.QueryString["islem"]; if (islem == "sil") { SqlCommand cmuSil = new SqlCommand("Delete from Urun where UrunID='" + UrunID + "'", baglan.baglan()); cmuSil.ExecuteNonQuery(); } if (Session["KoleksiyonerEmail"] != null) { string kEmail = Session["KoleksiyonerEmail"].ToString(); SqlCommand cmdSession = new SqlCommand("Select * from Koleksiyoner where KoleksiyonerEmail='" + kEmail + "'", baglan.baglan()); SqlDataReader drSession = cmdSession.ExecuteReader(); DatalistProfilBilgi.DataSource = drSession; DatalistProfilBilgi.DataBind(); SqlCommand cmuGetir = new SqlCommand("Select * from Urun where Ekleyen=" + 0 + "", baglan.baglan()); SqlDataReader druGetir = cmuGetir.ExecuteReader(); DataListKategoriGetir.DataSource = druGetir; DataListKategoriGetir.DataBind(); SqlCommand cmuGetir1 = new SqlCommand("Select * from Urun where Ekleyen=" + 1 + "", baglan.baglan()); SqlDataReader druGetir1 = cmuGetir1.ExecuteReader(); DataList1.DataSource = druGetir1; DataList1.DataBind(); } else { Response.Redirect("KullaniciGiris.aspx"); } }
protected void confirm_Click(object sender, EventArgs e) { Dictionary <string, object> d = new Dictionary <string, object>(); d.Add("head_sid", Request.QueryString["sid"].ToString()); d.Add("text", FTB_Text.Text); d.Add("player", ((Lib.Player)Session["player"]).ID); d.Add("date", DateTime.Now); Lib.DataUtility du = new Lib.DataUtility(); try { du.executeNonQueryByText("insert into discussiondetail values (@head_sid,@text,@player,@date)", d); d.Clear(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('回覆成功');history.go(-2);", true); DataList1.DataBind(); //Response.Redirect("index.aspx"); } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('" + ex.Message + "');", true); } //Response.Redirect("index.aspx"); }
protected void BindPageText(bool FormatWikiText) { DataSet ds = GetPageText(FormatWikiText); //if we got a page, display it if (ds != null) { pnlPageNotFound.Visible = false; pnlNewText.Visible = false; pnlAttachments.Visible = false; pnlQuickRef.Visible = false; DataList1.DataSource = ds; DataList1.DataBind(); } else //otherwise offer to create it { DataList1.Visible = false; pnlNewText.Visible = false; pnlQuickRef.Visible = false; pnlAttachments.Visible = false; pnlPageNotFound.Visible = true; } }
protected void bindModel(int id) { parkM = parkBll.GetModel(id, ViewState["name"].ToString()); if (parkM != null) { //titles = "修改园区信息"; //txtProductName.Text = parkM.productName.Trim(); //ddlName.SelectedValue = typeBll.GetList("parktypeid=" + parkM.parktypeid).Tables[0].Rows[0]["parktypeid"].ToString(); txtChina.Text = parkM.Chineseintroduced.ToString().Trim(); txtEnglish.Text = parkM.Englishintroduction.ToString().Trim(); DataSet ds = imgBLL.GetList("parkid=" + parkM.parkid); if ((ds != null) && (ds.Tables[0].Rows.Count > 0)) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; str += dr["imgName"].ToString() + "%"; mingche += dr["imgexplain"].ToString() + "%"; } DataList1.DataSource = ds; DataList1.DataBind(); photo.Attributes.Add("style", "display:''"); } else { photo.Attributes.Add("style", "display:none"); } btnUpdate.Visible = true; Button1.Visible = false; } else { //titles = "添加园区信息"; Button1.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //Label1.Text = Session["uni"].ToString(); lbluser.Text = Context.Items["user"].ToString(); Label1.Text = Context.Items["uni"].ToString(); SqlConnection con; con = new SqlConnection(ConfigurationManager.AppSettings["mss"]); con.Open(); string c = Label1.Text; string str; str = "select * from coll where uni='" + c + "'"; SqlCommand cmd; cmd = new SqlCommand(str, con); SqlDataReader dr; dr = cmd.ExecuteReader(); DataList1.DataSource = dr; DataList1.DataBind(); dr.Close(); con.Close(); } }
private void FindNodesByString() { try { SqlConnection MyCon = new SqlConnection(conString); MyCon.Open(); SqlCommand MyCmd = new SqlCommand(); MyCmd.Connection = MyCon; MyCmd.CommandText = "select * from View_Item_Display where IsDisplayed='0' and ( ItemCode like N'%" + Session["ItemIds"].ToString().Trim() + "%' or ItemName like N'%" + Session["ItemIds"].ToString().Trim() + "%' or ItemGroupName like N'%" + Session["ItemIds"].ToString().Trim() + "%') order by ItemId desc "; SqlDataAdapter MyAdapter = new SqlDataAdapter(MyCmd); DataSet MyDateSet = new DataSet(); MyAdapter.Fill(MyDateSet, "Category_Item"); DataList1.DataSource = MyDateSet.Tables["Category_Item"]; DataList1.DataBind(); MyCon.Close(); } catch (Exception ex) { Response.Write(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { var user = Page.User as CustomPrincipal; if (user != null) { try { var subId = Request.QueryString["subId"]; if (subId != null) { var subjectId = Convert.ToInt32(subId); using (var helper = new DbHelper.Classes()) { var subject = helper.GetSubject(subjectId); if (subject != null) { lblSubjectName.Text = subject.FullName; var cls = helper.ListAllClassesOfUserOfSubject(user.Id, subjectId); DataList1.DataSource = cls; DataList1.DataBind(); } else { Response.Redirect("~/"); } LoadSitemap(subject); } } } catch { Response.Redirect("~/"); } } }
//搜索时间段 protected void SelectMores_Click(object sender, EventArgs e) { this.Timer1.Enabled = false; string Start = this.StartTime.Text; string End = this.EndTime.Text; if (Start != "" && End != "") { if (DateTime.Parse(Start) <= DateTime.Parse(End)) { SelectInfo(Start, End); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('起始时间要小于结束时间!')", true); DataList1.DataBind(); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('请选择时间段!')", true); DataList1.DataBind(); } }