473,396 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

html tag access from the code behind

Hello,

I always get a nothing object when retrieving a table tag in the aspx page.
I wonder why this piece of code doesn't work : the mytable object is still
nothing.
Here is the code :

In the aspx page :

<body>
<form id="form1" runat="server">
.....
<table id="mytable">
.....
</table>
....
</body>

As you can see, the table tag has an ID attribute.
It is this tag I would like to access.

The code behind is like this :

[declaration]
Protected mytable As System.Web.UI.HtmlControls.HtmlTable

sub page_load
mytable = Page.FindControl("mytable")
mytable.visible = true
en sub

At execution, mytable is still nothing, like if the tag wasn't found.
I do not understand what I miss. The result is the same when adding
runat="serveur" in the mytable tag.

I can't see what is wrong...

Thanks a lot.

Pierre.
Jan 19 '06 #1
3 2189
Joe
Dear Pierre,
Since there have a server control for creating table, it had better use the
table control instead of HTML control by doing that, it will give the control
more controllable and the code will be more clear

Hope this help you!
Regards
Joe Tsui

"Pierre" wrote:
Hello,

I always get a nothing object when retrieving a table tag in the aspx page.
I wonder why this piece of code doesn't work : the mytable object is still
nothing.
Here is the code :

In the aspx page :

<body>
<form id="form1" runat="server">
.....
<table id="mytable">
.....
</table>
....
</body>

As you can see, the table tag has an ID attribute.
It is this tag I would like to access.

The code behind is like this :

[declaration]
Protected mytable As System.Web.UI.HtmlControls.HtmlTable

sub page_load
mytable = Page.FindControl("mytable")
mytable.visible = true
en sub

At execution, mytable is still nothing, like if the tag wasn't found.
I do not understand what I miss. The result is the same when adding
runat="serveur" in the mytable tag.

I can't see what is wrong...

Thanks a lot.

Pierre.

Jan 19 '06 #2
<table id="mytable" runat="server">

Eliyahu

"Pierre" <pi*******@freesurf.fr> wrote in message
news:uL**************@tk2msftngp13.phx.gbl...
Hello,

I always get a nothing object when retrieving a table tag in the aspx
page.
I wonder why this piece of code doesn't work : the mytable object is still
nothing.
Here is the code :

In the aspx page :

<body>
<form id="form1" runat="server">
....
<table id="mytable">
....
</table>
...
</body>

As you can see, the table tag has an ID attribute.
It is this tag I would like to access.

The code behind is like this :

[declaration]
Protected mytable As System.Web.UI.HtmlControls.HtmlTable

sub page_load
mytable = Page.FindControl("mytable")
mytable.visible = true
en sub

At execution, mytable is still nothing, like if the tag wasn't found.
I do not understand what I miss. The result is the same when adding
runat="serveur" in the mytable tag.

I can't see what is wrong...

Thanks a lot.

Pierre.

Jan 19 '06 #3
It's not precisely what I expected...

Does it show what is wrong in the code below ?

Regards,

Pierre.
"Joe" <Jo*@discussions.microsoft.com> a écrit dans le message de news:
76**********************************@microsoft.com...
Dear Pierre,
Since there have a server control for creating table, it had better use
the
table control instead of HTML control by doing that, it will give the
control
more controllable and the code will be more clear

Hope this help you!
Regards
Joe Tsui

"Pierre" wrote:
Hello,

I always get a nothing object when retrieving a table tag in the aspx
page.
I wonder why this piece of code doesn't work : the mytable object is
still
nothing.
Here is the code :

In the aspx page :

<body>
<form id="form1" runat="server">
.....
<table id="mytable">
.....
</table>
....
</body>

As you can see, the table tag has an ID attribute.
It is this tag I would like to access.

The code behind is like this :

[declaration]
Protected mytable As System.Web.UI.HtmlControls.HtmlTable

sub page_load
mytable = Page.FindControl("mytable")
mytable.visible = true
en sub

At execution, mytable is still nothing, like if the tag wasn't found.
I do not understand what I miss. The result is the same when adding
runat="serveur" in the mytable tag.

I can't see what is wrong...

Thanks a lot.

Pierre.

Jan 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: trinitypete | last post by:
I have a user control that is basically a login dialogue. If I add the user control to webpage1, can I access the properties directly from C# codebehind, or do I have to access the properties from...
5
by: Michael | last post by:
What is the general opinion of having code in the html section of an asp.net page. For example.. <img src="<%=myImageString%>" /> I see something like that done many times in examples, but...
4
by: tma | last post by:
I'm trying to retrieve values for my HTML from the Codebehind file and I'm unclear how to accomplish this. For example: <INPUT TYPE="hidden" NAME="amount" VALUE="xx"> How do I populate the...
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
3
by: Al Wilkerson | last post by:
Hey, I have a Web Form with a drop down list, textbox, and search button. When click the search button an SQL server database is queried fordata. Once I have the data in a dataset I use the...
2
by: fxs | last post by:
Hello, I have the following controls on an aspx page: 2 html radio button controls, 1 asp:label control and 1 asp:button control.... <INPUT id="rdo1" type="radio" name="grp1"...
2
by: Lucky | last post by:
hi guys! i've got very interesting problem. it is like this. is it possible to get HTML generated by the server control in code behind? i'm developing an asp.net web application where i need to...
1
by: supin | last post by:
hi, i work in asp.net2.0/c#.not much expert in javascript.i have a variable declared in the c# code behind page.assume the variable contains some value. i have a javascript function in the...
1
by: Jeff User | last post by:
hi all Using C#, .NET1.1. I need to pass a string of text to the final html output and then capture it with java script on the client side. I found that I can place my string in and then...
1
by: bradwoody | last post by:
ASP.Net and C# I am having trouble determining how to manipulate html controls via javascript AND access those same controls in the C# code behind. Here's the scoop: I am making an advanced...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.