PC Review


Reply
Thread Tools Rate Thread

The book must be wrong

 
 
Tony Johansson
Guest
Posts: n/a
 
      29th Nov 2009
Hello!

I'm new to asp.net
I have the following aspx page listing below in a book that I'm reading.
The book is saying that this listing is showing a webbpageapplikation that
is using html-server controlls.

This must be wrong because this listing is using webbserver controlls
because you have the asp prefix.
So I just want to confirm with you that I'm is right ?

<%@ Page Language="C#" %>

<HTML>
<HEAD>
<SCRIPT> RUNAT="SERVER">
protected void btnMyButton_Click(object Source, EventArgs e)
{
lblMyLabel.Text = "Somebody <b>clicked</b> on the button!">;
}
</SCRIPT>
</HEAD>

<BODY>
<H#> A simple webbformexample</H3>
<FORM RUNAT=SERVER>
<asp:Button id=btnMyButton
runat="server"
Text="My button"
onclick="btnMyButton_Click" />
<br>
<br>
<asp:Label id=lblMyLabel
runat=server />
</FORM>
</BODY>
</HTML

//Tony



 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      29th Nov 2009

"Tony Johansson" <(E-Mail Removed)> wrote in message
news:NgBQm.13193$(E-Mail Removed)...
> Hello!
>
> I'm new to asp.net
> I have the following aspx page listing below in a book that I'm reading.
> The book is saying that this listing is showing a webbpageapplikation that
> is using html-server controlls.
>
> This must be wrong because this listing is using webbserver controlls
> because you have the asp prefix.
> So I just want to confirm with you that I'm is right ?
>
> <%@ Page Language="C#" %>
>
> <HTML>
> <HEAD>
> <SCRIPT> RUNAT="SERVER">
> protected void btnMyButton_Click(object Source, EventArgs e)
> {
> lblMyLabel.Text = "Somebody <b>clicked</b> on the button!">;
> }
> </SCRIPT>
> </HEAD>
>
> <BODY>
> <H#> A simple webbformexample</H3>
> <FORM RUNAT=SERVER>
> <asp:Button id=btnMyButton
> runat="server"
> Text="My button"
> onclick="btnMyButton_Click" />
> <br>
> <br>
> <asp:Label id=lblMyLabel
> runat=server />
> </FORM>
> </BODY>
> </HTML
>
> //Tony


I think you are just getting a bit too caught up in terminology here Tony.
What you are showing here is an ASP .NET web page that has server-side code
wrtten into it along with "server controls" defined in it.

In the body of the page, there are indeed, what some would call HTML-Server
controls (the <asp:Button> and the <asp:Label>). These could also be called
a Server Controls, or Web Forms Controls. But, they can be called HTML
Server controls because they are server side repesentations of client side
HTML elements.

Personally, I only refer to something as an HTML Server Control when I take
some actual HTML element and mark it as being available to the server (thus,
a server-side class instance will represent it) by adding the runat="server"
and the id="someName" attributes to the HTML element. For all other server
controls, I just call them Server Controls.

In the end though, what's important is that they are Server controls, rather
then client controls.

-Scott


 
Reply With Quote
 
Tony Johansson
Guest
Posts: n/a
 
      29th Nov 2009
Hello!

I have two question
What is the difference if I have this attribute runat="server" compare to
not having it for this web server control Button

<asp:Button id=btnMyButton
runat="server"
Text="My button"
onclick="btnMyButton_Click" />

Here I have what I call a HTML server control. What would be the difference
in this case if I remove this runat="server"
for this input control. ?
<input id="Name"
type=text
size=50
runat="server"

//Tony

"Scott M." <s-(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed)...
>
> "Tony Johansson" <(E-Mail Removed)> wrote in message
> news:NgBQm.13193$(E-Mail Removed)...
>> Hello!
>>
>> I'm new to asp.net
>> I have the following aspx page listing below in a book that I'm reading.
>> The book is saying that this listing is showing a webbpageapplikation
>> that
>> is using html-server controlls.
>>
>> This must be wrong because this listing is using webbserver controlls
>> because you have the asp prefix.
>> So I just want to confirm with you that I'm is right ?
>>
>> <%@ Page Language="C#" %>
>>
>> <HTML>
>> <HEAD>
>> <SCRIPT> RUNAT="SERVER">
>> protected void btnMyButton_Click(object Source, EventArgs e)
>> {
>> lblMyLabel.Text = "Somebody <b>clicked</b> on the button!">;
>> }
>> </SCRIPT>
>> </HEAD>
>>
>> <BODY>
>> <H#> A simple webbformexample</H3>
>> <FORM RUNAT=SERVER>
>> <asp:Button id=btnMyButton
>> runat="server"
>> Text="My button"
>> onclick="btnMyButton_Click" />
>> <br>
>> <br>
>> <asp:Label id=lblMyLabel
>> runat=server />
>> </FORM>
>> </BODY>
>> </HTML
>>
>> //Tony

