CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

RenderRegionAsync not allowed

General discussion

by etwoss » 14 May 2014 13:42

Hi

When a form is normally openend, its going through its create and then (by the caller) a method is called, and all works fine:

Code: Select all
 TIWFormDashboardManagerProfile(ShowForm(fDashboardManagerProfile.TIWFormDashboardManagerProfile)).LoadManager(UserID, Currency);


Now we also work with Handlers , a person gets a email with a link and the on the link we have servercontroller code do:

Code: Select all
 with THandlers.Add('/tokenizem/','', TContentForm.Create(TIWFormDashboardManagerProfile)) do
 begin
   CanStartSession := True;
   RequiresSessionStart := True;
 end;


In the create of the form i have a procedure DotokenLogin

Code: Select all
procedure TIWFormDashboardManagerProfile.DotokenLogin;
var
  Token: String;
  TokenPos: Integer;
begin
//  Token :=  WebApplication.RunParams.Text; //werkt niet meer na upgrade
  Token :=  WebApplication.Request.Query;
  TokenPos := Pos('Token=', Token);
  if (TokenPos > 0) then
  begin
    Token := Trim(Copy(Token, TokenPos + 6, 32));
    if (Length(Token) = 32) and  UserSession.IMSession.LoginWithToken(Token) then
    begin
      UserSession.IMSession.UserType := wutCostCentreManager;

      LoadManager(UserSession.IMSession.UserID, UserSession.IMSession.Currency);
      FrameChat.LoadUserTasks;

    end;
  end;
end;


The problem comes with the LoadManager method who wants to reload grids and ajaxrerender some comboxBox .
This is where i got the error "Method "RenderRegionAsync"its only allowed in AjaxProcessing"
When LoadManager method is called after the create , as done in normal processing of the form, all is ok


How to handle these kind of cases?

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Jorge Sousa » 14 May 2014 14:46

Hi

The create of a form is already called in a full submit post, so there is no point to call ajax render methods, to perform ajax local updates.

Also you can check CGIsCallbackProcessing in unit IWCGJQCommon
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by etwoss » 14 May 2014 15:17

Hi

if i understand, in the formCreate or any method called in the formCreate it does not make sense to call Ajaxrerender or Grid.ReloadGrid , right?

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Jorge Sousa » 14 May 2014 15:19

yep
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by etwoss » 15 May 2014 08:24

Hi

Ok, trying to understand this mechanism better

Look at the image, when the dropdown (Approval request of) value changes 3 grids needs to refresh, the upper one and one on both tabs.
As also the username in the middle. (lblUserName.Text := OrderRoutepoint.RequestorDesc;)

So now testing everywhere:

Code: Select all
  IsAjax := CGIsCallbackProcessing;

  fill grid

  if (not IsAjax) then
      GridVendorTerminals.JQGridOptions.ReloadGrid;



What is see ?

When the form is first created all goes well, the grids and username are all filled with the correct data.

Now i change the value of the combobox, in all my methods "CGIsCallbackProcessing" is true so no reload of the grids anymore, so the grids don't show the proper data, just the lblusername is changed.

I understand that probably the only part being refreshed by the chnage event is the dropdown itself. Setting of the lblusername.text value will also cause an update. But without the reload of the grids the grids will not.

So there is a difference between the situation when creating the form and when changing value of the dropdown.

In the first case grid reload is not necessary in the other its is.

How can i detect the difference between these two situation?


Eric
You do not have the required permissions to view the files attached to this post.
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Jorge Sousa » 15 May 2014 09:47

Hi

You don't need to reload the grid if is not ajax

if (not IsAjax) then
GridVendorTerminals.JQGridOptions.ReloadGrid;
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by etwoss » 15 May 2014 09:50

Ok, but this means that even in a full submit the reload is called, right?
and if so , this is with a full submit not really necessary , right?

And if NOT isAjax it means Full Submit?

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Jorge Sousa » 15 May 2014 10:20

Hi

Ok, but this means that even in a full submit the reload is called, right?

and if so , this is with a full submit not really necessary , right?


Correct, if JQGridOptions.DataType=gdtXML (default value)

And if NOT isAjax it means Full Submit?


Yes
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to General - Archive

Who is online

Users browsing this forum: No registered users and 2 guests

Contact Us.