Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to set CustomValidor for FileUpload

How to set CustomValidor for FileUpload

Scheduled Pinned Locked Moved ASP.NET
helptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shaik_mr
    wrote on last edited by
    #1

    Hi, My interface is having One, dropdownlist, some text boxes, one fileupload and a submit button.. code here.. Select Category Category1 Category2 Category3 Category4 For file upload code... ------------------------ Code behind =========== protected void validatedrp(object source, ServerValidateEventArgs args) { if (drp_Category.SelectedValue == "Category1") { args.IsValid = true; } else if(drp_Category.SelectedValue == "Category3") { args.IsValid = true; } else if(drp_Category.SelectedValue == "Category2") { args.IsValid = false; } else if(drp_Category.SelectedValue == "Category4") { args.IsValid = false; } } My issue is if i select dropdownlist item Category1 or Category3 and click the submit button, the fileupload should prompt msg as "plz select file to upload"....if i select dropdownlist item Category3 or Categroy4 and click the submit button, the fileupload should not propt msg and should redirect to different page... plz help.. Thanks in advance

    I 1 Reply Last reply
    0
    • S shaik_mr

      Hi, My interface is having One, dropdownlist, some text boxes, one fileupload and a submit button.. code here.. Select Category Category1 Category2 Category3 Category4 For file upload code... ------------------------ Code behind =========== protected void validatedrp(object source, ServerValidateEventArgs args) { if (drp_Category.SelectedValue == "Category1") { args.IsValid = true; } else if(drp_Category.SelectedValue == "Category3") { args.IsValid = true; } else if(drp_Category.SelectedValue == "Category2") { args.IsValid = false; } else if(drp_Category.SelectedValue == "Category4") { args.IsValid = false; } } My issue is if i select dropdownlist item Category1 or Category3 and click the submit button, the fileupload should prompt msg as "plz select file to upload"....if i select dropdownlist item Category3 or Categroy4 and click the submit button, the fileupload should not propt msg and should redirect to different page... plz help.. Thanks in advance

      I Offline
      I Offline
      Ibrahim Bello
      wrote on last edited by
      #2

      Change ControlToValidate attribute of the custom validator from "FileUpload1" to "drp_Category"

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups