2
Answers

Cannot implicitly convert type 'System.Data.DataSet' to 'Sys

Photo of Rp Singh

Rp Singh

8y
265
1
Hi,
 
I am getting this error while sorting a aspx grid.
 
 
 
 Please help me how to resolve ?
 
Thanks,
Raghav 
 

Answers (2)

2
Photo of Amit Kumar
NA 3.5k 203.7k 8y
Hi Dear,
             You hold dataset into ViewState ["Paging"]  but you type cast into datatable due to this reason it is incorrect.
 
Solution:
First convert into DataSet after that DataTable. 
code like .
 
DataSet ds=(DataSet) ViewState ["Paging"];
DataTable dtsort=ds.Tables[0];
Accepted
0
Photo of sudipta sanyal
NA 934 3.8k 8y
Hi
 
Please assign the Viewstate directly  to Datatable Like  
 
DataTable dt =(DataTable)ViewState["Paging"];