protected void SearchButton_Click(object sender, EventArgs e) { int id = int.Parse(SearchTextBox.Text); List <Book> theList = booksController.RetrieveByIDToList(id); SearchGridView.DataSource = theList; SearchGridView.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { ((Layout)Page.Master).ShowSearch = false; var query = Session["query"] as string; if (!string.IsNullOrEmpty(query)) { Session["query"] = null; SearchGridView.SearchPanelFilter = query; } SearchGridView.DataSource = BlogPostsProvider.GetBlogPosts(); SearchGridView.DataBind(); }
protected void SearchButton_Click(object sender, EventArgs e) { string connStr = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; string sql = "SELECT * FROM Catagories WHERE name LIKE '%" + SearchCatagoryTextBox.Text + "%'"; SqlConnection con = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand(sql, con); con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SearchGridView.DataSource = reader; SearchGridView.DataBind(); con.Close(); }
protected void SearchButton_Click(object sender, EventArgs e) { string connStr = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; string sql = "SELECT Products.name as 'Product Name', price, quantity, Catagories.name as 'Catagory' FROM Products, Catagories where Products.catagory_id=Catagories.catagory_id and Products.name LIKE '%" + SearchTextBox.Text + "%'"; SqlConnection con = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand(sql, con); con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SearchGridView.DataSource = reader; SearchGridView.DataBind(); con.Close(); }
private void LoadGridView() { if (string.IsNullOrWhiteSpace(this.GetSchema())) { return; } if (string.IsNullOrWhiteSpace(this.GetView())) { return; } using (System.Data.DataTable table = MixERP.Net.BusinessLayer.Helpers.FormHelper.GetTable(this.GetSchema(), this.GetView(), "", "", 10)) { SearchGridView.DataSource = table; SearchGridView.DataBind(); } }
protected void GoButton_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(this.GetSchema())) { return; } if (string.IsNullOrWhiteSpace(this.GetView())) { return; } using (System.Data.DataTable table = MixERP.Net.BusinessLayer.Helpers.FormHelper.GetTable(this.GetSchema(), this.GetView(), FilterDropDownList.SelectedItem.Value, FilterTextBox.Text, 10)) { SearchGridView.DataSource = table; SearchGridView.DataBind(); } }
protected void UpdateButton_Click(object sender, EventArgs e) { string connStr = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; string sql = "update Catagories set name='" + UpdateTextBox.Text + "' where catagory_id=" + UpdateDropDownList.SelectedValue; SqlConnection con = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand(sql, con); con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SearchGridView.DataSource = reader; SearchGridView.DataBind(); con.Close(); this.LoadCatagory(); this.LoadCatagoryNameForUpdate(); this.LoadCatagoryName(); }
protected void SearchButton_Click(object sender, EventArgs e) { SurveyLogicControl surveyLogicControl = new SurveyLogicControl(); List <int> answerOptionIdList = new List <int>(); foreach (ListItem item in BankCheckBoxList.Items) { if (item.Selected == true) { answerOptionIdList.Add(AppUtil.convertStringToInt(item.Value)); } } foreach (ListItem item in ServicesCheckBoxList.Items) { if (item.Selected == true) { answerOptionIdList.Add(AppUtil.convertStringToInt(item.Value)); } } try { SearchGridView.DataSource = surveyLogicControl.searchSurveyByAnswerIDLastNameOrGivenNames(answerOptionIdList, LastNameTextBox.Text, GivenNamesTextBox.Text); SearchGridView.DataBind(); if (SearchGridView.Rows.Count == 0) { ErrorMessageLabel.Text = AppConstants.errorNoRecordsFound; ErrorMessageLabel.ForeColor = System.Drawing.Color.Blue; } } catch (AppControlException ex) { ErrorMessageLabel.Text = ex.Message; ErrorMessageLabel.ForeColor = System.Drawing.Color.Red; } this.clearSearchFields(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["COMP_CODE"] == null || Session["COMP_CODE"].ToString() == "") { ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true); } if (!IsPostBack) { if (!Session["Approval_Id"].ToString().Equals("")) { load_sub_grid(Session["Approval_Id"].ToString()); } else { SearchGridView.DataSource = null; SearchGridView.DataBind(); } } }
private void load_sub_grid(string request_Id_edit) { try { d.con.Open(); DataSet ds = new DataSet(); // MySqlDataAdapter dr = new MySqlDataAdapter("select Id,services,pay_service_master.location,priority,pay_service_master.status,additional_comment,EMP_NAME as forword_to,documents from pay_service_master inner join pay_employee_master on pay_service_master.comp_code=pay_employee_master.comp_code and pay_service_master.forword_to=pay_employee_master.emp_code where pay_service_master.comp_code='" + Session["comp_code"].ToString() + "' and pay_service_master.unit_code='" + Session["unit_code"].ToString() + "' order by Id ", d.con); MySqlDataAdapter dr = new MySqlDataAdapter("SELECT ID,COMP_CODE,COMPANY_NAME,CITY,STATE FROM pay_company_master_approval where id = '" + request_Id_edit + "'", d.con); dr.Fill(ds); SearchGridView.DataSource = ds.Tables[0]; SearchGridView.DataBind(); d.con.Close(); SearchGridView.Visible = true; } catch (Exception ex) { throw ex; } finally { d.con.Close(); } }