This is a migrated thread and some comments may be shown as answers.

Refresh Grid with out binding

1 Answer 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pat
Top achievements
Rank 1
Pat asked on 07 Nov 2011, 03:38 PM
I have run into a problem where I am doing a databind and it causes invalid postback errors in the system events log.  I am doing the rebind to change the appearance of the grid. i.e. turn of sort, display on line in grid not 20, hide a couple columns etc..   I am not changing the underlying data that has been selected.   Calling the databind sometime causes errors. Is there a way to refresh the appearance of the grid without using the databind?

RadGrid1.AllowSorting = false;                      // Turn off column sorting when in Display mode
RadGrid1.Columns[c1ASelectFile].Visible = false;    // Hide "Select View" Column
RadGrid1.Columns[c1APrintFile].Visible = false;     // Hide "Print" Column
RadGrid1.ClientSettings.Resizing.AllowColumnResize = false;
RadGrid1.ClientSettings.Resizing.ResizeGridOnColumnResize = false;
RadGrid1.ClientSettings.Resizing.ClipCellContentOnResize = false;
RadGrid1.ClientSettings.AllowColumnsReorder = false;
 
RadGrid1.CurrentPageIndex = iRecord;                // Set document to display
RadGrid1.PageSize = 1;                              // Set to one record per page when displaying document
RadGrid1.DataBind();

Event error being generated.

Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 10/31/2011 3:43:14 PM
Event time (UTC): 10/31/2011 10:43:14 PM
Event ID: e83be8bc2dcb4fac96c0f6d752826fe9
Event sequence: 2063
Event occurrence: 5
Event detail code: 0
  
Application information:
    Application domain: /LM/W3SVC/1/Root/SpeechRecords-1-129645654292996087
    Trust level: Full
    Application Virtual Path: /SpeechRecords
    Application Path: C:\WebSite\SpeechRecords\
    Machine name: SVRTEONLINE
  
Process information:
    Process ID: 97572
    Process name: w3wp.exe
    Account name: NT AUTHORITY\NETWORK SERVICE
  
Exception information:
    Exception type: ArgumentException
    Exception message: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
  
Request information:
    Request path: /SpeechRecords/Records.aspx
    User host address: 192.168.1.131
    User: 
    Is authenticated: False
    Authentication Type: 
    Thread account name: NT AUTHORITY\NETWORK SERVICE
  
Thread information:
    Thread ID: 1
    Thread account name: NT AUTHORITY\NETWORK SERVICE
    Is impersonating: False
    Stack trace:    at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument)
   at System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument)
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  
  
Custom event details:
 
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 07 Nov 2011, 05:00 PM
Hello Pat,

When you are using any advanced feature in grid like filtering, sorting, paging etc. then RadGrid requires advanced data-binding through its NeedDataSource event . You can refer to the demo linked below for more information:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/needdatasource/defaultcs.aspx

Give it a try and let me know if it helps to avoid this error.

Regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Pat
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or