By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,561 Members | 3,083 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,561 IT Pros & Developers. It's quick & easy.

<div id="help" runat="server"></div>

P: n/a
Most of the asp.net learning I've done has been from books that were written
during the 1.0 framework. I didn't have a copy of visual studio when I
started reading them then I got a hold of VS 2005 Beta 1, then Beta 2.

I was using the <div runat="server"> statement on my projects. Once I placed
a <div id="testdiv" runat="server"> within my aspx page, I could then
manipulate it in the code behind like so:

testdiv.visible = true
testdiv.innerhtml = mystring

I recently got a copy of VS 2003 developer and started to recode a project
of mine that I did under the 2.0 beta2 framework. I have been coming along
ok except for the <div> statement. For some reason, in the code behind, VS
does not recognize <div>. the testdiv portion of testdiv.visible = true is
underlined and says that it isn't declared.

Why would framework 1.0 and 2.0 (Visual studio) understand what it is but
the 1.1 not? If I can no longer use testdiv.innerhtml = mystring to produce
html output streams, then what do I do instead to output data tables in a
format that I want them to look instead of a simple grid?

TIA,
Jim
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
The page framework has changed in 2.0. With Partial Classes, the codebehind
and the aspx file are the same class. So your testdiv which is declared in
the aspx file is readily visible in your codebehind.

in 1.1 the aspx file inherited from the codebehind. If you declare and
instantiate a control in your aspx, it must be separately declared in your
codebehind file as well.

All that to say, put:
Protected testdiv as HtmlGenericControl in your codebehind's class

public class MyPage
inherits Page

Protected testdiv as HtmlGenericControl //the name here matches the Id
of the control

sub Page_load(..)
testvid.whatever = whatever

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Jim in Arizona" <ti*******@hotmail.com> wrote in message
news:uZ**************@TK2MSFTNGP15.phx.gbl...
Most of the asp.net learning I've done has been from books that were
written during the 1.0 framework. I didn't have a copy of visual studio
when I started reading them then I got a hold of VS 2005 Beta 1, then Beta
2.

I was using the <div runat="server"> statement on my projects. Once I
placed a <div id="testdiv" runat="server"> within my aspx page, I could
then manipulate it in the code behind like so:

testdiv.visible = true
testdiv.innerhtml = mystring

I recently got a copy of VS 2003 developer and started to recode a project
of mine that I did under the 2.0 beta2 framework. I have been coming along
ok except for the <div> statement. For some reason, in the code behind, VS
does not recognize <div>. the testdiv portion of testdiv.visible = true is
underlined and says that it isn't declared.

Why would framework 1.0 and 2.0 (Visual studio) understand what it is but
the 1.1 not? If I can no longer use testdiv.innerhtml = mystring to
produce html output streams, then what do I do instead to output data
tables in a format that I want them to look instead of a simple grid?

TIA,
Jim

Nov 20 '05 #2

P: n/a
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OS**************@TK2MSFTNGP12.phx.gbl...
The page framework has changed in 2.0. With Partial Classes, the
codebehind and the aspx file are the same class. So your testdiv which is
declared in the aspx file is readily visible in your codebehind.

in 1.1 the aspx file inherited from the codebehind. If you declare and
instantiate a control in your aspx, it must be separately declared in your
codebehind file as well.

All that to say, put:
Protected testdiv as HtmlGenericControl in your codebehind's class

public class MyPage
inherits Page

Protected testdiv as HtmlGenericControl //the name here matches the Id
of the control

sub Page_load(..)
testvid.whatever = whatever

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Jim in Arizona" <ti*******@hotmail.com> wrote in message
news:uZ**************@TK2MSFTNGP15.phx.gbl...
Most of the asp.net learning I've done has been from books that were
written during the 1.0 framework. I didn't have a copy of visual studio
when I started reading them then I got a hold of VS 2005 Beta 1, then
Beta 2.

I was using the <div runat="server"> statement on my projects. Once I
placed a <div id="testdiv" runat="server"> within my aspx page, I could
then manipulate it in the code behind like so:

testdiv.visible = true
testdiv.innerhtml = mystring

I recently got a copy of VS 2003 developer and started to recode a
project of mine that I did under the 2.0 beta2 framework. I have been
coming along ok except for the <div> statement. For some reason, in the
code behind, VS does not recognize <div>. the testdiv portion of
testdiv.visible = true is underlined and says that it isn't declared.

Why would framework 1.0 and 2.0 (Visual studio) understand what it is but
the 1.1 not? If I can no longer use testdiv.innerhtml = mystring to
produce html output streams, then what do I do instead to output data
tables in a format that I want them to look instead of a simple grid?

TIA,
Jim

Thanks Karl. I will certainly give that a try. If I find myself producing
more gray hair than normal, I'll get back to you! ;o)
Nov 20 '05 #3

P: n/a
Hi Jim,

It all depends on the coding model you're using. If you are coding in .Net
1.1 and using the CodeBehind model, the Page Template inherits the
CodeBehind. Therefore, you need to declare the div as an HtmlGenericControl
in the CodeBehind class, and give it Protected access, so that it defines
the div in the inherited Page class. If you use the Code-in-Page model, you
don't have to do this.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Jim in Arizona" <ti*******@hotmail.com> wrote in message
news:uZ**************@TK2MSFTNGP15.phx.gbl...
Most of the asp.net learning I've done has been from books that were
written during the 1.0 framework. I didn't have a copy of visual studio
when I started reading them then I got a hold of VS 2005 Beta 1, then Beta
2.

I was using the <div runat="server"> statement on my projects. Once I
placed a <div id="testdiv" runat="server"> within my aspx page, I could
then manipulate it in the code behind like so:

testdiv.visible = true
testdiv.innerhtml = mystring

I recently got a copy of VS 2003 developer and started to recode a project
of mine that I did under the 2.0 beta2 framework. I have been coming along
ok except for the <div> statement. For some reason, in the code behind, VS
does not recognize <div>. the testdiv portion of testdiv.visible = true is
underlined and says that it isn't declared.

Why would framework 1.0 and 2.0 (Visual studio) understand what it is but
the 1.1 not? If I can no longer use testdiv.innerhtml = mystring to
produce html output streams, then what do I do instead to output data
tables in a format that I want them to look instead of a simple grid?

TIA,
Jim

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.