Hi Omer,
You needs to follow the following steps,
1) Create a ViewState property which will held Ids of all the CustomersId (Let say we are showing data from customer table and
CustomerId is the PK) whose corresponding chechbox we have checked.
public string Ids
{
get { return ViewState["Ids"] != null ? ViewState["Ids"].ToString() : string.Empty; }
set { ViewState["Ids"] = value; }
}
2) Now on every page change loop through the grid and get all the selected CustomersId in the Property Ids,
as Ids += ,// then append your selected Id.
I mean finally you shoud ended with something like "Ids = 1,2,4,6,10,11" where 1,2,4,6,10,11 are the CustomerIds of the selected
rows, It will differ case to case.
3) Now You have to create a new stored Procedure as you are using for populating the grid but with two changes.
1)Remove paging logic. - I mean it would be without paging
2)In your where condition add more condition "AND CustomerId = @Ids" where @Ids is list of CustomerIds supplied by the property Ids.
4) On Export Click bind the grid by Stored Procedure I suggested in step (3) and then Implement the logic to Export and then again bind
your Grid with the Custom paging Stored procedure again.
Thanks and Regards,
Rk_Hirpara