本文介绍了如何在子页面中显示搜索项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 亲爱的朋友们 我在项目中实施搜索时遇到了一些问题... 我正在搜索母版页上的文本框和我的项目中有一个产品类别页面所以,问题出现在我的产品类别页面上有转发器控件然后当我点击搜索按钮(在主页面上)然后我得到母版页中的项目列表,但问题是如何将该项目列表分配给我的维修者控件,该控件位于产品类别页面中... 我的代码是 主页 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()。包含(searchtext.ToLower())|| s.ItemName.ToLower()。包含(searchtext.ToLower())|| s.Symptomology.ToLower()。包含(searchtext) 。.ToLower()))&ToArray的LT; sc_Item>(); } 返回搜索项目; } //////////////////////////////// ///////// 产品类别页面 受保护 void Page_Load( object sender,EventArgs e) { ProductList 它 我的转发器控件 } 请尽快给我解决方案.. 。 提前致谢.. 解决方案 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 isMaster Pageprotected 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 pageprotected 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.. 解决方案 这篇关于如何在子页面中显示搜索项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-15 09:00