开发者

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

开发者 https://www.devze.com 2023-02-05 06:46 出处:网络
Suppose I have a e-shop web app. I have a product categories table in my database that populates a gridview using sqldatasource.

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

精彩评论

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

关注公众号