• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 424
  • Last Modified:

Validation controls are not working when used server.transfer

Hi Guys...

I have 2 pages.

when I run page 1 directly, my validation controls on the page are working. But when I came from other page using server.transfer, my validation controls are working. I had to refresh the page to make them work.

What might be the reason ?

Thanks,
Rakhy.
0
rakhy_rakey
Asked:
rakhy_rakey
  • 6
  • 3
5 Solutions
 
rakhy_rakeyAuthor Commented:
I think we need to do the server side validation for this klnd of scenario.
0
 
jagrut_patelCommented:
I'm not sure how Server.Transfer could cause Validation controls to fail.

However, if your app. requirements permits, can you try using Response.Redirect instead of Server.Transfer.
0
 
eridanixCommented:
Hi,

try to use Server.Transfer with parameter preserveForm.

More info in this article:
http://www.developer.com/net/asp/article.php/3299641/ServerTransfer-Vs-ResponseRedirect.htm

Exactly the explanation from article is in here:
The Server.Transfer method also has a second parameter—"preserveForm". If you set this to True, using a statement such as Server.Transfer("WebForm2.aspx", True), the existing query string and any form variables will still be available to the page you are transferring to.
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
rakhy_rakeyAuthor Commented:
Hi jagut..

Thanks for the reply. I tried using response.redirect . But still the same. My client side validation controls are not working. But when I refresh the page. Then they are working again.

Don't know what the problem is ...
0
 
rakhy_rakeyAuthor Commented:
Hi eridqnix...

I am able to get the form variables to the transferred page. But my validation controls are not working on the transferred page. But when I refresh it, then they are working fine with out any problem.

Thanks,
Rangy.
0
 
eridanixCommented:
Aha, so I mean problem is, that there is nothing to validate on the transferred page, because validators works only on postback or partial postback.

The solution is to do validation on source page and on transferred page view only results of validation.

Another solution is to use javascript (client side) validation on transferred page. But finally you have to contol values of variables on server side before saving to database for example.
0
 
rakhy_rakeyAuthor Commented:
It seems like I may need to write serverside validation for this scenario.
0
 
eridanixCommented:
Finally you have to write serverside validation every time before data saving, because clientside validation can be easily breaked through.

The clientside validation is for user confort and for sparing server capacity.
0
 
rakhy_rakeyAuthor Commented:
Hi Eradanix....

Thanks for the reply. I got the output for this one even with out writing the server side validation.

The solution for my problem is:

I invoked the CheckboxSelectedIndexChanged method when a particular member is selected, instead of directly displaying the displaying the details.

It caused the page to post back which in turn activated the client side controls.

thank you all for the reposnse.

Thanks,
Rakhy.
0
 
rakhy_rakeyAuthor Commented:
Finally I am able to get the output by doing the post back
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now