protected void Button3_Click(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "insert into clinic_reg values('" + id + "','" + TextBox1.Text + "','" + DropDownList1.SelectedValue + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "') "; dbo.execute(cmd); cmd.CommandText = "insert into login values('" + id + "','" + TextBox5.Text + "','" + TextBox6.Text + "','clinic')"; dbo.execute(cmd); Response.Write("<script> alert('add successfully') </script>"); TextBox1.Text = " "; DropDownList1.SelectedIndex = -1; TextBox3.Text = " "; TextBox4.Text = " "; TextBox5.Text = " "; MultiView1.SetActiveView(View1); cmd.CommandText = "select * from clinic_reg"; DataGrid1.DataSource = dbo.get(cmd); DataGrid1.DataBind(); cmd.CommandText = "Select max(id)from clinic_reg"; id = dbo.main(cmd); }
protected void Page_Load(object sender, EventArgs e) { using (SqlConnection Connect = new SqlConnection("data source=. ; database = Asp.net;integrated security=SSPI")) { SqlDataAdapter SDA = new SqlDataAdapter("Select * from employee", Connect); SqlDataAdapter SDA1 = new SqlDataAdapter("Select * from student", Connect); SqlDataAdapter SDA2 = new SqlDataAdapter("Select * from IndianCricketTeam", Connect); SqlDataAdapter SDA3 = new SqlDataAdapter("Select * from BanKTable", Connect); SqlDataAdapter SDA4 = new SqlDataAdapter("Select * from IndianRailwaySystem", Connect); DataSet ds = new DataSet(); SDA.Fill(ds); SDA1.Fill(ds); SDA2.Fill(ds); SDA3.Fill(ds); SDA4.Fill(ds); DataGrid1.DataSource = ds; DataGrid1.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text == "") { Label3.Visible = true; } else { qry = "update Booking_Table set Status='" + TextBox1.Text + "' where Booking_Id=" + Session["bid"] + ""; c.nonret(qry); Label1.Visible = false; Button1.Visible = false; TextBox1.Visible = false; qry = "select * from Booking_Table where Shop_Id=" + Session["shopid"] + " "; DataTable dt = new DataTable(); dt = c.ret(qry); DataGrid1.DataSource = dt; DataGrid1.DataBind(); } }
private void SetNetworkRates() { NetworkRate[] nrates = process_file.GetNetworkRates(); networkRates.Columns.Add("Network", typeof(string)); networkRates.Columns.Add("Rate(UShs.)", typeof(string)); foreach (NetworkRate rate in nrates) { networkRates.Rows.Add(rate.Network, rate.Rate); } rates.Clear(); DataGrid1.DataSource = networkRates; DataGrid1.DataBind(); for (int i = 0; i < networkRates.Rows.Count; i++) { string network = networkRates.Rows[i]["Network"].ToString(); string nRate = networkRates.Rows[i]["Rate(UShs.)"].ToString(); rates.Add(network, nRate); } }
protected void DataGrid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e) { try { string districtcode = GetDistrictCode(); string Receiptno = txtReceiptno.Text.Trim(); string Paymentcode = cboPaymentType.SelectedValue.ToString(); string Paymode = cboPaymode.SelectedValue.ToString(); DateTime fromdate = bll.ReturnDate(txtfromDate.Text.Trim(), 1); DateTime todate = bll.ReturnDate(txttoDate.Text.Trim(), 2); string teller = cboCashier.SelectedValue.ToString(); dataTable = datapay.GetPayments(districtcode, Receiptno, Paymentcode, Paymode, teller, fromdate, todate); DataGrid1.CurrentPageIndex = e.NewPageIndex; DataGrid1.DataSource = dataTable; DataGrid1.DataBind(); } catch (Exception ex) { ShowMessage(ex.Message, true); } }
private void LoadSmslogs() { MultiView2.ActiveViewIndex = 0; string list_code = ddllists.SelectedValue.ToString(); string area_code = ddlAreas.SelectedValue.ToString(); string user = ddlUsers.SelectedValue.ToString(); string from = txtstartdate.Text.Trim(); string end = txtenddate.Text.Trim(); if (from.Equals("")) { ShowMessage("Please Enter Start Date for your Search", true); } else { data_table = Process_file.GetSmslogs(list_code, area_code, user, from, end); DataGrid1.DataSource = data_table; DataGrid1.DataBind(); ShowMessage(".", true); } }
private void getdata(string sql) { DataSet result = new DataSet(); result = new Class1().hsggetdata(sql); if (result != null) { if (result.Tables[0].Rows.Count > 0) { DataGrid1.DataSource = result.Tables[0]; DataGrid1.DataBind(); Label1.Text = "以上数据中共" + result.Tables[0].Rows.Count + "条"; } else { DataGrid1.DataSource = null; DataGrid1.DataBind(); Label1.Text = "暂无任何数据"; } } }
private void LoadCreditHistory() { MultiView2.ActiveViewIndex = 0; string area_code = ddlAreas.SelectedValue.ToString(); string user = ddlUsers.SelectedValue.ToString(); string from = txtstartdate.Text.Trim(); string end = txtenddate.Text.Trim(); if (from.Equals("")) { ShowMessage("Please Enter Start Date for your Search", true); } else { data_table = Process_file.GetCreditHistory(area_code, user, from, end); //CalculateTotal(data_table); DataGrid1.DataSource = data_table; DataGrid1.DataBind(); ShowMessage("Found [" + data_table.Rows.Count + "] Rows", false); } }
private void LoadListDetails() { MultiView2.ActiveViewIndex = 0; string list_code = ddllists.SelectedValue.ToString(); string phone = txtPhone.Text.Trim(); string name = txtSearch.Text.Trim(); if (!list_code.Equals("0")) { if (!phone.Equals("")) { if (phone_validity.PhoneNumbersOk(phone)) { data_table = Process_file.GetListDetails(list_code, phone, name); DataGrid1.DataSource = data_table; DataGrid1.CurrentPageIndex = 0; DataGrid1.DataBind(); ShowMessage(".", true); } else { DataGrid1.DataSource = data_table; DataGrid1.DataBind(); ShowMessage("Please Enter valid Phone Number", true); txtPhone.Focus(); } } else { data_table = Process_file.GetListDetails(list_code, phone, name); DataGrid1.DataSource = data_table; DataGrid1.DataBind(); ShowMessage(".", true); } } else { ShowMessage("Please Select List", true); } }
private void LoadTransactions() { string vendorcode = cboVendor.SelectedValue.ToString(); string vendorref = txtpartnerRef.Text.Trim(); string Paymentcode = "0"; string Account = ""; string CustName = ""; DateTime fromdate = bll.ReturnDate(txtfromDate.Text.Trim(), 1); DateTime todate = bll.ReturnDate(txttoDate.Text.Trim(), 2); string teller = txtSearch.Text.Trim(); string utility = cboUtility.SelectedValue.ToString(); if (vendorcode.Equals("0")) { ShowMessage("Please Select Collection Partner", true); } else if (utility.Equals("0")) { ShowMessage("Please Select a Utility To Reconcile", true); } else { dataTable = datapay.GetTransToReconcile(vendorcode, vendorref, Account, CustName, Paymentcode, teller, fromdate, todate, utility); DataGrid1.DataSource = dataTable; DataGrid1.DataBind(); if (dataTable.Rows.Count > 0) { MultiView1.ActiveViewIndex = 0; CalculateTotal(dataTable); ShowMessage(".", true); } else { MultiView1.ActiveViewIndex = -1; ShowMessage("No Record found", true); } } chkSelect.Checked = false; CheckBox2.Checked = false; }
public void BindData1() { SqlDataAdapter da; DataSet ds = new DataSet(); SqlCommand cmd = new SqlCommand(); SqlConnection con; con = new SqlConnection(connetionString); string name = HttpContext.Current.Session["username"].ToString(); cmd.CommandText = "Select a.SectorName, a.StockPrice, a.StockQuantity, a.CompanyName, a.TotalAmount, a.UserName from dbo.UserStorkMatket a";// where a.UserName='******'"; // + " INNER JOIN dbo.Sectors s ON a.Sector=s.Sector" // + " INNER JOIN dbo.Company c ON a.Company=c.Company where a.UserName='******'"; cmd.Connection = con; da = new SqlDataAdapter(cmd); da.Fill(ds); con.Open(); cmd.ExecuteNonQuery(); DataGrid1.DataSource = ds; DataGrid1.DataBind(); con.Close(); }
protected void Page_Load(object sender, EventArgs e) { DataTable Table = new DataTable(); Table.Columns.Add("ID"); Table.Columns.Add("Name"); Table.Columns.Add("Email"); Table.Columns.Add("Phoneno"); Table.Columns.Add("Location"); Table.Columns.Add("Pin code"); Table.Rows.Add(101, "sachin", "*****@*****.**", 99898900, "Vizag", 54890); Table.Rows.Add(102, "Haritha", "*****@*****.**", 87908098098, "hyderabad", 67890); Table.Rows.Add(103, "vamsi", "*****@*****.**", 8909909099, "s.a", 789980); Table.Rows.Add(104, "roopa", "*****@*****.**", 8900909090, "vizag", 789890); Table.Rows.Add(104, "vamsisairam", "*****@*****.**", 8956798099, "pune", 70998); Table.Rows.Add(105, "varun", "*****@*****.**", 67878978908, "vizag", 7897908); DataGrid1.DataSource = Table; DataGrid1.DataBind(); }
protected void btnadd_Click(object sender, System.EventArgs e) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlDataReader rd; SqlCommand cmd = new SqlCommand("insert into temp_acts_sections values('" + txtfirno.Text.Trim() + "','" + lbldisdate.Text + "','" + ddldist.SelectedItem.Text + "','" + txtpstation.Text + "','" + ddlact.SelectedItem.Text + "','" + txtactdesc.Text + "','" + ddlsection.SelectedItem.Text + "','" + txtsectiondesc.Text + "','" + (txtgrave.Text.Trim()) + "','" + (txtpunishable.Text.Trim()) + "') ", con); rd = cmd.ExecuteReader(CommandBehavior.CloseConnection); rd.Close(); if (con.State == ConnectionState.Closed) { con.Open(); } SqlDataAdapter adp = new SqlDataAdapter("select * from temp_acts_sections", con); DataSet ds = new DataSet(); adp.Fill(ds); DataGrid1.DataSource = ds; DataGrid1.DataBind(); }
protected void ResendtxnsBtn_Click(object sender, EventArgs e) { try { string vcode = cboVendor.SelectedValue.ToString(); if (string.IsNullOrEmpty(FileUpload1.FileName.Trim())) { lblTxnMsg.Visible = true; string msg = lblTxnMsg.Text.ToString(); msg = ShowMessage("Please Browse file of Transaction Ids to Upload", true); // MultiView1.ActiveViewIndex = -1; } else { FileUpload1.SaveAs(@"E:\\PePay\\GenericApi\\test\\GenericApi\\application\\ResendTransactions\\" + FileUpload1.FileName.Trim()); string uploadedFile = @"E:\\PePay\\GenericApi\\test\\GenericApi\\application\\ResendTransactions\\" + FileUpload1.FileName.Trim(); ViewState["UploadedFile"] = uploadedFile; DataTable dtable = ReadExcelFileAsDataTable(uploadedFile); int count = dtable.Rows.Count; MultiView1.ActiveViewIndex = 0; YesBtn.Visible = false; OkBtn.Visible = true; lblTxnMsg.Visible = false; Label1.Visible = true; string text1 = "Are you sure you want to resend these" + " " + count + " " + "transaction(s) ?"; ShowWarningMessage(text1, true); DataGrid1.CurrentPageIndex = 0; DataTable dt = ReturnDataGridTable(uploadedFile, vcode); DataGrid1.DataSource = dt; DataGrid1.DataBind(); DataGrid1.Visible = true; //ResendTransactionFile(uploadedFile); } } catch (Exception ex) { ShowMessage(ex.Message, true); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "select * from complaints where type='Worker' and employee_id= '" + Session["id"] + "'"; DataGrid1.DataSource = obj.getData(cmd); DataGrid1.DataBind(); MultiView1.SetActiveView(View2); cmd.CommandText = "select max(cmp_id)from complaints"; id = obj.max_id(cmd); cmd.CommandText = "select employee_name from employee_management where employee_id='" + Session["id"] + "'"; DataTable dt = obj.getData(cmd); if (dt.Rows.Count > 0) { TextBox2.Text = dt.Rows[0][0].ToString(); } TextBox6.Text = DateTime.Now.ToShortDateString(); } }
private void BindDataGrid() { DataGrid1.TableHeaderName = "菜单备份管理"; DataTable dt = new DataTable(); dt.Columns.Add("backupname"); dt.Columns.Add("backupdate"); string[] filelist = Directory.GetFiles(Server.MapPath("../xml/backup"), "*.config"); //foreach(string file in filelist) for (int i = filelist.Length - 1; i >= 0; i--) { string filename = Path.GetFileName(filelist[i]); DataRow dr = dt.NewRow(); dr["backupname"] = filename; dr["backupdate"] = Path.GetFileNameWithoutExtension(filename).Replace("_", ":"); dt.Rows.Add(dr); } DataGrid1.DataSource = dt; DataGrid1.DataKeyField = "backupname"; DataGrid1.DataBind(); }
private void LoadDistricts() { string regioncode = cboAreas.SelectedValue.ToString(); string name = txtSearch.Text.Trim(); bool Isactive = chkIsactive.Checked; dataTable = datafile.GetDistricts(regioncode, name, Isactive); DataGrid1.CurrentPageIndex = 0; DataGrid1.DataSource = dataTable; DataGrid1.DataBind(); if (dataTable.Rows.Count > 0) { MultiView3.ActiveViewIndex = 0; ShowMessage(".", true); } else { //MultiView3.ActiveViewIndex = -1; //CallDistrictform(); ShowMessage("No District found", true); } }
protected void Button1_Click(object sender, EventArgs e) { string ConnectionString; SqlConnection MyCon; ConnectionString = "server=WSLKCMP5F-582;user id=sa;password=slk@SOFT;database=Adventure Works"; MyCon = new SqlConnection(ConnectionString); try { if (DropDownList1.SelectedIndex == 1) { int Val = int.Parse(TextBox1.Text); string Query = "select EmpId,EmpName,DOB,Gender,ContactNo,EmailId,DOJ,Department,Designation from Tbl_Employee where EmpId ='" + Val + "'"; SqlCommand cmd = new SqlCommand(Query, MyCon); SqlDataAdapter sde = new SqlDataAdapter(); DataSet ds = new DataSet(); sde.Fill(ds); DataTable dt = ds.Tables["tabl"]; DataGrid1.DataSource = ds; DataGrid1.DataBind(); } else if (DropDownList1.SelectedIndex == 2) { string Val = TextBox1.Text; string Query = "select EmpId,EmpName,DOB,Gender,ContactNo,EmailId,DOJ,Department,Designation from Tbl_Employee where EmpName ='" + Val + "'"; SqlDataAdapter sde = new SqlDataAdapter(Query, MyCon); DataSet ds = new DataSet(); sde.Fill(ds); DataGrid1.DataSource = ds; DataGrid1.DataBind(); } } catch (Exception ee) { lblMsg.Text = "the error is" + ee; } finally { MyCon.Close(); } }
private void LoadGrid() { String sql = String.Empty; if (DateSelect.Items[DateSelect.SelectedIndex].ToString() == "Last 120") { sql = "select top 120 * from FailedTransaction order by OrderDate desc"; } else { DateTime dt = Localization.ParseNativeDateTime(DateSelect.Items[DateSelect.SelectedIndex].ToString()); sql = "select * from FailedTransaction where Year(OrderDate)=year(" + DB.DateQuote(Localization.ToDBDateTimeString(dt)) + ") and month(OrderDate)=month(" + DB.DateQuote(Localization.ToDBDateTimeString(dt)) + ") and day(OrderDate)=day(" + DB.DateQuote(Localization.ToDBDateTimeString(dt)) + ") order by OrderDate desc"; } using (DataTable dt = new DataTable()) { using (SqlConnection con = new SqlConnection(DB.GetDBConn())) { con.Open(); using (IDataReader rs = DB.GetRS(sql, con)) { dt.Load(rs); } } if (!AppLogic.ProductIsMLX() && !AppLogic.ProductIsMLExpress()) { ColumnRecurringSubscriptionID = dt.Columns["RecurringSubscriptionID"].Ordinal; } else { dt.Columns.Remove("recurringsubscriptionid"); } ColumnGateway = dt.Columns["PaymentGateway"].Ordinal; DataGrid1.DataSource = dt; DataGrid1.DataBind(); } }
private void getdata(string sql) { sql = "select * from gouwuche where yonghuming=" + Session["username"].ToString().Trim(); DataSet result = new DataSet(); result = new Class1().hsggetdata(sql); if (result != null) { if (result.Tables[0].Rows.Count > 0) { DataGrid1.DataSource = result.Tables[0]; DataGrid1.DataBind(); Label1.Text = "以上数据中共" + result.Tables[0].Rows.Count + "条"; } else { DataGrid1.DataSource = null; DataGrid1.DataBind(); Label1.Text = "暂无任何数据"; } } }
/*---------------------------------------------------------------------------- * %%Function: BindSource * %%Qualified: Rwp.CalendarLinkPage.BindSource * %%Contact: rlittle * * ----------------------------------------------------------------------------*/ void BindSource() { if (String.IsNullOrEmpty(SqlQuery)) { DataGrid1.DataSource = null; DataGrid1.DataBind(); } else { DBConn.Open(); cmdMbrs = DBConn.CreateCommand(); cmdMbrs.CommandText = SqlQuery; rdrMbrs = cmdMbrs.ExecuteReader(); DataGrid1.DataSource = rdrMbrs; DataGrid1.DataBind(); DataGrid1.Visible = DataGrid1.Items.Count != 0; rdrMbrs.Close(); cmdMbrs.Dispose(); DBConn.Close(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = "select max(Category_Id) from Category"; con.Open(); int id; try { id = Convert.ToInt32(cmd.ExecuteScalar().ToString()) + 1; } catch { id = 1; } finally { con.Close(); } TextBox1.Text = id.ToString(); cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = "select * from Category"; SqlDataAdapter sa = new SqlDataAdapter(); sa.SelectCommand = cmd; DataTable dt = new DataTable(); sa.Fill(dt); DataGrid1.DataSource = dt; DataGrid1.DataBind(); MultiView1.SetActiveView(View1); } }
private void filldata() { //SqlConnection con = new SqlConnection(); //SqlConnection con = new SqlConnection("Data Source = BVC\\SQLEXPRESS; Initial Catalog = planning; Integrated Security = true"); con.Open(); SqlCommand cmd1 = new SqlCommand("select * from Process_Master order by Process_no desc", con); SqlDataReader dr = cmd1.ExecuteReader(); while (dr.Read()) { DropDownList1.Items.Add(Convert.ToString(dr[0])); } dr.Close(); con.Close(); SqlCommand cmd2 = new SqlCommand("select * from Process_Master order by Process_No", con); con.Open(); SqlDataReader dr1 = cmd2.ExecuteReader(); while (dr1.Read()) { Textbox1.Text = dr1[1].ToString(); TextBox2.Text = dr1[2].ToString(); Textbox3.Text = dr1[3].ToString(); Textbox4.Text = dr1[4].ToString(); Textbox5.Text = dr1[5].ToString(); } string i; i = DropDownList1.Items.Count.ToString(); dr1.Close(); con.Close(); SqlCommand cmd3 = new SqlCommand("select * from Process_Master order by Process_no desc", con); con.Open(); DataGrid1.DataSource = cmd3.ExecuteReader(); DataGrid1.DataBind(); }
private void LoadPayments() { if (txtfromDate.Text.Equals("")) { DataGrid1.Visible = false; ShowMessage("From Date is required", true); txtfromDate.Focus(); } else { string districtcode = GetDistrictCode(); string Receiptno = txtReceiptno.Text.Trim(); string Paymentcode = cboPaymentType.SelectedValue.ToString(); string Paymode = cboPaymode.SelectedValue.ToString(); DateTime fromdate = bll.ReturnDate(txtfromDate.Text.Trim(), 1); DateTime todate = bll.ReturnDate(txttoDate.Text.Trim(), 2); string teller = cboCashier.SelectedValue.ToString(); dataTable = datapay.GetPaymentsToReverse(districtcode, Receiptno, Paymentcode, Paymode, teller, fromdate, todate); DataGrid1.DataSource = dataTable; DataGrid1.DataBind(); if (dataTable.Rows.Count > 0) { CalculateTotal(dataTable); MultiView1.ActiveViewIndex = 0; DataGrid1.Visible = true; lblTotal.Visible = true; ShowMessage(".", true); } else { lblTotal.Text = "."; DataGrid1.Visible = false; lblTotal.Visible = false; MultiView1.ActiveViewIndex = -1; ShowMessage("No Record found", true); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MultiView1.SetActiveView(View1); string s = "select KID , placename from krishibhavan"; DataTable dt = db.ret(s); DropDownList1.DataTextField = "placename"; DropDownList1.DataValueField = "KID"; DropDownList1.DataSource = dt; DropDownList1.DataBind(); DropDownList1.Items.Insert(0, "select"); string d = "select * from AOS"; dt = db.ret(d); DataGrid1.DataSource = dt; DataGrid1.DataBind(); for (int i = 1; i <= 31; i++) { DropDownList2.Items.Add(i.ToString()); DropDownList5.Items.Add(i.ToString()); DropDownList8.Items.Add(i.ToString()); } for (int i = 1; i <= 12; i++) { DropDownList3.Items.Add(i.ToString()); DropDownList6.Items.Add(i.ToString()); DropDownList9.Items.Add(i.ToString()); } for (int i = 1900; i <= 3000; i++) { DropDownList4.Items.Add(i.ToString()); DropDownList7.Items.Add(i.ToString()); DropDownList10.Items.Add(i.ToString()); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("月份", typeof(int))); dt.Columns.Add(new DataColumn("现存款数", typeof(float))); dt.Columns.Add(new DataColumn("利息", typeof(float))); dt.Columns.Add(new DataColumn("本息和", typeof(float))); DataRow dr; for (int i = 0; i <= 11; ++i) { if (i == 0) { m_dInterst = 0; m_dTotal = 1000; } else { m_dInterst = (m_dTotal * 0.03); m_dTotal = (1000 + m_dInterst + m_dTotal); } dr = dt.NewRow(); dr[0] = i + 1; dr[1] = 1000; dr[2] = m_dInterst; dr[3] = m_dTotal; dt.Rows.Add(dr); } DataGrid1.DataSource = dt; DataGrid1.DataBind(); } }
private void AHPDataBinding(int ver_id, int estterm_ref_id, int est_dept_ref_id) { Biz_PDTAndAHPStgEstDeptDatas pdtAhpStgEstDept = new Biz_PDTAndAHPStgEstDeptDatas(); DataGrid1.DataSource = pdtAhpStgEstDept.GetAHPEstDeptStgList(ver_id , estterm_ref_id , est_dept_ref_id); DataGrid1.DataBind(); DataTable dt = GetAHPPointDataTable(); if (dt != null) { DataGrid3.DataSource = dt; DataGrid3.DataBind(); DataGrid3.Visible = true; GraphAvailablePointBinding(dt); pdtAhpStgEstDept.ModifyPDTAndAHPWeight(VER_ID , ESTTERM_REF_ID , int.Parse(txtDeptID.Text) , EMP_REF_ID , dt); } else { lblCI.Text = "0"; lblCR.Text = "0"; lblMsg.Text = ""; //DataGrid3.Visible = false; //GraphNullPointBinding(); } }
protected void Button1_Click(object sender, System.EventArgs e) { webdav1.UserName = edtUser.Text; webdav1.Password = edtPassword.Text; webdav1.ListDir(edtHost.Text); DataTable resources = new DataTable(); resources.Columns.Add("Path"); resources.Columns.Add("Size"); foreach (WebDavProperty resource in webdav1.ResourceProperties) { DataRow row = resources.NewRow(); resources.Rows.Add(row); row["Path"] = resource.Uri; row["Size"] = resource.Value; } DataGrid1.DataSource = resources; DataGrid1.DataBind(); }
private void BindDataGrid(int parentid) { DataGrid1.TableHeaderName = (parentid != 0 ? "子" : "") + "导航菜单管理"; DataGrid1.AllowCustomPaging = false; DataTable navmenu = navMenuTable.Clone(); foreach (DataRow dr in navMenuTable.Select("parentid=" + parentid)) { navmenu.ImportRow(dr); } DataGrid1.DataSource = navmenu; DataGrid1.DataBind(); string navscript = "\r\n<script type='text/javascript'>\r\nnav = ["; foreach (DataRow dr in navmenu.Rows) { navscript += String.Format("\r\n{{id:'{0}',parentid:'{1}',name:'{2}',title:'{3}',url:'{4}',target:'{5}',type:'{6}',available:'{7}',displayorder:'{8}',level:'{9}'}},", dr["id"], dr["parentid"], dr["name"], dr["title"], dr["url"], dr["target"], dr["type"], dr["available"], dr["displayorder"], dr["level"]); } navscript = navscript.TrimEnd(',') + "]\r\n</script>"; this.RegisterStartupScript("", navscript); }
protected void DataGrid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e) { try { string vendorcode = cboVendor.SelectedValue.ToString(); string vendorref = txtpartnerRef.Text.Trim(); string Paymentcode = cboPaymentType.SelectedValue.ToString(); string Account = txtAccount.Text.Trim(); string CustName = txtCustName.Text.Trim(); DateTime fromdate = bll.ReturnDate(txtfromDate.Text.Trim(), 1); DateTime todate = bll.ReturnDate(txttoDate.Text.Trim(), 2); string teller = txtSearch.Text.Trim(); string utility = cboUtility.SelectedValue.ToString(); dataTable = datapay.GetPostedTrans(vendorcode, vendorref, Account, CustName, Paymentcode, teller, fromdate, todate, utility); DataGrid1.CurrentPageIndex = e.NewPageIndex; DataGrid1.DataSource = dataTable; DataGrid1.DataBind(); } catch (Exception ex) { ShowMessage(ex.Message, true); } }