www.webdeveloper.com
Results 1 to 2 of 2

Thread: Disable the submit button

  1. #1
    Join Date
    Jun 2004
    Posts
    24

    Disable the submit button

    How do i go about disabling the submit button in ASP.net. I have an If Else statement, and I want the Submit button to be disabled upon the else command. Heres some code that should help you help me!

    Code:
    Sub Page_Load(sender As Object, e As EventArgs)
    	Dim rightNow as DateTime = DateTime.Now
    
    	If day(RightNow) > 14 Then 
    
     		lbl_error.text = "You are not able to transfer accounts after the 25th of the month. 
    
    Please try again next month."
    	
    	else
    		cmdInsert.enable = false
     		lbl_error.text = "Welcome to the Account Transfers Page. Please select an account and the 
    
    respective 	territories."
                Dim sql as string
                 if not Page.IsPostBack then
                     sql =  "select AccountID + ' - ' + AccountName as accnumber from Accounts order by 
    
    AccountName"
        
                     FillDropDownList(sql,AccNumber)
        
                 end if
                      if not Page.IsPostBack then
                     sql =  "select distinct territoryName from Territories"
                     FillDropDownList(sql,Fromname)
        
                 end if
                      if not Page.IsPostBack then
                     sql =  "select distinct territoryName from Territories"
                     FillDropDownList(sql,Toname)
        
                 end if
        end if
            End Sub
    And here is my button
    Code:
    <asp:Button id="cmdInsert" name="cmdInsert" 
    onclick="cmdInsert_Click" runat="server" Text="Request Transfer" type="submit"></asp:Button>

  2. #2
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,224
    enabled=false or you can just make it invisible (it will not appear in the source code) visble=false

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles