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. If else condition fails, in VB.net

If else condition fails, in VB.net

Scheduled Pinned Locked Moved ASP.NET
questioncsharphelp
12 Posts 4 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 sudevsu

    Hello Experts, I am wondering if anyone in here can help me understand this simple concept.

    if ddl="abc" and fileuplaod1.HasFile Then
    UploadFile
    Bool=true
    Else if ddl="abc" and FileUpload1.HasFile=false Then
    Alert asking for fileupload
    Bool=false
    Else
    Bool=True

    If Bool=True then
    DataBind to Gridview

    So in here my second condition executes though one of them is false. How can I stop that?

    Your help is much appreciated. Thanks Happy Coding!

    Z Offline
    Z Offline
    ZurdoDev
    wrote on last edited by
    #3

    If you debug it, it should be pretty easy to see what is happening.

    There are only 10 types of people in the world, those who understand binary and those who don't.

    1 Reply Last reply
    0
    • P PIEBALDconsult

      and also ? (Guessing.)

      S Offline
      S Offline
      sudevsu
      wrote on last edited by
      #4

      :thumbsup: Excellent ... Thank you. I thought it will be same as C#. In C# you just say && VB.Net is :doh: Thanks again PiebaldConsult

      Your help is much appreciated. Thanks Happy Coding!

      1 Reply Last reply
      0
      • P PIEBALDconsult

        and also ? (Guessing.)

        S Offline
        S Offline
        sudevsu
        wrote on last edited by
        #5

        I have a linkbutton in Gridview which downloads uploaded file. When I click on download linkbutton, it only downloads the file when all the textboxes above grid are not empty. Ex: txt1 txt2 fileupload Grid after giving values to txt1, txt2 and file uploaded I click on button and Gridview is populated with the values entered which has a Download link button that downloads the attached file. Now when I click on Download if txt1 and txt2 are empty it shows Required field validator asking me to fill those fields. Only after filling it Downloads the file. Do you know why is this weird thing happening?

        Your help is much appreciated. Thanks Happy Coding!

        P V 2 Replies Last reply
        0
        • S sudevsu

          I have a linkbutton in Gridview which downloads uploaded file. When I click on download linkbutton, it only downloads the file when all the textboxes above grid are not empty. Ex: txt1 txt2 fileupload Grid after giving values to txt1, txt2 and file uploaded I click on button and Gridview is populated with the values entered which has a Download link button that downloads the attached file. Now when I click on Download if txt1 and txt2 are empty it shows Required field validator asking me to fill those fields. Only after filling it Downloads the file. Do you know why is this weird thing happening?

          Your help is much appreciated. Thanks Happy Coding!

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #6

          You probably told it to.

          S 1 Reply Last reply
          0
          • P PIEBALDconsult

            You probably told it to.

            S Offline
            S Offline
            sudevsu
            wrote on last edited by
            #7

            Hahaha No I didn't :laugh: .what happened is on Linkbutton I must set Causevalidation=false. This is my guess. But I am not sure.

            Your help is much appreciated. Thanks Happy Coding!

            1 Reply Last reply
            0
            • S sudevsu

              I have a linkbutton in Gridview which downloads uploaded file. When I click on download linkbutton, it only downloads the file when all the textboxes above grid are not empty. Ex: txt1 txt2 fileupload Grid after giving values to txt1, txt2 and file uploaded I click on button and Gridview is populated with the values entered which has a Download link button that downloads the attached file. Now when I click on Download if txt1 and txt2 are empty it shows Required field validator asking me to fill those fields. Only after filling it Downloads the file. Do you know why is this weird thing happening?

              Your help is much appreciated. Thanks Happy Coding!

              V Offline
              V Offline
              Vimalsoft Pty Ltd
              wrote on last edited by
              #8

              i dont use the Vs validation controls, they can be annoying especially in this case where it want to force you to enter something even if you want to do something entirely separate to the problem controls. The way i solve this, is that i ajaxify(Update panels and add Triggers) the control, if you have two controls that are causing a Problem why dont you handle validation manually ?

              Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa[at]dotnetfunda.com http://www.Dotnetfunda.com

              S 1 Reply Last reply
              0
              • V Vimalsoft Pty Ltd

                i dont use the Vs validation controls, they can be annoying especially in this case where it want to force you to enter something even if you want to do something entirely separate to the problem controls. The way i solve this, is that i ajaxify(Update panels and add Triggers) the control, if you have two controls that are causing a Problem why dont you handle validation manually ?

                Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa[at]dotnetfunda.com http://www.Dotnetfunda.com

                S Offline
                S Offline
                sudevsu
                wrote on last edited by
                #9

                I really didn't understand "

                Quote:

                why dont you handle validation manually ?

                Can you explain me how to do it manually?

                Your help is much appreciated. Thanks Happy Coding!

                V 1 Reply Last reply
                0
                • S sudevsu

                  I really didn't understand "

                  Quote:

                  why dont you handle validation manually ?

                  Can you explain me how to do it manually?

                  Your help is much appreciated. Thanks Happy Coding!

                  V Offline
                  V Offline
                  Vimalsoft Pty Ltd
                  wrote on last edited by
                  #10

                  Remove the Validation controls on these controls txt1 txt2 fileupload and trap for things that might go wrong e.g when you trying to add etc... after you remove those validation controls , it will solve your Grid issue.

                  Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa[at]dotnetfunda.com http://www.Dotnetfunda.com

                  S 1 Reply Last reply
                  0
                  • V Vimalsoft Pty Ltd

                    Remove the Validation controls on these controls txt1 txt2 fileupload and trap for things that might go wrong e.g when you trying to add etc... after you remove those validation controls , it will solve your Grid issue.

                    Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa[at]dotnetfunda.com http://www.Dotnetfunda.com

                    S Offline
                    S Offline
                    sudevsu
                    wrote on last edited by
                    #11

                    Thanks but I still did not understand it. I am new to DotNet so this is taking time to understand.

                    Your help is much appreciated. Thanks Happy Coding!

                    V 1 Reply Last reply
                    0
                    • S sudevsu

                      Thanks but I still did not understand it. I am new to DotNet so this is taking time to understand.

                      Your help is much appreciated. Thanks Happy Coding!

                      V Offline
                      V Offline
                      Vimalsoft Pty Ltd
                      wrote on last edited by
                      #12

                      please post your html here and i will fix it here for you

                      Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa[at]dotnetfunda.com http://www.Dotnetfunda.com

                      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