Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

web-pages use validation in helper class

Posted on 2015-02-08
1
Medium Priority
?
76 Views
Last Modified: 2015-02-09
Hi.

How can I use the validation functions in a helper class?
This one gives an error. Can I import something?
It dosen´t work with: @using System.Web.Helpers.Validation

@helper create() {
      Validation.RequireField("navn", "\"Navn\" skal udfyldes");
        if (IsPost && Validation.IsValid())
      {
            Response.Write("TEST");
      }
}

I´m using c# web-pages.
0
Comment
Question by:bongii
1 Comment
 
LVL 16

Accepted Solution

by:
Easwaran Paramasivam earned 1000 total points
ID: 40598101
Instead you could check particular control has value or not like given below:

navn.Text == string.Empty
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

782 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