The reason for this is that later this new DS is assigned to GridView DataSource.
So, my question is - how to keep the same datasource for the GridView always, but be able to refresh the DataTable information if I need to?
Thanks in advance.
>Hi everybody,
>
>I have a GridView on a page. If I add the following code:
>
>
> protected void ProfilesGrid_RowDataBound(object sender, GridViewRowEventArgs e)
> {
> if (!IsPostBack && e.Row.RowType == DataControlRowType.DataRow)
> {
> //We need to save dataset in a session variable
> System.Data.DataView dv = (e.Row.DataItem as System.Data.DataRowView).DataView;
>
> System.Data.DataTable dt = dv.ToTable();
> DataSet ds = new DataSet();
> ds.Tables.Add(dt);
> Session.Add("dts", ds);
> }
>
>
>I'm getting the following error:
>=========================================================
>Server Error in '/my' Application.
>--------------------------------------------------------------------------------
>
>The GridView 'ProfilesGrid' fired event RowDeleting which wasn't handled.
>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
>
>Exception Details: System.Web.HttpException: The GridView 'ProfilesGrid' fired event RowDeleting which wasn't handled.
>
>Source Error:
>
>etc.
>
>If I comment this code, the Delete functionality works correctly handled only in RowDeleted method.
>
>Why adding this code breaks the Delete functionality and how can I fix it?
>
>Thanks a lot in advance.
If it's not broken, fix it until it is.
My Blog