AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
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!
Regards
R.k.vishwa








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
Hi,

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();
Response.Redirect("NextPage.aspx?id="+cusid);
}
}

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
Washington Technology
When Good HTML Goes Bad: How You Can Protect Your Web Applications
Everything You Know About CSS Is Wrong! - Free 37 Page Preview!