简体   繁体   中英

Asp.Net Ajax Error: Uncaught Sys.WebForms.PageRequestManagerServerErrorException:

I have aspx gridview and i have two buttons that i created from code behind. they are Edit & Update and their commands are 'Edit' &'Update'respectively. when I click Edit Button it enables (Click on the edit button enable number of checkbox in the row) the Update Button too according to the code. Although in reality it doesnt work and it gives an error as follow:

Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request. ScriptResource.axd?d=s633GAD3X_M-LlZYiT3qBN0z6qIwAPEBIp-UIaJwC1RmW46ky4uU_K…FVxRGlhX1aNlsf8k9x5vWwmLMiniFjzCpYiBd1nZ4CsPRcFgOOZfIhN5YF0&t=6119e399:237
Error$create ScriptResource.axd?d=s633GAD3X_M-LlZYiT3qBN0z6qIwAPEBIp-UIaJwC1RmW46ky4uU_K…FVxRGlhX1aNlsf8k9x5vWwmLMiniFjzCpYiBd1nZ4CsPRcFgOOZfIhN5YF0&t=6119e399:237
Sys$WebForms$PageRequestManager$_createPageRequestManagerServerError ScriptResource.axd?d=7CCl932sdoNYgGI8lOxtB8kESr24em-vtPyWNc_v1_wD6b2GgTVWjP…QcN8ofM_7MSrJt5JPbNycIyF7ZMnid435yQKsqw0E4wzsq_yDDUHNjPqpn0&t=6119e399:656
Sys$WebForms$PageRequestManager$_parseDelta ScriptResource.axd?d=7CCl932sdoNYgGI8lOxtB8kESr24em-vtPyWNc_v1_wD6b2GgTVWjP…cN8ofM_7MSrJt5JPbNycIyF7ZMnid435yQKsqw0E4wzsq_yDDUHNjPqpn0&t=6119e399:1534
Sys$WebForms$PageRequestManager$_onFormSubmitCompleted ScriptResource.axd?d=7CCl932sdoNYgGI8lOxtB8kESr24em-vtPyWNc_v1_wD6b2GgTVWjP…cN8ofM_7MSrJt5JPbNycIyF7ZMnid435yQKsqw0E4wzsq_yDDUHNjPqpn0&t=6119e399:1314
(anonymous function) ScriptResource.axd?d=s633GAD3X_M-LlZYiT3qBN0z6qIwAPEBIp-UIaJwC1RmW46ky4uU_K…RFVxRGlhX1aNlsf8k9x5vWwmLMiniFjzCpYiBd1nZ4CsPRcFgOOZfIhN5YF0&t=6119e399:47
(anonymous function) ScriptResource.axd?d=s633GAD3X_M-LlZYiT3qBN0z6qIwAPEBIp-UIaJwC1RmW46ky4uU_K…VxRGlhX1aNlsf8k9x5vWwmLMiniFjzCpYiBd1nZ4CsPRcFgOOZfIhN5YF0&t=6119e399:3484
Sys$Net$WebRequest$completed ScriptResource.axd?d=s633GAD3X_M-LlZYiT3qBN0z6qIwAPEBIp-UIaJwC1RmW46ky4uU_K…VxRGlhX1aNlsf8k9x5vWwmLMiniFjzCpYiBd1nZ4CsPRcFgOOZfIhN5YF0&t=6119e399:6373
Sys$Net$XMLHttpExecutor._onReadyStateChange ScriptResource.axd?d=s633GAD3X_M-LlZYiT3qBN0z6qIwAPEBIp-UIaJwC1RmW46ky4uU_K…VxRGlhX1aNlsf8k9x5vWwmLMiniFjzCpYiBd1nZ4CsPRcFgOOZfIhN5YF0&t=6119e399:5993

what Should Be the Problem and How do i Solve it?

two buttons

 Dim btn2 As New Button()
            btn2.ID = "btn2"
            btn2.Width = "50"
            btn2.Text = "Update"
            btn2.CssClass = "AdminPageBtn"
            btn2.CommandName = "Update"
            btn2.CommandArgument = "Update"
            btn2.Enabled = True

            'If (nMonth >= intCurrentMonth) And (nYear = intCurrentYear) Then
            '    btn2.Enabled = True
            'End If

            e.Row.Cells(e.Row.Cells.Count - 1).Controls.Add(btn2)

            Dim btn1 As New Button()
            btn1.ID = "btn1"
            btn1.Width = "50"
            btn1.Text = "Edit"
            btn1.CssClass = "AdminPageBtn"
            btn1.CommandName = "Edit"
            btn1.CommandArgument = "Edit"
            btn1.Enabled = True


    e.Row.Cells(e.Row.Cells.Count - 1).Controls.Add(btn1)

Problem causes from EDIT button : assumption

甚至我都面临着同一问题,只是评论了“更新面板”并且工作完美。

In the End I could not do anything, So i have taken out Edit Button. It works now perfectly..! Edit Button Needs Full Post Back

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM