开发者

How do I dynamically populate a gridview based on the selected row of another gridview?

Suppose I have a e-shop web app. I have a product categories table in my database that populates a gridview using sqldatasource.

I want to be able to click on the select hyperlink on a row and use that event to populate ANOTHER gridview based on the ID of the product category that is clicked. E.g say the 'CDs' row is click开发者_开发知识库ed, another gridview shows all the different CDs.

As a result, I need the select(sql) statement for the second table to be dynamic based on what the user clicks.

Has anyone done anything like this before?

Any help would be greatly appreciated,

Mark


It should be very easy. The key is to use SelectedValue of first Gridview to be used as a parameter to the query to populate second gridview.

Here is a sample: Master/Detail GridView

The sample show GV and DetailsView but in your case you replace DV with another GV.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