Asp.Net News
Free Tech Magazines
Asp.Net Web Hosting
Suggest Us
Link to Us
Feeds Subscription
Questions & Answers
Tips & Tricks
 How to display selected item on web page on Gridview
Posted by RAJESH KUMAR VISHWAKARMA on  12/1/2009 3:47:51 AM Category: Asp.Net 2.0
Add to my favorites
Email to friend
Plz read carefully

i am having one Gridview on page, it has 4 colums.
Now Data is being retrived on this gridview from Price Table, Sql2000.

Now when i select radio button of particular row, It should be display on new web page on Gridview. on Button_Click

Could You Plz help me

Thank You!

Post Your Reply Post New Question

 Viewer's Reply
Show information of GridView selected row in next page
Answered By Moderator1 on 12/2/2009 7:45:13 PM

You have a GridView with 1 Radio Button column. When you select a radio button in the GridView and click a Button outside the GridView control. Then you need to show the information in next page in gridview control. I will give you the pseudo code, please make the code and again post it under this question, it may help others.

First set the DataKeyNames property with Unique Primary Key column. For eg. in our case "CustomerId"

In the Button click event,
foreach(GridViewRow gvr in GridView1.Rows)
RadioButton rb = (RadioButton)gvr.FindControl("rb");
if (rb.Checked)
string cusid = GridView1.DataKeys[gvr.RowIndex]["CustomerId"].ToString();

In NextPage.aspx, you can get the cusid as query string, use it to bind the gridview in that page.
Post Your Reply If you still have problem, post it again under this reply for better response.

Sponsored by
Sexy Web Design - Free 71 Page Preview!
When Good HTML Goes Bad: How You Can Protect Your Web Applications
Building a Web Application Security Program