>
> I think you are just getting a bit too caught up in terminology here Tony.
> What you are showing here is an ASP .NET web page that has server-side
> code wrtten into it along with "server controls" defined in it.
>
> In the body of the page, there are indeed, what some would call
> HTML-Server controls (the <asp:Button> and the <asp:Label>). These could
> also be called a Server Controls, or Web Forms Controls. But, they can be
> called HTML Server controls because they are server side repesentations of
> client side HTML elements.
>
> Personally, I only refer to something as an HTML Server Control when I
> take some actual HTML element and mark it as being available to the server
> (thus, a server-side class instance will represent it) by adding the
> runat="server" and the id="someName" attributes to the HTML element. For
> all other server controls, I just call them Server Controls.
>
> In the end though, what's important is that they are Server controls,
> rather then client controls.
>
> -Scott
>



 
Reply With Quote
 
Gregory A. Beamer (MVP)
Guest
Posts: n/a
 
      29th Nov 2009
"Tony Johansson" <(E-Mail Removed)> wrote in
news:NgBQm.13193$(E-Mail Removed):

> I'm new to asp.net
> I have the following aspx page listing below in a book that I'm
> reading. The book is saying that this listing is showing a
> webbpageapplikation that is using html-server controlls.
>
> This must be wrong because this listing is using webbserver controlls
> because you have the asp prefix.
> So I just want to confirm with you that I'm is right ?


The author did not use standard terminology, so I would agree with you, but
would not get overly bent out of shape, as none of the terminology used is
100% consistent.

These are definitely NOT controls in the HTML web controls namespace and
they are what we would normally term server controls, not HTML server
controls.

Technically, you can use HTML controls as server controls, as well, if you
add runat="server" to them, so that is probably what is confusing you.

I agree with Scott that you should not let the terminology get in the way
of learning. On the other hand, feel free to float questions, as that is
one way to learn.

Peace and Grace,

