.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

grid view

Posted By: dharanya     Posted Date: January 27, 2009    Points:2   Category :ASP.Net
If i click multiple checkboxes in a gridview the checked items alone should navigate to another form and it should be viewed in the grid view in that form

Responses
Author: Praveen             
Posted Date: January 27, 2009     Points: 5   

HI,
You can do like this

Step 1) Get all the checked items GridView and assign to a datatable

eg

DataTable dt = new DataTable();
foreach (GridViewRow row in grdView.Rows)
{
//get the index of the current CheckBox
chkBoxIndex = (string)grdView.DataKeys[row.RowIndex].Value.ToString();
chk = (CheckBox)row.FindControl(ctrl);
if (chk.Checked)
{
dt.ImportRow(row);
}
}


Step 2) Assign this DataTable to session Variable


Session["DT"] = dt ;


Step 3) Type cast this session variable to datatable in another page and bind this DataTable to Another GridView.

Eg

If(Session["DT"] !=null)
{
DataTable dt = (DataTable) Session["DT"];
GridView1.DataSource = dt;
GridView1.DataBind();
}


Happy Coding!!!
Praveen



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend