protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { //----編輯模式---- GridView1.EditIndex = e.NewEditIndex; GridViewRow gvrow = GridView1.Rows[e.NewEditIndex]; clsMySQL db = new clsMySQL(); FormView1.Visible = true; Panel2.Visible = true; if (!FormView1.Visible) { return; } switch (FormView1.CurrentMode) { case FormViewMode.ReadOnly: FormView1.ChangeMode(FormViewMode.ReadOnly); break; case FormViewMode.Edit: FormView1.ChangeMode(FormViewMode.Edit); break; } //string strSQL = "select * from npiPOR where POR_Customer = '" + gvrow.Cells[1].Text + "' and POR_Device = '" + gvrow.Cells[2].Text + "'"; string strSQL = string.Format("select * from npipor where POR_Customer='{0}' and POR_Device='{1}' and POR_01='{2}' and POR_02='{3}' and POR_03='{4}' and POR_04='{5}' " + "and POR_05='{6}' and POR_11='{7}'", gvrow.Cells[1].Text, gvrow.Cells[2].Text, gvrow.Cells[3].Text, gvrow.Cells[4].Text, gvrow.Cells[5].Text, gvrow.Cells[6].Text, gvrow.Cells[7].Text, gvrow.Cells[8].Text); FormView1.DataSource = db.QueryDataSet(strSQL); FormView1.DataBind(); }
protected void Button1_Click(object sender, EventArgs e)//提交作业布置信息 { lbl_fankui.Text = ""; string shangjiaoqixian = TextBox1.Text; string yunxu = RadioButtonList1.SelectedValue; string yunxuchakan = RadioButtonList2.SelectedValue; string shuoming = TextBox2.Text; string zuoyebuzhiid = Request.QueryString["zuoyebuzhiid"]; string zuoyeid = string.Empty; string banjiid = string.Empty; DataTable dt = ZuoyeInfo.GetZuoyeBanjiidAndZuoyeid(int.Parse(zuoyebuzhiid)); if (dt.Rows.Count > 0) { zuoyeid = dt.Rows[0][0].ToString(); banjiid = dt.Rows[0][1].ToString(); try { ZuoyeInfo.SetZuoyeBuzhiInfo(int.Parse(banjiid), int.Parse(zuoyeid), yunxu, yunxuchakan, shangjiaoqixian, shuoming); lbl_fankui.Text = "作业布置信息更新成功!"; FormView1.DataBind(); } catch (Exception ex) { lbl_fankui.Text = "作业布置信息更新失败!" + ex.Message; } } else { lbl_fankui.Text = "未找到作业布置信息!"; } }
protected void btncheck_Command(object sender, CommandEventArgs e) { ContactInfo info = cBLL.GetDataById(int.Parse(e.CommandArgument.ToString())); info.c_check_read = true; cBLL.Update(info); ObjectDataSource2.SelectParameters["c_id"].DefaultValue = e.CommandArgument.ToString(); //特定Command按鈕 LinkButton lnkCheck = (LinkButton)sender; if (lnkCheck.Text == "檢視") { FormView1.Visible = true; //文字全部改為:檢視 for (int i = 0; i < gridView.Rows.Count; i++) { LinkButton lnkCheckText = (LinkButton)gridView.Rows[i].Cells[6].FindControl("btncheck"); lnkCheckText.Text = "檢視"; } lnkCheck.Text = "隱藏"; } else { FormView1.Visible = false; lnkCheck.Text = "檢視"; gridView.DataBind(); } FormView1.DataBind(); }
public void getformview() { con = DB.GetConnection(); string stt = "select Plant_name,Agent_id,Agent_name,CONVERT(VARCHAR,RequestingDate,103) AS RequestingDate,CONVERT(VARCHAR,FromDate,103) AS FromDate,LoanAmount,Rateperinterest,TotalinterestAmount,TotalAmount,InstallAmount,Emi,LoanId,BankName,Agent_AccountNo,Ifsc_code from LoanRequestEntry where Plant_code='" + pcode + "' and Agent_id='" + ddl_agentname.SelectedItem.Value + "' and loanid='" + ddl_loanid.Text + "'"; SqlCommand cmd = new SqlCommand(stt, con); SqlDataAdapter DA = new SqlDataAdapter(cmd); DA.Fill(dt); if (dt.Tables[0].Rows.Count > 0) { FormView1.DataSource = dt.Tables[0]; FormView1.DataBind(); pnlContents.Visible = true; Label7.Text = ddl_Plantname.SelectedItem.Text; Label6.Text = "PlantName:"; Label7.Visible = true; Label6.Visible = true; txt_FromDate.Text = System.DateTime.Now.ToString(); } else { pnlContents.Visible = false; Label7.Visible = false; Label6.Visible = false; } }
protected void Page_Init(object sender, EventArgs e) { if (Session["AId"] == null) { Response.Redirect("~/default.aspx"); } cat_id = Request.QueryString.Get("cat_id").ToString(); if (cat_id == String.Empty) { Response.Redirect("category_add.aspx"); } SqlDataSource SqlDataSource1 = new SqlDataSource(); SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; SqlDataSource1.SelectCommand = "SELECT [category_id], [category_name] FROM [Category] WHERE [category_id] = @cat_id"; SqlDataSource1.SelectParameters.Add("cat_id", cat_id); DataSourceSelectArguments args = new DataSourceSelectArguments(); //DataView dv = SqlDataSource1.Select(args) as DataView; //string id = dv.Table.Rows[0][0].ToString(); //string name = dv.Table.Rows[0][1].ToString(); FormView1.DataSource = SqlDataSource1; FormView1.DataBind(); //txtCateoryName.Text = name; //dv.Dispose(); SqlDataSource1.Dispose(); }
eticaretDataContext et = new eticaretDataContext(); // data context nesnemizi olusturdur. protected void Page_Load(object sender, EventArgs e) { stokvaryok();// Ürün stok var yok fonksiyonun çağırdık. // Veritabanımıza baglandık tabloları birleştirerek çünkü markaAD adlı kolonumuz Urunler tablosunda yoktu. //Ona ulasmak içinde Ürünler tablosu ile markalar Tablosunu birleştirdik. var urun = (from u in et.Urunlers.Where(v => v.UrunID == Convert.ToInt32(Request.QueryString["id"].ToString())) join u2 in et.Markalars on u.MarkaID equals u2.MarkaID select new { u.UrunID, u.UrunAD, u.UrunDetay, u.UrunFiyat, u.KDV, u.Resim1, u.Resim2, u.Resim3, u.Resim4, u.Resim5, u.Video, u.Taksit, u2.MarkaAD }); //Ürün Adımızı almak için veritabanımıza bağlandık. var urunad = et.Urunlers.Where(v => v.UrunID == int.Parse(Request.QueryString["id"])).FirstOrDefault(); lblAD.Text = urunad.UrunAD; // Ürün adımızı veritabanından alarak Label'ımıza atadık. FormView1.DataSource = urun; // sonucumuzu FormView'umuza attık. FormView1.DataBind(); FormView2.DataSource = urun; // Ürün Resimlerinin gösterimi için FormView2 ile bağlantımızı kurduk. FormView2.DataBind(); FormView3.DataSource = urun; FormView3.DataBind(); FormView4.DataSource = urun; FormView4.DataBind(); FormView5.DataSource = urun; FormView5.DataBind(); FormView6.DataSource = urun; FormView6.DataBind(); yorumgetir(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["AId"] == null) { Response.Redirect("~/admin/default.aspx"); } string uid = Request.QueryString.Get("uid").ToString(); if (string.IsNullOrEmpty(uid)) { Response.Redirect("error.aspx"); } SqlDataSource SqlDataSource1 = new SqlDataSource(); SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; SqlDataSource1.SelectCommand = @"SELECT [user_id], [user_fname], [user_lname], [user_email], [user_ph_num], [user_addr1], [user_addr2], [user_city], [user_state], [user_country], [user_zip] FROM [UserInfo] WHERE [user_id] = @uid"; SqlDataSource1.SelectParameters.Add("uid", uid); FormView1.DataSource = SqlDataSource1; FormView1.DataBind(); SqlDataSource1.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { Int32 tuoteId = (Int32)this.Session["tuoteid"]; String conStr = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; String queryStr = "select TuoteID, Nimi, Hinta, Veroprosentti from Tuote where TuoteID = @tuoteID;"; SqlConnection con = new SqlConnection(conStr); SqlCommand cmd = new SqlCommand(queryStr, con); cmd.Parameters.AddWithValue("@tuoteID", tuoteId); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); FormView1.DataSource = reader; FormView1.DataBind(); reader.Close(); } catch (SqlException ex) { throw new ApplicationException("ERROR ERROR!"); } finally { con.Close(); } }
protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e) { getcon(); string dk = FormView1.DataKey.Value.ToString(); TextBox tb1 = (TextBox)FormView1.FindControl("TextBox1"); TextBox tb2 = (TextBox)FormView1.FindControl("TextBox3"); TextBox tb3 = (TextBox)FormView1.FindControl("TextBox4"); TextBox tb4 = (TextBox)FormView1.FindControl("TextBox5"); TextBox tb5 = (TextBox)FormView1.FindControl("TextBox6"); DropDownList dl3 = (DropDownList)FormView1.FindControl("DropDownList3"); string upd = "update tbl_registration set registration_address='" + tb1.Text + "',district_id='" + Convert.ToInt32(dl3.SelectedItem.Value) + "',registration_pincode='" + tb2.Text + "',registration_landline='" + tb3.Text + "',registration_mobile='" + tb4.Text + "',registration_email='" + tb5.Text + "' where registration_id='" + Convert.ToInt32(dk) + "'"; SqlCommand cmdd = new SqlCommand(upd, con); cmdd.ExecuteNonQuery(); FormView1.ChangeMode(FormViewMode.ReadOnly); string str = "select tbl_registration.registration_fname+''+tbl_registration.registration_lname as name,tbl_registration.registration_id,tbl_registration.registration_address,tbl_district.district_name,tbl_state.state_name,tbl_country.country_name,tbl_registration.registration_pincode,tbl_registration.registration_landline,tbl_registration.registration_mobile,tbl_registration.registration_email from tbl_registration inner join tbl_district on tbl_district.district_id=tbl_registration.district_id inner join tbl_state on tbl_state.state_id=tbl_district.state_id inner join tbl_country on tbl_country.country_id=tbl_state.country_id where tbl_registration.registration_id='" + Convert.ToInt32(Session["regid"]) + "'"; SqlCommand cmd = new SqlCommand(str, con); SqlDataAdapter ad = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); ad.Fill(dt); if (dt.Rows.Count > 0) { FormView1.DataSource = dt; FormView1.DataBind(); } }
protected void LBtnweijiaojuan_Click(object sender, EventArgs e)//全部设为未交卷 { string shijuanid = Request.QueryString["shijuanid"]; SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings["kecheng2012ConnectionString"].ConnectionString; SqlCommand comm = conn.CreateCommand(); conn.Open(); SqlTransaction st = conn.BeginTransaction(); comm.Transaction = st; try { comm.CommandText = "update tb_studentkaoshi set jiaojuanshijian=null,jiaojuan='未交卷' where shijuanid=" + shijuanid; comm.ExecuteNonQuery(); st.Commit(); GridView1.DataBind(); FormView1.DataBind(); } catch { st.Rollback(); } finally { conn.Close(); } }
protected void Page_Init(object sender, EventArgs e) { if (Session["AId"] == null) { Response.Redirect("~/default.aspx"); } pro_id = Request.QueryString.Get("pid").ToString(); if (pro_id == String.Empty) { Response.Redirect("products.aspx"); } SqlDataSource SqlDataSource1 = new SqlDataSource(); SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; SqlDataSource1.SelectCommand = @"SELECT Category.category_id, Category.category_name, Product.product_name, Product.product_desc, Product.product_price, Product.product_stock, Product.product_image1, Product.product_image2, Product.product_image3, Product.category_id AS cat_id, Product.product_id FROM Product INNER JOIN Category ON Product.product_id = @product_id"; SqlDataSource1.SelectParameters.Add("product_id", pro_id); DataSourceSelectArguments args = new DataSourceSelectArguments(); FormView1.DataSource = SqlDataSource1; FormView1.DataBind(); SqlDataSource1.Dispose(); }
protected void LinkButton8_Command(object sender, CommandEventArgs e)//全部允许做题 { string shijuanid = e.CommandArgument.ToString(); SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings["kecheng2012ConnectionString"].ConnectionString; SqlCommand comm = conn.CreateCommand(); conn.Open(); SqlTransaction st = conn.BeginTransaction(); comm.Transaction = st; try { comm.CommandText = "update tb_teachershijuan set yunxuzuoti='允许' where shijuanid=" + shijuanid; comm.ExecuteNonQuery(); comm.CommandText = "update tb_studentkaoshi set yunxu='允许' where shijuanid=" + shijuanid; comm.ExecuteNonQuery(); st.Commit(); GridView1.DataBind(); FormView1.DataBind(); } catch { st.Rollback(); } finally { conn.Close(); } }
protected void FormView1_ItemCommand(object sender, FormViewCommandEventArgs e) { if (e.CommandName == "Edit") { HiddenField2.Value = (e.CommandArgument).ToString(); } else if (e.CommandName == "UpdateItem") { int cartid = Convert.ToInt32(e.CommandArgument); var newSearch = _cart.Search(cartid); TextBox txtquantity = FormView1.FindControl("QuantityTextBox") as TextBox; DropDownList ddlsize = FormView1.FindControl("DropDownList2") as DropDownList; int quantity = Convert.ToInt32(txtquantity.Text); int size = Convert.ToInt32(ddlsize.SelectedItem.Text); _cart.Update(new Cart { CartId = cartid, NewColorId = newSearch.NewColorId, Date = newSearch.Date, ColorId = newSearch.ColorId, ProductId = newSearch.ProductId, Quantity = quantity, Size = size, UserId = newSearch.UserId }); FormView1.DataBind(); int userid = Convert.ToInt32(Session["UserId"]); lbltotal.Text = _cart.CartTotal(userid).ToString(); FormView1.ChangeMode(FormViewMode.ReadOnly); } }
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { //----編輯模式---- GridView1.EditIndex = e.NewEditIndex; GridViewRow gvrow = GridView1.Rows[e.NewEditIndex]; clsMySQL db = new clsMySQL(); FormView1.Visible = true; Panel2.Visible = true; if (!FormView1.Visible) { return; } switch (FormView1.CurrentMode) { case FormViewMode.ReadOnly: FormView1.ChangeMode(FormViewMode.ReadOnly); break; case FormViewMode.Edit: FormView1.ChangeMode(FormViewMode.Edit); break; } string strSQL = "select * from npiManual where New_Customer = '" + gvrow.Cells[1].Text + "' and New_Device = '" + gvrow.Cells[2].Text + "'"; FormView1.DataSource = db.QueryDataSet(strSQL); FormView1.DataBind(); }
void SetDataSource() { string sRowID = Session["SPDS_SignatorySetup_ID"] != null ? Session["SPDS_SignatorySetup_ID"].ToString() : "0"; FormView1.DataSource = obj_lov.Get_SPDS_SignatorySetup_SPC(sRowID); FormView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { PeliId = (Int32)this.Session["peliid"]; current_username = Context.User.Identity.Name; TilausTietokanta til = new TilausTietokanta(); string connStr = WebConfigurationManager.ConnectionStrings["PelimaailmaConnectionString"] .ConnectionString; SqlConnection conn = new SqlConnection(connStr); string sqlQuery = "SELECT PeliId, Nimi, Vuosi, Alusta, Hinta FROM Pelit WHERE PeliId = @PeliId"; SqlCommand sqlCmd = new SqlCommand(sqlQuery, conn); sqlCmd.Parameters.AddWithValue("@PeliId", PeliId); try { conn.Open(); SqlDataReader reader = sqlCmd.ExecuteReader(); FormView1.DataSource = reader; FormView1.DataBind(); reader.Close(); } catch (SqlException ex) { throw new ApplicationException( "Error: Unable to connect to the database!"); } finally { conn.Close(); } }
protected void EventList_SelectedIndexChanged(object sender, EventArgs e) { FormView1.DataSource = EventDetailData; EventList.DataSource = EventData; EventList.DataBind(); FormView1.DataBind(); }
protected void btnNext_Click(object sender, ImageClickEventArgs e) { List <int> list = (List <int>)Session["search"]; HiddenField ID = FormView1.FindControl("ID") as HiddenField; int id = 0; if (int.TryParse(ID.Value, out id)) { int index = list.FindIndex(x => x == id); if (index == list.Count - 1) { index = 0; } else { index = index + 1; } id = list[index]; ArtGalleryDS.PictureDataTable table = PictureDL.GetById(id); FormView1.DataSource = table.Rows; FormView1.DataBind(); ArtGalleryDS.Picture_GetWithWaterMarkDataTable table1 = PictureDL.GetWithWaterMark(id); FormView2.DataSource = table1.Rows; FormView2.DataBind(); up1.Update(); up2.Update(); } }
protected void btnRing2_Click(object sender, ImageClickEventArgs e) { Session["Ringnummer"] = 2; FormView1.DataBind(); //refresh het form MultiView1.DataBind(); GridView2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { TuoteID = (Int32)this.Session["tuoteid"]; string connStr = WebConfigurationManager .ConnectionStrings["KankaKeidasConnectionString"] .ConnectionString; SqlConnection conn = new SqlConnection(connStr); string sqlQuery = "SELECT TuoteID, Nimi, Hinta, Veroprosentti FROM Tuote WHERE TuoteID = @TuoteID"; SqlCommand sqlCmd = new SqlCommand(sqlQuery, conn); sqlCmd.Parameters.AddWithValue("@TuoteID", TuoteID); try { conn.Open(); SqlDataReader reader = sqlCmd.ExecuteReader(); FormView1.DataSource = reader; FormView1.DataBind(); reader.Close(); } catch (SqlException ex) { throw new ApplicationException("Error: Unable to connect to the database!"); } finally { conn.Close(); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["book_id"] == null) { Response.Redirect("index.aspx"); } else { BookBL bookBL = new BookBL(); FormView1.DataSource = bookBL.product(Request.QueryString["book_id"].ToString()); FormView1.DataBind(); string author = ((HyperLink)FormView1.FindControl("HyperLink4")).Text.ToString(); Label15.Text = author; DataList1.DataSource = bookBL.authorBook(author); DataList1.DataBind(); //書籍內容 FormView2.DataSource = bookBL.product(Request.QueryString["book_id"].ToString()); FormView2.DataBind(); //書籍簡介 FormView3.DataSource = bookBL.product(Request.QueryString["book_id"].ToString()); FormView3.DataBind(); //留言板 GridView1.DataSource = bookBL.product_message(Request.QueryString["book_id"].ToString()); GridView1.DataBind(); } }
protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e) { lblidCliente.Text = RadGrid1.SelectedValues["id_cliente"].ToString(); PanelDetalle.Visible = true; FormView1.DataBind(); RadGrid2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] == null) { FormView1.ChangeMode(FormViewMode.Insert); } if (!IsPostBack) { if (Request.QueryString["id"] != null) { SqlDataSource1.SelectCommand = "SELECT * from courses where id = " + Request.QueryString["id"]; SqlDataSource1.DataBind(); FormView1.DataBind(); } } else { Page.Validate(); if (!Page.IsValid) { return; } } }
/// <summary> /// 装载控件数据 /// </summary> public override void LoadData() { try { if (this.ApplicationCode != "") { this.OperationCode = this.ApplicationCode; } else if (this.OperationCode != "") { this.ApplicationCode = this.OperationCode; } else { return; } this.ObjectDataSource1.SelectParameters["Code"].DefaultValue = this.ApplicationCode; FormView1.DataBind(); //业务流程属性保存 } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, "读取业务数据出错:" + ex.Message)); } }
private void BindViews() { DataTable dt = BLL_Tec_ErLog.ErLog_ME_00_Get(int.Parse(lblLogId.Text), int.Parse(lblVesselId.Text)); if (dt.Rows.Count > 0) { FormView1.DataSource = dt; FormView1.DataBind(); lblMV.Text = dt.Rows[0]["VOYAGE_NUM"].ToString(); lblfrom.Text = dt.Rows[0]["FROMPORT"].ToString(); lblTo.Text = dt.Rows[0]["TOPORT"].ToString(); lblDate.Text = dt.Rows[0]["LOG_DATE"].ToString(); lblVesselName.Text = dt.Rows[0]["Vessel_Name"].ToString(); if (dt.Rows[0]["Status"].ToString() == "UNFINALIZED") { btnRework.Visible = false; } else { btnRework.Visible = true; } if (dt.Rows[0]["Status"].ToString() == "REWORK") { btnRework.Enabled = false; } else { btnRework.Enabled = true; } } }
protected void btn_submit(object sender, EventArgs e) { bll = new LogBLL(); //Connection.CreateCommand(""); String AppName = txt_AppName.Text; String environment = ddl_environment.SelectedValue; if (RadioButtonList1.SelectedValue == "Error") { error = new Error(); error.AppName = AppName; error.Severity = ddl_severity.SelectedIndex; errorlist = bll.ErrorBLL(error, environment); if (errorlist != null) { FormView2.DataSource = errorlist; FormView2.DataBind(); } } else { message = new Message(); message.AppName = AppName; messagelist = bll.MessageBLL(message, environment); if (messagelist != null) { // txt_AppName.Text = ((Message)messagelist[0]).Source; FormView1.DataSource = messagelist;//list FormView1.DataBind(); } } }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { try { if (GridView1.SelectedValue != null) { if (!bool.Parse(Session["canEdit"].ToString())) { UpdateCancelButton_Click(sender, e); lblFeedback.Text = Feedback.NoPermissions(); return; } FormView1.Visible = true; FormView1.DataBind(); FormView1.Focus(); } else { FormView1.Visible = false; } } catch (Exception ex) { lblFeedback.Text = ex.InnerException.Message; } }
protected void BindFenxi() { DataTable dt = ZuoyeInfo.ZuoyeFenxi(int.Parse(Request.QueryString["banjiid"]), int.Parse(Request.QueryString["zuoyeid"])); FormView1.DataSource = dt; FormView1.DataBind(); }
private void GetPdetails(int uid) { da = new SqlDataAdapter("select name,gender,email,contactno,fname,bname,status from tbl_login where uid=" + uid + " ", con); ds = new DataSet(); da.Fill(ds, "tbl_l"); FormView1.DataSource = ds.Tables["tbl_l"].DefaultView; FormView1.DataBind(); }
protected void btnNew_Click(object sender, EventArgs e) { FormView1.ChangeMode(FormViewMode.Insert); FormView1.DataBind(); TextBox tbcode = FormView1.FindControl("beatIDTextBox") as TextBox; tbcode.Text = generate_code(); }