Results 1 to 7 of 7

Thread: [RESOLVED] ASP Buttons

  1. #1

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,562

    Resolved [RESOLVED] ASP Buttons

    What is the difference between the true logic and the false logic here?:
    Code:
    				<%If CLng(Request.Cookies("SESS")("typ")) = CLng(ADMIN_TYP) Then%>
    					<INPUT TYPE=SUBMIT NAME="EditFunction" VALUE="Delete Customer">
    				<%Else%>
    					<INPUT TYPE="Button" NAME="Delete" VALUE="Delete Customer" ONCLICK="verifydeletecust();">
    				<%End If%>
    Specifically, what is the difference between TYPE=SUBMIT and TYPE="Button" ?

    Thanks.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: ASP Buttons

    Type="Submit" will submit the form along with all of the fields.
    Type="Button" will not submit the form, it will only do what's in the onclick. In this case, it probably calls the javascript method which in turn asks "Are you sure?" and then submits the form.

  3. #3

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,562

    Re: ASP Buttons

    And what about this?

    <INPUT TYPE=RESET VALUE="Reset">

    If I changed my textboxes on this asp page and then decide, for example, I was editing the wrong customer, I just hit this Reset button and all the data go back to their original values on the client. I am sure I can't do this in asp.net easily and without a postback!

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: ASP Buttons

    There is no <asp:Reset> control, but you can place an <input type="reset"> on the page itself and it will act just as a normal reset button does.

  5. #5

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,562

    Re: ASP Buttons

    Wow - that was so very cool!

    And it's okay to mix them up like this?:

    Code:
            <asp:Button ID="btnUpdate" runat="server" Text="Update" />
            <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
            <input type="reset" value="Reset">

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: ASP Buttons

    Yes, because in the end the <asp:Button> is rendered out as <input type="submit">. It's the same thing as using <asp:Button> along with a <table> in a page. One is ASP.NET markup, one is HTML. You can mix anything.

  7. #7

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,562

    Re: ASP Buttons

    Thank you. I had these same three buttons on another page which I rushed through so I just went back and put them there too. I will keep these in my pocket for the future...

Posting Permissions

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



Click Here to Expand Forum to Full Width