Edit page redirect to itself, but without the ID of the record

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
darkdragon
User
Posts: 148

Edit page redirect to itself, but without the ID of the record

Post by darkdragon »

Hi,

If we're in the Edit page and if I want to do a Form_CustomValidate and I return false, the page redirects to itself but I lose the ID of the item, together with other get params.
We tried to send in a session variable the custom URL and assigned to url in the Page_Redirecting of the Edit Page, but in the end I always get ERR_TOO_MANY_REDIRECTS.

We wwant the Edit page to redirect ot itself but without loosing the ID of the row and the rest of the GET params.

Regards.


darkdragon
User
Posts: 148

Post by darkdragon »

So I figured out, there is an internal function that checks for referer.
It works only if I do NOT return false, but I set a session variable which is checked in Page_Redirecting

if (check for some session var coming from Form_CustomValidate) {
	url = ReferUrl();
}

darkdragon
User
Posts: 148

Post by darkdragon »

Hi,

I need to do a "return false" in Form_CustomValidate (sometimes I do custom validation directly in Row_Inserting or Row_Updating)
In this case, in both Add or Edit pages, and even if the ReferUrl() method returns the page with GET parameters, I am redirected to the pages without them.

I assume that in case the validation fails, where should I look for?
Is the page redirected by the method Terminate(string url = "")?

Regards


darkdragon
User
Posts: 148

Post by darkdragon »

Since I was looking in the wrong place, I'm gonna answer myself once more :)

In the case someone needs to carry over from page to page some GET params, you need to append those params to the action attribute of the form.
Otherwise, if the form fails validation you'll get yourself on the (same) Add or Edit page but without the params.

Here's some code:

// append ?RecordID=  on action attribute of the form
$('form').each(function() {$(this).attr('action', $(this).attr('action') + '?RecordID=' + getParams.RecordID);});

Post Reply