locked
How to create Search_btn in Masterpage without Gridview RRS feed

  • Question

  • User1984192403 posted

    Hello,

    Im trying to create Textbox and button for Search in my Masterpage between my MenuList. 

    When i clicked my Search_button its takes me to the masterPage.aspx.cs and then there I have this code under 

    Response.Redirect("Find.aspx")...

    So I have create my Design (textbox and button) in my masterpage.. 

    And when I create a dataGrid in masterpage then my MenuList i changes. How can I write code without dataGrid?

    Like then I search Username and clicked search button on my masterpage it will show users in my contentpage?

    In Find.aspx.cs there is a that line shows

    protected void Page_load(object sender, EventArgs e)

    {

    ??//I have no idea

    }

    thanks 

    Monday, July 28, 2014 11:19 AM

Answers

  • User697462465 posted

    Hi Anushik,

    If you want to transfer value to next page, and then filter value based on this value, please try to refer to the following code:

    protected void button_Click(object sender, EventArgs e){
     Reponse.Redirect("Find.aspx?Search="+SearchTextBox.Text);
    }

    And then get this search value in find page:

    protected void Page_Load(object sender, EventArgs e){
       string search = Request.QueryString["Search"];
       // now filter result based on the search value...
    }

    If my understanding is incorrectly, please post some of your master page and find page code here.

    Best Regards,
    Terry Guo

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 29, 2014 10:52 PM

All replies

  • User-1716253493 posted
    Response.Redirect("Find.aspx?search=" + UrlEncode(TextBox1.Text)); Now you can set TxtSearch.Text = Request.QueryString["search"] in not IsPostBack page_load event
    Monday, July 28, 2014 12:49 PM
  • User1984192403 posted

    thank you very much i will try 

    Monday, July 28, 2014 3:43 PM
  • User1984192403 posted

    nopp, its doesn't work or I can't S::S:S:S

    Monday, July 28, 2014 6:09 PM
  • User697462465 posted

    Hi Anushik,

    If you want to transfer value to next page, and then filter value based on this value, please try to refer to the following code:

    protected void button_Click(object sender, EventArgs e){
     Reponse.Redirect("Find.aspx?Search="+SearchTextBox.Text);
    }

    And then get this search value in find page:

    protected void Page_Load(object sender, EventArgs e){
       string search = Request.QueryString["Search"];
       // now filter result based on the search value...
    }

    If my understanding is incorrectly, please post some of your master page and find page code here.

    Best Regards,
    Terry Guo

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 29, 2014 10:52 PM
  • User1984192403 posted

    Thank you very much:) Terry it's worksWink

    Wednesday, July 30, 2014 4:28 AM