Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

panel control

Status
Not open for further replies.

KnotGoblin

Technical User
Jan 4, 2005
77
0
0
US
the <asp:panel> control renders as <div> in IE and a <table> in Firefox. This is conflicting with the css. because the ASP is setting the table width=100%. I would like for it to render as a <div> all the time. How can i force it to render as a <div>.

I am using the panel control instead of the <div> because i am having to change the visibility of the panel during the life of the page.

thanks.

-Jer
 
I don't think you can force it like that. That is the specific browser software that inprets the control and renders it.
Y ou can change the visiblity of a DIV as along as you set the ID property of it.

 
I don't think you can force it like that. That is the specific browser software that inprets the control and renders it.
i think you may be misunderstanding me. let me show you an example:

asp .net code
Code:
<asp:Panel id="PartSearch" Runat="server">
    ...
    [i]content of panel[/i]
    ...
</asp:Panel>

What i get in IE
Code:
<div id="PartSearch">
    ...
    [i]content of panel[/i]
    ...
</div>

what i get in firefox
Code:
<table id="PartSearch" cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td>
    ...
    [i]content of panel[/i]
    ...
</td></tr></table>

my other option is to use the <div> in place of panel control. and then run it at the server so that i can change the css class to visible or not visible.

Code:
.visible
{
    display: block;
}

.notvisible
{
    display: none;
}

and then to change the "visibility" like so.
Code:
Me.PanelParts.Attributes.Remove("class")
Me.PanelParts.Attributes.Add("class", "visible")
OR
Code:
Me.PanelParts.Attributes.Remove("class")
Me.PanelParts.Attributes.Add("class", "notvisible")

this seems like a sloppy way to do it though

-Jer
 
I would like for it to render as a <div> all the time. How can i force it to render as a <div>.

I don't believe you can force the browser to intpret the asp.net control.
 
I don't believe you can force the browser to intpret the asp.net control.
I know. that's not what i am trying to do.


-Jer
 
when i say visible i don't necessarily mean the css visibility or display properties. i just don't want the user to see it. it can be invisible on the back end and not even show up in the html. or it show up in the html and not be displayed.

-Jer
 
What's wrong with just using:
Code:
myPanel.Visible = False
?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
What's wrong with just using:
Code:
myPanel.Visible = False
?
nothing. that is exactly what i am doing. however, like i have been saying, the <asp:panel> is being rendered as a <div> for IE and a one-cell <table> for Firefox.

found the exact same problem here:
(scroll to the bottom for the solution).

Solution: browsercap is not up-to-date on my local server. IIS is telling ASP .NET that the browser will not support elements like the <DIV>, therefore it is rendering it differently.

-Jer
 
The browser never see's the ASP.Net code, it only receives HTML. The problem had to have been Server side. And if you want a vote, go yell at your net admin for not having your environment patched.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
nothing. that is exactly what i am doing
Judging from your code above, you weren't doing that. You were using the Attributes tag to change the class.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
no one is reading my posts.

The browser never see's the ASP.Net code, it only receives HTML.
yeah, really?

Judging from your code above, you weren't doing that. You were using the Attributes tag to change the class.

I stated
my other option is to use the <div> in place of panel control. and then run it at the server so that i can change the css class to visible or not visible.
I meant 'other option' as being an alternative.

thanks.

-Jer
 
The browser never see's the ASP.Net code, it only receives HTML.
yeah, really?

Well mister "all that" if you already knew that the browser doesn't decide how to render ASP.Net code, why were you asking about it on the ASP.Net forum. Because you obviously [lookaround] knew that it was a server problem.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
why were you asking about it on the ASP.Net forum. Because you obviously knew that it was a server problem.

Not when i first first started the thread.

Obviously knew? if it was obvious why would i be posting?

The problem stems from the server, but it is ASP .NET's decision how to render its controls. The server is just providing the browser's type, capabilities, etc. It's not rendering anything.

-Jer
 
I meant 'other option' as being an alternative.
Oh, I see - I was supposed to guess that you were already using my suggestion! [smile]

If you don't provide all the facts up front, then I'm afraid we are going to cover things that you may already have tried. Giving as much information as possible will help solve problems quicker. Please try reading the FAQ in my signature for helpful tips on how to get better answers.

Also, sarcastic posts such as "yeah, really?" in response to helpful posts, have no place on these forums and will end up being deleted by management.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top