HTML Controls Vs Web Controls.

  • Thread starter Thread starter Adam Knight
  • Start date Start date
A

Adam Knight

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

Any preferences??

Cheers,
Adam
 
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/
 
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.
 
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.
 
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/
 
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.

Which kind of leads you to wonder what's the most complicated and
convoluted way you do such a thing? I mean his way was fairly
complicated for such a simple task, but he is only a junior developer.
Surely the great experienced minds of this newsgroup can come up with an
even more convoluted way of achieving the same thing?

I throw down the gauntlet. Anyone care to take the challenge?
 

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

Back
Top