> They all do exactly the same thing. All will post back unless you tell
> them not to. All will trip the IsPostBack flag. All can have events
[quoted text clipped - 15 lines]
> Get your own Travel Blog, with itinerary maps and photos!
> http://www.blogabond.com/
> How do you tell them not to post back? Is there some attribute in a flag?
That's just HTML:
<input type="button" onclick="myClientSideFunction()">
> Also, you refer to:
> <input type=submit runat=server>
>
> Why would one put runat=server on a tag that will become an HTML page tag? The input
> tag is not asp:input. It is just plain input. I thought runat=server was only used
> for tags that you want the ASP.Net pre-processor to translate into something else.
No. runat=server is available for any HTML tag. <br id="myBR"
runat=server/> is perfectly valid, and will be available to you as a
HtmlGenericControl on the server.
Take a look at the HTML generated by <asp:button> for an answer to your
question. It will render as <input type=submit>, plus a bunch of
script. The question you will eventually want to ask youself is, since
it's rendering as an INPUT anyway, why not declare it as one?
> Though I'm an ASP.Net novice and I still do not understand some basics. So maybe I'm
> wrong.
Try to learn a bit about HTML and CGI programming outside of the
context of ASP.NET. Seriously, install Perl or PHP on a server and
write some simple database tools. It will take away a lot of
misconceptions about the things that ASP.NET is doing for you behind
the scenes.
Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
---
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/
Randall Parker - 31 Oct 2005 18:40 GMT
Jason,
I think I finally understand: So you are saying that HtmlGenericControl is a class on
the server-side that does not match the name of an ASP.Net tag? You just assign
runat=server to a normal HTML tag and then you can access that tag in CodeBehind by
declaring a variable with the same name as its ID?
Yes, if one can do that then some of the ASP.Net tags become a lot less necessary.
Plus, one gets more control over what gets produced.
> No. runat=server is available for any HTML tag. <br id="myBR"
> runat=server/> is perfectly valid, and will be available to you as a
[quoted text clipped - 4 lines]
> script. The question you will eventually want to ask youself is, since
> it's rendering as an INPUT anyway, why not declare it as one?
Jason Kester - 31 Oct 2005 19:22 GMT
Exactly. Most tags that you'll actually want to touch from the server
will have their own HtmlControl equivilant (HtmlAnchor, HtmlInputText,
HtmlTableRow, etc.) The rest can still be dealt with as
HtmlContainerControl or HtmlGenericControl objects.
The only <asp:...> tags that I use on a regular basis are the helpers
such as Repeater and DataGrid, and the occasional Literal. There are
certain specific (and very rare) cases where <asp:button> is more
useful than <input type="button" runat=server>, but for the most part I
prefer my Html to look like Html.
Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
---
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/