PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

ASP web control and HTML

 
 
Tony Johansson
Guest
Posts: n/a
 
      22nd Nov 2010
Hello!

What is the difference if I use a ASP web control Button compared to if I
use a HTML Button.
Below is two example where the first row is using a ASP web control and the
second row is using HTML control.


<asp:Button ID="Button2" runat="server" Text="Button" />
input id="Button1" type="button" value="button" />

//Tony


 
Reply With Quote
 
 
 
 
Brian Cryer
Guest
Posts: n/a
 
      23rd Nov 2010
"Tony Johansson" <(E-Mail Removed)> wrote in message
news:iceeti$uec$(E-Mail Removed)...
> Hello!
>
> What is the difference if I use a ASP web control Button compared to if I
> use a HTML Button.
> Below is two example where the first row is using a ASP web control and
> the second row is using HTML control.
>
>
> <asp:Button ID="Button2" runat="server" Text="Button" />
> input id="Button1" type="button" value="button" />


I'm assuing the missing opening bracket on the second button was a typo.

Probably the main difference between the two is that with the <asp:Button
....> the ASP.NET framework will do a lot of work for you. The framework will
detect if the button has been clicked and call the appropriate handler
(Button2_Click). You also have more control because you can refer to the
button in your code (Button2) and hide it, apply styles to it, change the
text, etc.

If you use a standard HTML control then the end HTML will be very similar,
but at the server you have to do the work to detect whether or not the
button has been clicked. You also loose the ability to change its attributes
in code.

As a rule I'd suggest always using the ASP.NET button.

Hope this helps.
--
Brian Cryer
http://www.cryer.co.uk/brian

 
Reply With Quote
 
Cubaman
Guest
Posts: n/a
 
      24th Nov 2010
On Nov 23, 1:29*pm, "Brian Cryer" <not.h...@localhost.invalid> wrote:
> "Tony Johansson" <johansson.anders...@telia.com> wrote in message
>
> news:iceeti$uec$(E-Mail Removed)...
>
> > Hello!

>
> > What is the difference if I use a ASP web control Button compared to ifI
> > use a HTML Button.
> > Below is two example where the first row is using a ASP web control and
> > the second row is using HTML control.

>
> > <asp:Button ID="Button2" runat="server" Text="Button" />
> > * input id="Button1" type="button" value="button" />

>
> I'm assuing the missing opening bracket on the second button was a typo.
>
> Probably the main difference between the two is that with the <asp:Button
> ...> the ASP.NET framework will do a lot of work for you. The framework will
> detect if the button has been clicked and call the appropriate handler
> (Button2_Click). You also have more control because you can refer to the
> button in your code (Button2) and hide it, apply styles to it, change the
> text, etc.
>
> If you use a standard HTML control then the end HTML will be very similar,
> but at the server you have to do the work to detect whether or not the
> button has been clicked. You also loose the ability to change its attributes
> in code.
>
> As a rule I'd suggest always using the ASP.NET button.
>
> Hope this helps.
> --
> *Brian Cryer
> *http://www.cryer.co.uk/brian


Hello:
I agree with your explanation, but if you are not going to use any of
the benefits of aspnet controls, it's better to use html one's and
release server resources that otherwise will be wasted.
Best regards.
 
Reply With Quote
 
 
 
Reply

Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Studio 2005 html-view does not recognize the generated html-tag of a custom control Rolf Welskes Microsoft ASP .NET 3 6th Oct 2006 07:49 PM
Still confused...using an HTML Control to modify an HTML tag's value darrel Microsoft ASP .NET 6 15th Oct 2004 08:16 PM
Using the MS IE HTML control to print a HTML document Marc Scheuner [MVP ADSI] Microsoft Dot NET Framework Forms 0 23rd Feb 2004 03:04 PM
Export data from Access to HTML file and control the formatting (to be used in HTML Help) Vincent Microsoft Access External Data 1 18th Dec 2003 02:53 AM
In-correct formatting in the HTML displayed by the custom HTML Control Asheesh Microsoft Dot NET Compact Framework 2 15th Sep 2003 02:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:42 PM.