www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > .NET

    .NET Discussion and technical support for, building, using and deploying .NET sites.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 11-03-2009, 02:54 PM
    asifakhtar asifakhtar is offline
    Registered User
     
    Join Date: Feb 2009
    Posts: 17
    I need a recommendation on how to do the validation in this case without postback

    Hi Every 1,
    I have a Create/Delete Users and Roles aspx form with C#.

    I want the form to validate whether the user had any opened tickets in the past before deleting that user. If the user has any opened tickets then the deletion is not permitted. I want client side validation for this purpose without postback.

    Just to update you on this, my form will get the user opened tickets information from SQL SERVER Database (I know how to do this.).

    I need a recommendation on how to do the validation in this case without postback(I want the form to validate whether the user had any opened tickets in the past before deleting that user. I want client side validation for this purpose).

    Thanks
    Reply With Quote
      #2  
    Old 11-03-2009, 06:55 PM
    javawebdog's Avatar
    javawebdog javawebdog is offline
    Registered Golf Nut
     
    Join Date: Nov 2008
    Location: Akron, OH
    Posts: 210
    Question: Have they logged on somewhere earlier? Is their identity being carried throughout as a session variable?

    It sounds like you are also delivering, or have compiled, a list of open tickets when the form is presented. If they do have open tickets, set a boolean session variable (token) that can be used instantiate a local script variable which in turn is used to disallow user deletion.

    This part could be done by either dynamically disallowing the deletion function using vbscript or javascript via an onSubmit="return <some fx name>()". If the onSubmit fx returns false, then deletion can be blocked by not processing the form and notifying the user why deletion is not permitted at this time.

    Alternatively, if you have the token at the beginning of form generation, why not use it to prevent the functionality or function trigger (button or selection) for deletion from being presented at all.
    __________________
    javawebdog
    Two things to remember:
    "The only place success comes before work is in the dictionary."
    "It's more than just a matter of survival. It's a matter of sympathy, compassion, passion and style."

    Last edited by javawebdog; 11-03-2009 at 07:04 PM.
    Reply With Quote
      #3  
    Old 11-03-2009, 07:15 PM
    ssystems ssystems is offline
    Registered User
     
    Join Date: Oct 2009
    Posts: 246
    No need to store it on the sessions as you don't need to pass it across pages much more to the server. Still using sessions or viewstates really depends on how you'll use it or you can just use any public variable.

    Code Behind:

    Code:
    protected Boolean MyLockedToken { get; set; } // Or utilize viewstate
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
          YourMethods();
    }
    
    protected void YourMethods()
    {
        MyLockedToken = true;
    }
    Then on the client side

    Code:
    function MyValidate(){
        if(<%= MyLockedToken %>)
          blah_blah();
    }
    Just check my syntax.
    __________________
    Good Luck

    Santos Systems
    Reply With Quote
      #4  
    Old 11-03-2009, 07:28 PM
    javawebdog's Avatar
    javawebdog javawebdog is offline
    Registered Golf Nut
     
    Join Date: Nov 2008
    Location: Akron, OH
    Posts: 210
    The reason I chose session variable (you're right you could use a page variable as easily) was in case the original inquiry to get the information was on one page and the form was being delivered on a second page. And if denying a user some functionality it may be needed later on yet another page (some sort of advisory notice). Since the choice of the session var is a boolean the expense is very low.

    You know the old saw, 'Better to have and not need it, then need and not have it.'
    __________________
    javawebdog
    Two things to remember:
    "The only place success comes before work is in the dictionary."
    "It's more than just a matter of survival. It's a matter of sympathy, compassion, passion and style."
    Reply With Quote
      #5  
    Old 11-03-2009, 10:16 PM
    ssystems ssystems is offline
    Registered User
     
    Join Date: Oct 2009
    Posts: 246
    Fair enough. Either way the implementation should be just similar to what I posted earlier.

    Code:
    private Boolean _MyLockedToken;
    protected Boolean MyLockedToken
    {
        get
        {
            if(_MyLockedToken == null)
            {
                try
                {
                    _MyLockedToken = (Boolean) Session[SESSION_KEY];
                }
                catch(Exception exc)
                {
                     // Your exception handling
                }
            }
            return _MyLockedToken;
        }
        set
        {
             Session[SESSION_KEY] = value;
             _MyLockedToken = value;
        }
    }
    __________________
    Good Luck

    Santos Systems
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 05:21 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.