Problem with Tag Rendering in ASP.NET

S

Surajit Laha

Hi,

I am facing a strange problem!

I have hosted the same ASP.NET web app in two servers.
One server is Win XP Pro (IIS 5.1) and the other is Win 2k Server (IIS
5).

The trouble is when the application is requested from the WinXP
machine, it renders SPAN tag, while when the page is requested from
the Win2k machine it does not!

To explain it in more detail:

From Win2k server:
<input id="dgrTeamAuth__ctl2_chkAuthorized" type="checkbox"
name="dgrTeamAuth:_ctl2:chkAuthorized" checked="checked"
onclick="javascript:SyncTextBox(this);" />

From WinXP server:
<span onclick="javascript:SyncTextBox(this);"><input
id="dgrTeamAuth__ctl2_chkAuthorized" type="checkbox"
name="dgrTeamAuth:_ctl2:chkAuthorized" checked="checked" /></span>


Now the diference is in SPAN tag.

Due to this some JavaScript of the page is throwing error.

How can I ensure that the browser renders the same HTML each time,
atleast if the client PC remains the same?

Please help.
-Surajit Laha
 
J

John Saunders

Surajit Laha said:
Hi,

I am facing a strange problem!

I have hosted the same ASP.NET web app in two servers.
One server is Win XP Pro (IIS 5.1) and the other is Win 2k Server (IIS
5).

The trouble is when the application is requested from the WinXP
machine, it renders SPAN tag, while when the page is requested from
the Win2k machine it does not!

To explain it in more detail:

From Win2k server:
<input id="dgrTeamAuth__ctl2_chkAuthorized" type="checkbox"
name="dgrTeamAuth:_ctl2:chkAuthorized" checked="checked"
onclick="javascript:SyncTextBox(this);" />

From WinXP server:
<span onclick="javascript:SyncTextBox(this);"><input
id="dgrTeamAuth__ctl2_chkAuthorized" type="checkbox"
name="dgrTeamAuth:_ctl2:chkAuthorized" checked="checked" /></span>


Now the diference is in SPAN tag.

Due to this some JavaScript of the page is throwing error.

How can I ensure that the browser renders the same HTML each time,
atleast if the client PC remains the same?

Surajit,

First of all, you should not expect to have so much control over the
rendered HTML unless you are the one generating the HTML. Surely Microsoft
should be free to change the details of the HTML they render from time to
time?

Secondly, I believe that this is exactly your problem - you are running two
different versions of the .NET Framework. Perhaps one machine is running 1.0
and the other machine is running 1.1.

As to a workaround, your JavaScript will have to adapt to the situation. If
it needs to manipulate the <input> element, it will have to search for it.
If "this" is the input element, it need not search. But if not, it should
search in the children of "this".
 
S

Surajit Laha

Hi John,

Thanks a LOT for your to-the-point comments!!!

You are absolutely right.

I am now modifying my JavaScript code to take care of this situation.

Thanks again.

Regards,

-Surajit Laha
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top