--
Gregory A. Beamer
Microsoft MVP (Visual C# Architecture)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

**********************************************
| Think outside the box! |
**********************************************
 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      29th Nov 2009

"Tony Johansson" <(E-Mail Removed)> wrote in message
news:7cCQm.13196$(E-Mail Removed)...
> Hello!
>
> I have two question
> What is the difference if I have this attribute runat="server" compare to
> not having it for this web server control Button
>
> <asp:Button id=btnMyButton
> runat="server"
> Text="My button"
> onclick="btnMyButton_Click" />


This is already known by the ASP .NET engine to be a server control based on
the <asp: syntax.

>
> Here I have what I call a HTML server control. What would be the
> difference in this case if I remove this runat="server"
> for this input control. ?
> <input id="Name"
> type=text
> size=50
> runat="server"


Normally, this would be just a client side control, but the server sees the
runat="server" and the id="Name" on it and it knows to generate an instance
of a server-side control.

Both techniques will get you a server-side control to work with, but not the
*same* server-side control. The HTML version will offer only limited server
events and properties than the ASP .NET Server control will.

-Scott

>
> //Tony
>
> "Scott M." <s-(E-Mail Removed)> skrev i meddelandet
> news:(E-Mail Removed)...
>>
>> "Tony Johansson" <(E-Mail Removed)> wrote in message
>> news:NgBQm.13193$(E-Mail Removed)...
>>> Hello!
>>>
>>> I'm new to asp.net
>>> I have the following aspx page listing below in a book that I'm reading.
>>> The book is saying that this listing is showing a webbpageapplikation
>>> that
>>> is using html-server controlls.
>>>
>>> This must be wrong because this listing is using webbserver controlls
>>> because you have the asp prefix.
>>> So I just want to confirm with you that I'm is right ?
>>>
>>> <%@ Page Language="C#" %>
>>>
>>> <HTML>
>>> <HEAD>
>>> <SCRIPT> RUNAT="SERVER">
>>> protected void btnMyButton_Click(object Source, EventArgs e)
>>> {
>>> lblMyLabel.Text = "Somebody <b>clicked</b> on the button!">;
>>> }
>>> </SCRIPT>
>>> </HEAD>
>>>
>>> <BODY>
>>> <H#> A simple webbformexample</H3>
>>> <FORM RUNAT=SERVER>
>>> <asp:Button id=btnMyButton
>>> runat="server"
>>> Text="My button"
>>> onclick="btnMyButton_Click" />
>>> <br>
>>> <br>
>>> <asp:Label id=lblMyLabel
>>> runat=server />
>>> </FORM>
>>> </BODY>
>>> </HTML
>>>
>>> //Tony

>>
>> I think you are just getting a bit too caught up in terminology here
>> Tony. What you are showing here is an ASP .NET web page that has
>> server-side code wrtten into it along with "server controls" defined in
>> it.
>>
>> In the body of the page, there are indeed, what some would call
>> HTML-Server controls (the <asp:Button> and the <asp:Label>). These could
>> also be called a Server Controls, or Web Forms Controls. But, they can
>> be called HTML Server controls because they are server side
>> repesentations of client side HTML elements.
>>
>> Personally, I only refer to something as an HTML Server Control when I
>> take some actual HTML element and mark it as being available to the
>> server (thus, a server-side class instance will represent it) by adding
>> the runat="server" and the id="someName" attributes to the HTML element.
>> For all other server controls, I just call them Server Controls.
>>
>> In the end though, what's important is that they are Server controls,
>> rather then client controls.
>>
>> -Scott
>>

>
>



 
Reply With Quote
 
Tony Johansson
Guest
Posts: n/a
 
      30th Nov 2009
Hello!

You say that if I have a webbserver control like this Button below it is
already a server side control.
What is the practice here is to use runat=server or skip this runat=server
because this runat=server doesn't
add anything because as you mentioned it is already a server side control.
<asp:Button id=btnMyButton
runat="server"
Text="My button"
onclick="btnMyButton_Click" />


//Tony


"Gregory A. Beamer (MVP)" <(E-Mail Removed)> skrev i
meddelandet news:Xns9CD2AB1182BE5gbworld@207.46.248.16...
> "Tony Johansson" <(E-Mail Removed)> wrote in
> news:NgBQm.13193$(E-Mail Removed):
>
>> I'm new to asp.net
>> I have the following aspx page listing below in a book that I'm
>> reading. The book is saying that this listing is showing a
>> webbpageapplikation that is using html-server controlls.
>>
>> This must be wrong because this listing is using webbserver controlls
>> because you have the asp prefix.
>> So I just want to confirm with you that I'm is right ?

>
> The author did not use standard terminology, so I would agree with you,
> but
> would not get overly bent out of shape, as none of the terminology used is
> 100% consistent.
>
> These are definitely NOT controls in the HTML web controls namespace and
> they are what we would normally term server controls, not HTML server
> controls.
>
> Technically, you can use HTML controls as server controls, as well, if you
> add runat="server" to them, so that is probably what is confusing you.
>
> I agree with Scott that you should not let the terminology get in the way
> of learning. On the other hand, feel free to float questions, as that is
> one way to learn.
>
> Peace and Grace,
>
> --
> Gregory A. Beamer
> Microsoft MVP (Visual C# Architecture)
>
> Twitter: @gbworld
> Blog: http://gregorybeamer.spaces.live.com
>
> **********************************************
> | Think outside the box! |
> **********************************************



 
Reply With Quote
 
Andrew Morton
Guest
Posts: n/a
 
      30th Nov 2009
Tony Johansson wrote:
> What is the practice here is to use runat=server or skip this
> runat=server because this runat=server doesn't
> add anything because as you mentioned it is already a server side
> control. <asp:Button id=btnMyButton
> runat="server"
> Text="My button"
> onclick="btnMyButton_Click" />


If you omit the runat="server" then it will not work.

Andrew


 
Reply With Quote
 
Gregory A. Beamer
Guest
Posts: n/a
 
      30th Nov 2009
"Tony Johansson" <(E-Mail Removed)> wrote in
news6MQm.13201$(E-Mail Removed):

> What is the practice here is to use runat=server or skip this
> runat=server because this runat=server doesn't
> add anything because as you mentioned it is already a server side
> control.


What I mean is standard HTML controls have an analog in the .NET space if
you use runat=server.

<input type="button" runat="server"

will become a HtmlButton control from the .NET standpoint. Without
runat=server, you will end up with a standard HTML "control".

Peace and Grace,

--
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
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
Range in wrong book =?Utf-8?B?TmV3Ymll?= Microsoft Excel Programming 5 8th Feb 2007 02:38 PM
Saving to wrong address book and I don't know why... Wally Steadman Microsoft Outlook Discussion 0 21st Jan 2005 09:02 PM
The book information is wrong Johnny Chow Microsoft Windows 2000 Active Directory 2 25th Jun 2004 05:27 PM
Opening wrong address book Keyser Microsoft Outlook Discussion 3 6th May 2004 03:43 PM
wrong address book Brian Quigley Microsoft Outlook Contacts 0 1st Aug 2003 08:59 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:21 AM.