Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Validation controls are not working when used server.transfer

Posted on 2011-09-22
10
389 Views
Last Modified: 2012-05-12
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
Comment
Question by:rakhy_rakey
  • 6
  • 3
10 Comments
 

Author Comment

by:rakhy_rakey
ID: 36585060
I think we need to do the server side validation for this klnd of scenario.
0
 
LVL 8

Assisted Solution

by:jagrut_patel
jagrut_patel earned 50 total points
ID: 36585245
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
 
LVL 5

Assisted Solution

by:eridanix
eridanix earned 450 total points
ID: 36585419
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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:rakhy_rakey
ID: 36590529
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
 

Author Comment

by:rakhy_rakey
ID: 36590544
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
 
LVL 5

Assisted Solution

by:eridanix
eridanix earned 450 total points
ID: 36591319
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
 

Author Comment

by:rakhy_rakey
ID: 36592574
It seems like I may need to write serverside validation for this scenario.
0
 
LVL 5

Assisted Solution

by:eridanix
eridanix earned 450 total points
ID: 36592825
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
 

Accepted Solution

by:
rakhy_rakey earned 0 total points
ID: 36952972
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
 

Author Closing Comment

by:rakhy_rakey
ID: 36975504
Finally I am able to get the output by doing the post back
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question