Click here to Skip to main content
15,889,839 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Friends

I am having some problem in implementing search in my project...
I am having search textbox on master page and in my project there is a Product category page so, the problem is on my Product category page there is repeater control then when i click search button (On Master Page) then i get the list of items in master page but the problem is how to assign that item list to my repaeter control which is in Product category page...

my code is

Master Page

C#
protected void SearchBtn_Click(object sender, ImageClickEventArgs e)
  {
      ShoppingCartLib.Catalog search = new ShoppingCartLib.Catalog();
      search.GeneralSearch(searchtxt.Text);

  }


////////////////////////////////////

public sc_Item[] GeneralSearch(string searchtext)
{
    sc_Item[] searchitems = null;
    if (!string.IsNullOrEmpty(searchtext))
    {
 searchitems = db.sc_Item.Where(s => s.Discription.ToLower().Contains(searchtext.ToLower()) || s.Composition.ToLower().Contains(searchtext.ToLower()) || s.ItemName.ToLower().Contains(searchtext.ToLower())||s.Symptomology.ToLower().Contains(searchtext.ToLower())).ToArray<sc_Item>();
            }
return searchitems;
      }

///////////////////////////////////////

Product category page

C#
protected void Page_Load(object sender, EventArgs e)
   {      
           ProductList It is my repeater control

   }



Please give me solution for this ..as soon as posible..

Thanks in advance..
Posted

 
Share this answer
 
Hi
i have implemented this solution using below code
we have called click event of masterpage button in other page which is inhireted from master page
i checked it is working

Master Page Code
XML
<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
   <asp:Button ID="btnSubmit" runat="server" Text="Search" />

       <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

       </asp:ContentPlaceHolder>



and in inherit page code is as below

protected void Page_Load(object sender, EventArgs e)
       {
           (this.Master.FindControl("btnSubmit") as Button).Click += new EventHandler(WebForm2_Click);
       }

       void WebForm2_Click(object sender, EventArgs e)
       {
           BindUserDetails();//your logic comes here
       }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900