为不同的查询填充相同的GridView [英] filling same gridview for different queries

查看:43
本文介绍了为不同的查询填充相同的GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从主页获取productids.

然后在productcatalog.aspx页上的这些productids的基础上填充网格.

I am getting the productids from main page.

And then filling the grid on the bases of these productids on productcatalog.aspx page.

like..query = "Select * from Products where ProductID in ('" + Request.QueryString["ID"].ToString().Substring(1) +"') AND UnitCost < 5000";


我在首页上有一个链接,例如<5000即(上面的查询适用于此),并且我还有更多的链接,例如在5000和10000之间以及> 10000之间.

如何修改代码以在同一页面上执行后两个代码.

我不想为两个额外的页面制作两个,以在5000和10000以及> 10000中显示所需的网格产品.

我想在同一页面上显示它们.

我必须采取什么方法.


I have a links on mainpage e.g <5000 i.e ( for which above query works) and i have more links e.g between 5000 and 10000 and >10000.

How can I amend the code to work with the same page to execute the last two.

I don''t want to make two extra pages for two show the desired products in grid for 5000 and 10000 and >10000.

I want to show them on same page.

What approach I have to made.

推荐答案

public void less()
{
/* write the block of code you use for loading data in grid view */
"Select * from Products where ProductID in ('" + Request.QueryString["ID"].ToString().Substring(1) +"') AND UnitCost <5000;
}


现在,当单击值小于5000的链接时,上述方法就是调用less();.

以类似的方式为不同的链接创建不同的方法.
并在每种方法中使用相同的datagridview,因此您的数据将显示在同一gridview上.
并在加载下一个链接之前清除datagridview

--theanil


now when ever the link with value less than 5000 is clicked, the above method is to Called less();

in similar way create different methods for different links.
and use the same datagridview in each method, so your data will be shown on same gridview.
and clear datagridview before loading the next link

--theanil


这篇关于为不同的查询填充相同的GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