protected void Grd5_RowEditing(object sender, GridViewEditEventArgs e) { try { int rtqty5 = Convert.ToInt32(((Label)Grd5.Rows[e.NewEditIndex].FindControl("lbl5rtqty")).Text); string BookCode5 = ((Label)Grd5.Rows[e.NewEditIndex].FindControl("lbl5bkcode")).Text; string CustCode5 = ((Label)Grd5.Rows[e.NewEditIndex].FindControl("lbl5custcode")).Text; GrdView.DataSource = CreditNote.Get_DC_CNBkview(Convert.ToInt32(strFY), CustCode5, BookCode5); GrdView.DataBind(); if (rtqty5 != 0) { Pnl5CustDetails.Visible = true; Pnl5.Visible = true; PnlBkdetails.Visible = true; Pnlview.Visible = true; lbbkcode1.Text = ((Label)Grd5.Rows[e.NewEditIndex].FindControl("lbl5bkcode")).Text; lbName1.Text = ((Label)Grd5.Rows[e.NewEditIndex].FindControl("lbl5Name")).Text; } else { Pnl5CustDetails.Visible = true; Pnl5.Visible = true; PnlBkdetails.Visible = false; Pnlview.Visible = false; } } catch { } }
protected void btnSearch_Click(object sender, EventArgs e) { WebClass wc = new WebClass(); GrdView.DataSource = wc.ConnectME(); GrdView.DataBind(); }
protected void Grd3_RowEditing(object sender, GridViewEditEventArgs e) { try { int rtqty = Convert.ToInt32(((Label)Grd3.Rows[e.NewEditIndex].FindControl("lbl1rtqty")).Text); string BookCode1 = ((Label)Grd3.Rows[e.NewEditIndex].FindControl("lbl1bkcode")).Text; string CustCode1 = ((Label)Grd3.Rows[e.NewEditIndex].FindControl("lbl1custcode")).Text; GrdView.DataSource = DCReturnBook.Get_DC_ReturnBkview(CustCode1, BookCode1); GrdView.DataBind(); if (rtqty != 0) { PnlCustDetails.Visible = true; Pnl3.Visible = true; PnlBkdetails.Visible = true; Pnlview.Visible = true; lbbkcode1.Text = ((Label)Grd3.Rows[e.NewEditIndex].FindControl("lbl1bkcode")).Text; lbName1.Text = ((Label)Grd3.Rows[e.NewEditIndex].FindControl("lbl1Name")).Text; } else { PnlCustDetails.Visible = true; Pnl3.Visible = true; PnlBkdetails.Visible = false; Pnlview.Visible = false; } } catch { } }
protected void Page_Load(object sender, EventArgs e) { string connectionString; SqlConnection cnn; SqlCommand sqlcomm; SqlDataReader datareader; String sqlstr; connectionString = @"Data Source=.\;Initial Catalog=MyDB;integrated security=true"; cnn = new SqlConnection(connectionString); cnn.Open(); txtInput.Text = "DBSuccess"; sqlstr = "select * from address"; sqlcomm = new SqlCommand(sqlstr, cnn); datareader = sqlcomm.ExecuteReader(); DataTable dataTable = new DataTable(); dataTable.Columns.Add("Id"); dataTable.Columns.Add("HNumber"); dataTable.Columns.Add("Street"); dataTable.Columns.Add("Barangay"); dataTable.Columns.Add("City"); dataTable.Columns.Add("Province"); while (datareader.Read()) { DataRow row = dataTable.NewRow(); row["Id"] = datareader["Id"]; row["HNumber"] = datareader["hnumber"]; row["Street"] = datareader["street"]; row["Barangay"] = datareader["barangay"]; row["City"] = datareader["city"]; row["Province"] = datareader["province"]; dataTable.Rows.Add(row); } GrdView.DataSource = dataTable; GrdView.DataBind(); sqlcomm.Dispose(); datareader.Close(); cnn.Close(); }