473,388 Members | 1,286 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,388 software developers and data experts.

HtmlTable!

Hi

I am gettin error, if i try to find the top position of a table.
Here is what i am doing.I have a HtmlTable (Table3 is the name/id)
created.It has a position and a Top and Left co-ordinates assigned. I
have a button to add a row to this table. When i click on this button
the code behind is :

private void add_ServerClick(object sender, System.EventArgs e)
{
// Generate rows and cells.

HtmlTable objcheck = (HtmlTable)Page.FindControl("Table3");
string newtr=objcheck.Style["Top"].ToString();
}

Now i want to know the position of the Table3 ie the Top position. And
when i Response.write objcheck it is giving me correct output saying
Htmltable control is created , but in this line :
string newtr=objcheck.Style["Top"].ToString();
Its giving me an exception :
System.NullReferenceException: Object reference not set to an instance
of an object.

I am not sure if am doing it right. I am sure the table3 is exists and
am also Finding the control , i dunno why its still giving me the error
at that Line . Your inputs will be of great help.

Thanks
Ajay

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #1
3 7218
Your table styles might be null. In other words,
objcheck.Style["Top"] returns null.

Tu-Thach
-----Original Message-----
Hi

I am gettin error, if i try to find the top position of a table.Here is what i am doing.I have a HtmlTable (Table3 is the name/id)created.It has a position and a Top and Left co-ordinates assigned. Ihave a button to add a row to this table. When i click on this buttonthe code behind is :

private void add_ServerClick(object sender, System.EventArgs e){
// Generate rows and cells.

HtmlTable objcheck = (HtmlTable)Page.FindControl ("Table3"); string newtr=objcheck.Style["Top"].ToString();
}

Now i want to know the position of the Table3 ie the Top position. Andwhen i Response.write objcheck it is giving me correct output sayingHtmltable control is created , but in this line :
string newtr=objcheck.Style["Top"].ToString();
Its giving me an exception :
System.NullReferenceException: Object reference not set to an instanceof an object.

I am not sure if am doing it right. I am sure the table3 is exists andam also Finding the control , i dunno why its still giving me the errorat that Line . Your inputs will be of great help.

Thanks
Ajay

*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
.

Nov 15 '05 #2
Hi
No , My table tag looks like this . it has attributes for sure :

tag:
<TABLE id="Table3" style="LEFT: 8px; POSITION: absolute; TOP: 154px"
height="94" cellSpacing="1" cellPadding="1" width="28" bgColor="#3333ff"
border="0" runat="server">

Thanks
Ajay

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #3
Hi, Ajay:
I think first you should use Table insteadof HtmlTable to cast
the control, because it is the table control running at server.
Second, the attribute name should be "TOP" (not "Top");
Hope it helps!
Qiu

"Ajay Desh" <aj******@yahoo.com> wrote in message
news:e8**************@TK2MSFTNGP12.phx.gbl...
Hi

I am gettin error, if i try to find the top position of a table.
Here is what i am doing.I have a HtmlTable (Table3 is the name/id)
created.It has a position and a Top and Left co-ordinates assigned. I
have a button to add a row to this table. When i click on this button
the code behind is :

private void add_ServerClick(object sender, System.EventArgs e)
{
// Generate rows and cells.

HtmlTable objcheck = (HtmlTable)Page.FindControl("Table3");
string newtr=objcheck.Style["Top"].ToString();
}

Now i want to know the position of the Table3 ie the Top position. And
when i Response.write objcheck it is giving me correct output saying
Htmltable control is created , but in this line :
string newtr=objcheck.Style["Top"].ToString();
Its giving me an exception :
System.NullReferenceException: Object reference not set to an instance
of an object.

I am not sure if am doing it right. I am sure the table3 is exists and
am also Finding the control , i dunno why its still giving me the error
at that Line . Your inputs will be of great help.

Thanks
Ajay

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 15 '05 #4

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

Similar topics

1
by: Jeremy Ames | last post by:
Ok, so I am still trying to get use to ADO.Net, but I have come leaps and bounds to this point. I am trying to bind a dataset that I have returned from a webservice to a HtmlTable. It appears that...
2
by: Michael Meckelein | last post by:
Hi all! I have a table like Table myTable = new Table(); Now, I want to publish the table as part of a webpage and as part of a word document. I tried to convert the table, but the compiler...
2
by: suzy | last post by:
what is the difference between a htmltable control and a table control i know one is server control and the other is not, but when would each be used? also, how do you set the class of a html...
2
by: Alfred Salton | last post by:
Can anyone show me how to set the css class of an HtmlTable control in code on the server? I can't find any indication that the css class is a property of the HtmlTable, HtmlTableRow and...
2
by: Jay | last post by:
I have been trying to link and HTML Table to a Code behind variable. I have seen people saying that they can do this but I cannot get it to work. What am i missing? In the HTML Code I have:...
1
by: Leo | last post by:
I created a user control which is some text contained in a HtmlTable. I put this control into main form. I would like to have the ability to move this control around in the main form. I think one...
1
by: TRobran | last post by:
What I'm trying to do seems pretty straightforward so I must be missing something simple. Any help is greatly appreciated. On my page I have a DropDownList, a HtmlTable and a Button. Each row...
0
by: redaudi | last post by:
I'm hoping someone might be able to help me with the following issue. Basically I'm creating a htmltable on the fly and then simply populating it with rows and cells accordingly. My test site ...
0
by: purnimakarnati | last post by:
Hi All, Can anybody solve my problem. I created a HTMLTable with a dataset by a method called addTable(dataset) After creating a new table and new row I am adding cells and in each cell I am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.