hi..have a grid view with chkbox column and sme other columns ,whn i clk on the submit btn the page redirectsto next page and in the new page load i need a grid view of previous page but only with the items i checked and some extra columns ...how to acheive
this>>,,any links wud be helpful,thanku
hi...in that snippet,the grid view is in the same page ..my req: is like want a grid view in second page's page load with checked data in first page's grid view ...are there any such links ?? thanku
the data table in the first page consists of all the items of the gridview(rather opposite :)) but i want only the checked items of the gridview to be passed onto the next page..so am planning to store the chked values into another datatable and pass that
datatable as session into next page??
now the pbm: is how to store gridview's checked items into datatable...had ckbox filed as one of the colums ..thanku
durgamavu
Member
56 Points
59 Posts
how to store gridview's checked items into datatable...had chkbox field as one of the columns
Mar 23, 2011 10:46 AM|LINK
hi..have a grid view with chkbox column and sme other columns ,whn i clk on the submit btn the page redirectsto next page and in the new page load i need a grid view of previous page but only with the items i checked and some extra columns ...how to acheive this>>,,any links wud be helpful,thanku
sarathi125
Star
13599 Points
2691 Posts
Re: how to store gridview's checked items into datatable...had chkbox field as one of the columns...
Mar 23, 2011 10:57 AM|LINK
Hi,
Try this
http://www.aspsnippets.com/Articles/Transfer-Selected-Rows-from-one-GridView-to-Another-in-Asp.net.aspx
Remember to click Mark as Answer on the post that helps to others.
My Blog :MyAspSnippets
durgamavu
Member
56 Points
59 Posts
Re: how to store gridview's checked items into datatable...had chkbox field as one of the columns...
Mar 23, 2011 12:18 PM|LINK
hi...in that snippet,the grid view is in the same page ..my req: is like want a grid view in second page's page load with checked data in first page's grid view ...are there any such links ?? thanku
sarathi125
Star
13599 Points
2691 Posts
Re: how to store gridview's checked items into datatable...had chkbox field as one of the columns...
Mar 23, 2011 12:24 PM|LINK
Hi,
You can use the same method just pass the datatable with session to another page
and bind the gridview there, in the second page.
Remember to click Mark as Answer on the post that helps to others.
My Blog :MyAspSnippets
durgamavu
Member
56 Points
59 Posts
Re: how to store gridview's checked items into datatable...had chkbox field as one of the columns...
Mar 23, 2011 12:54 PM|LINK
the data table in the first page consists of all the items of the gridview(rather opposite :)) but i want only the checked items of the gridview to be passed onto the next page..so am planning to store the chked values into another datatable and pass that datatable as session into next page??
now the pbm: is how to store gridview's checked items into datatable...had ckbox filed as one of the colums ..thanku
sarathi125
Star
13599 Points
2691 Posts
Re: how to store gridview's checked items into datatable...had chkbox field as one of the columns...
Mar 23, 2011 01:08 PM|LINK
Hi,
Try something like this
DataTable dt = new DataTable();
dt.Columns.Add("ID");
DataRow dataRow;
foreach (GridViewRow di in GV_NewUser.Rows)
{
CheckBox chk = (CheckBox)di.FindControl("AddUsers");
if (chk != null && chk.Checked)
{
dataRow = dt.NewRow();
dataRow["ID"] = di.Cells[0].Text;
dt.Rows.Add(dataRow);
}
}
Remember to click Mark as Answer on the post that helps to others.
My Blog :MyAspSnippets
durgamavu
Member
56 Points
59 Posts
Re: how to store gridview's checked items into datatable...had chkbox field as one of the columns...
Mar 23, 2011 01:20 PM|LINK
this is wrking fine..except that dta is not coming into data table ..only the number of rows chked are coming ...
i kept a chk gridview and gave the datasource as new datatable which was created by above logic,thn the grid view is displaying cells with empty data
sarathi125
Star
13599 Points
2691 Posts
Re: how to store gridview's checked items into datatable...had chkbox field as one of the columns...
Mar 23, 2011 01:31 PM|LINK
Hi,
In this line do you have any data
dataRow["ID"] = di.Cells[0].Text;
if you have any data then make like that for all the cells for each row
then the new datatable will be loaded....
Remember to click Mark as Answer on the post that helps to others.
My Blog :MyAspSnippets
durgamavu
Member
56 Points
59 Posts
Re: how to store gridview's checked items into datatable...had chkbox field as one of the columns...
Mar 23, 2011 01:32 PM|LINK
hi sarathi..i made cells[0] as cells[1] ..its wrking fine nw..thanks a lot ...u saved my day :)
jrajni
Member
2 Points
1 Post
Re: how to store gridview's checked items into datatable...had chkbox field as one of the columns...
Sep 09, 2012 10:45 AM|LINK
thanks !! saved my day.......