protected void Page_Load(object sender, EventArgs e) { string check; check = Convert.ToString(Session["loginAdmin"]); if (check != "admin") { Response.Redirect("~/Login.aspx"); } string strValue; strValue = Request.QueryString["search"]; List <ClientsModel> list = Logic.ReturnSearchValues(strValue); GridViewSearch.DataSource = list; GridViewSearch.DataBind(); if (list.Count == 0) { lblNoData.Text = "No Data Found for " + "\"" + strValue + "\""; } else { lblNoData.Text = ""; } }
public void GetData() { string tablename1 = (String)Session["tablesession1"]; string tablename2 = (String)Session["tablesession2"]; string viewname = (String)Session["viewsession"]; string search = txtsearch.Text; string qr = "Select product_id,product_name,size,TotalStock,price from " + viewname + " where product_name LIKE '%" + search + "%' "; SqlDataAdapter adp = new SqlDataAdapter(qr, con); DataTable dt = new DataTable(); adp.Fill(dt); if (dt.Rows.Count > 0) { pnlproductview.Visible = true; GridViewSearch.Visible = true; GridViewSearch.DataSource = dt; GridViewSearch.DataBind(); btncheckout.Visible = true; lblerror.Text = ""; } else { //Display No Record FOUND on the Search! pnlproductview.Visible = false; lblerror.Text = " No Record FOUND on the Search!! "; } }
protected void btnSsearch_Click(object sender, EventArgs e) { GridViewSearch.Visible = true; //to display data on gridview DataTable dt = new DataTable(); String con; con = "User Id = sandeep; Password=admin; Data source = XE"; conn.ConnectionString = con; conn.Open(); string query = "Select * from Schedule_Details where scheduleId like '" + txtSsearch.Text + "'"; OracleCommand comd = new OracleCommand(query, conn); OracleDataAdapter adapter = new OracleDataAdapter(comd); adapter.Fill(dt); GridViewSearch.DataSource = dt; GridViewSearch.DataBind(); conn.Close(); }
private void dataBind() { GridViewSearch.Visible = true; //SqlDataSource1.SelectParameters.Clear(); //DateTime date1 = Convert.ToDateTime(TextBoxFromDate.Text.ToString()); //DateTime date2 = Convert.ToDateTime(TextBoxFromDate.Text.ToString()); //SqlDataSource1.SelectParameters.Add("CreatedDate1", date1.ToShortDateString); //SqlDataSource1.SelectParameters.Add("CreatedDate2", date2.ToShortDateString); GridViewSearch.DataSourceID = "SqlDataSource1"; SqlDataSource1.SelectCommand = "RepselectProjectOutcomeDetails"; GridViewSearch.DataBind(); SqlDataSource1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string search = Request.QueryString["search"]; var user = new User(); try { GridViewSearch.DataSource = user.searchUser(search); GridViewSearch.DataBind(); } catch (SqlException) { } }
public void SearchClients() { try { // DEAL WITH INCLUDE INACTIVE CHECKBOX string Should_I_IncludeInactives = ""; if (cbxIncludeInactive.Checked) { Should_I_IncludeInactives = "0"; } else { Should_I_IncludeInactives = "1"; } //ClientAge GridViewSearch.Columns[10].Visible = true; //ClientDOB GridViewSearch.Columns[11].Visible = true; List <FBClientsInfo> items; FBClientsController controller = new FBClientsController(); items = controller.FBClients_Search(this.PortalId, txtLastName.Text.ToString().Replace("'", "''").Trim(), txtClientIdCard.Text.ToString().Trim(), txtFirstName.Text.ToString().Replace("'", "''").Trim(), txtClientId.Text.ToString(), txtAddress.Text.ToString(), ddlCity.SelectedValue.ToString(), ddlClientType.SelectedValue.ToString(), Should_I_IncludeInactives.ToString()); GridViewSearch.DataSource = items; GridViewSearch.DataBind(); //ClAddFamMemFirstName GridViewSearch.Columns[15].Visible = false; //ClAddFamMemLastName GridViewSearch.Columns[16].Visible = false; } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
public void SearchClientAFMs() { try { // DEAL WITH INCLUDE INACTIVE CHECKBOX string Should_I_IncludeInactives = ""; if (cbxIncludeInactive.Checked) { Should_I_IncludeInactives = "0"; } else { Should_I_IncludeInactives = "1"; } GridViewSearch.Columns[15].Visible = true; GridViewSearch.Columns[16].Visible = true; //ClientAge GridViewSearch.Columns[10].Visible = false; //ClientDOB GridViewSearch.Columns[11].Visible = false; List <FBClientsInfo> items; FBClientsController controller = new FBClientsController(); items = controller.FBClients_Search_AFM(this.PortalId, txtLastNameAFM.Text.ToString().Replace("'", "''").Trim(), txtFirstNameAFM.Text.ToString().Replace("'", "''").Trim(), Should_I_IncludeInactives.ToString()); //GridViewSearch.Rows. = null; GridViewSearch.DataSource = items; GridViewSearch.DataBind(); } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
protected void GridViewSearch_PageIndexChanging(object sender, GridViewPageEventArgs e) { try { if (txtFirstNameAFM.Text.ToString() == "" && txtLastNameAFM.Text.ToString() == "") { SearchClients(); } else { SearchClientAFMs(); } GridViewSearch.PageIndex = e.NewPageIndex; GridViewSearch.DataBind(); } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
public void bookslistsearch() { //for data base data type indentification int id; Boolean b = false; try { id = int.Parse(Searchbuttonbooklisttext.Text); //convirt int to string b = true; } catch (Exception expt) { string nametext = Searchbuttonbooklist.Text; } String searchM = ""; if (!b) { searchM = @"select * from booklist where (booklist.Bookname like '%" + Searchbuttonbooklisttext.Text + "%')"; } else if (!b) { searchM = @"select * from booklist where (booklist.Bookwritername like '%" + Searchbuttonbooklisttext.Text + "%')"; } else { Response.Write("Data Not Found!"); } if (booklistsearchobj.ExecuteQuery(searchM) == 1) { GridViewSearch.DataSource = booklistsearchobj.GetDataTable(searchM); GridViewSearch.DataBind(); } else { Response.Write("<script>alert('Wrong String');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string title = Request.QueryString["Title"].ToString(); Web webObj = new Web(); webObj.Title = title; DataTable dt = new DataTable(); dt = webObj.SearchBook(); if (dt.Rows.Count > 0) { GridViewSearch.DataSource = webObj.SearchBook(); GridViewSearch.DataBind(); } else { Response.Write("<script>alert('No Such Book Found');</script>"); } } }
private void bindGV() { GridViewSearch.DataSource = CreateTable(); GridViewSearch.DataBind(); }
protected void ImageButtonSearch_Click(object sender, ImageClickEventArgs e) { GridViewSearch.DataBind(); GridViewSearch.Visible = true; }
protected void GridViewSearchPub_PageIndexChanging(object sender, GridViewPageEventArgs e) { dataBind(); GridViewSearch.PageIndex = e.NewPageIndex; GridViewSearch.DataBind(); }