Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why creating ds breaks Delete method?
Message
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01343233
Message ID:
01343288
Views:
15
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
Previous
Reply
Map
View

Click here to load this message in the networking platform