HTML Controls Vs Web Controls.

A

Adam Knight

Just out of interest, what is everbody's thought on using HTML Controls Vs
Web Controls.

Any preferences??

Cheers,
Adam
 
J

Jason Kester

I never use a Web Control with an HTML equivilant unless absolutely
necessary.

DataGrids and Repeaters are fine, but using <asp:button> instead of
<input type=submit> just strikes me as silly, an can lead to
sloppiness. I've actually had to dress down a junior developer after
finding the following code in an application:


<asp:linkbutton id="myLink" onclick="myLink_Click" text="home"
runat=server></asp:linkbutton>

.... and on the server...

protected void myLink_Click(object sender, EventArgs e)
{
Response.Redirect("/home.aspx");
}


Anybody think they could come up with an HTML equivilant to the above?

Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
 
K

Kevin Spencer

I understand perfectly. No need to do a PostBack when client-side JavaScript
can easily do the job. I've seen it happen entirely too many times. But if
he's a junior developer, why would you need the HTML and JavaScript to do
this? Well, anyway:

<input type="button" value="Home" onclick="document.location='/home.aspx'">

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
K

Kevin Spencer

Well, I presumed that a button was wanted. Of course, a hyperlink would be
simpler. But why would he (incorrectly) use a Button Control rather than
(incorrectly) a Hyperlink Control?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
J

Jason Kester

Junior Developer. Never overestimate the capabilities of these guys.
They'll surprise you every time!

It was an ASP:LinkButton control that he used. Which renders as an
anchor tag with a bunch of javascript to force a postback. He was
looking for a control that looked like a link, and would take the user
to a different page when clicked.


Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,228
Latest member
MikeMichal

Latest Threads

Top