ASP with Mozilla

Discussion in 'ASP .Net Web Controls' started by news.iq.ca, Nov 22, 2004.

  1. news.iq.ca

    news.iq.ca Guest

    Hello,

    I am learning ASP.net (for the moment, I'm still writing the code by hand,
    in Notepad - VS.NET can wait for now).

    The original text code is this:

    --------------------------------------------------------------------------------------------------
    <p>
    <asp:label id="lbl1" text="Unbound, with ListItem." runat="Server"/>
    <p>
    <asp:listbox id="lstBox1" onselectedindexchanged="listbox_Changed"
    width="200" backcolor="Red" rows="3" runat="server">
    <asp:listitem text="Red" value="R"/>
    <asp:listitem text="Green" value="G" Selected="true"/>
    <asp:listitem text="Blue" value="B"/>
    </asp:listbox>
    --------------------------------------------------------------------------------------------------

    Microsoft or not, the code, once compiled, translates into HTML like this:

    MS Explorer:
    --------------------------------------------------------------------------------------------------
    <p>
    <span id="lbl1">Unbound, with ListItem.</span>
    <p>
    <select name="lstBox1" size="3" id="lstBox1"
    style="background-color:Red;width:200px;">
    <option value="R">Red</option>
    <option selected="selected" value="G">Green</option>
    <option value="B">Blue</option>
    --------------------------------------------------------------------------------------------------

    And this is the code rendered by Mozilla:
    --------------------------------------------------------------------------------------------------
    <p>
    <span id="lbl1">Unbound, with ListItem.</span>
    <p>
    <select name="lstBox1" size="3" id="lstBox1">
    <option value="R">Red</option>
    <option selected="selected" value="G">Green</option>
    <option value="B">Blue</option>
    --------------------------------------------------------------------------------------------------

    My question is - what happened to the "style" tag in Mozilla ? As a result,
    the page does look VERY different than the page rendered by Explorer !

    In my ASP book I read that ASP.net, regardless of the language (VB, C#...)
    and the controls used, still sends the result in standard HTML, as much as
    possible (meaning that if a feature exists in ASP.NET but not in HTML,
    obviously, it won't be taken into consideration by the browser). Still, the
    background-color is standard HTML, or the "width"- there's nothing fancy
    about this code, like, for instance, usage of a Calendar Web Control, or an
    Ad Rotator, or a RangeValidator. So either the book is wrong, either Mozilla
    understands HTML only partially.

    Thank you,
    Alex
     
    news.iq.ca, Nov 22, 2004
    #1
    1. Advertising

  2. news.iq.ca

    Jos Guest

    news.iq.ca wrote:
    > Hello,
    >
    > I am learning ASP.net (for the moment, I'm still writing the code by
    > hand, in Notepad - VS.NET can wait for now).
    >
    > The original text code is this:
    >
    > --------------------------------------------------------------------------

    ------------------------
    > <p>
    > <asp:label id="lbl1" text="Unbound, with ListItem." runat="Server"/>
    > <p>
    > <asp:listbox id="lstBox1" onselectedindexchanged="listbox_Changed"
    > width="200" backcolor="Red" rows="3" runat="server">
    > <asp:listitem text="Red" value="R"/>
    > <asp:listitem text="Green" value="G" Selected="true"/>
    > <asp:listitem text="Blue" value="B"/>
    > </asp:listbox>
    > --------------------------------------------------------------------------

    ------------------------
    >
    > Microsoft or not, the code, once compiled, translates into HTML like
    > this:
    >
    > MS Explorer:
    > --------------------------------------------------------------------------

    ------------------------
    > <p>
    > <span id="lbl1">Unbound, with ListItem.</span>
    > <p>
    > <select name="lstBox1" size="3" id="lstBox1"
    > style="background-color:Red;width:200px;">
    > <option value="R">Red</option>
    > <option selected="selected" value="G">Green</option>
    > <option value="B">Blue</option>
    > --------------------------------------------------------------------------

    ------------------------
    >
    > And this is the code rendered by Mozilla:
    > --------------------------------------------------------------------------

    ------------------------
    > <p>
    > <span id="lbl1">Unbound, with ListItem.</span>
    > <p>
    > <select name="lstBox1" size="3" id="lstBox1">
    > <option value="R">Red</option>
    > <option selected="selected" value="G">Green</option>
    > <option value="B">Blue</option>
    > --------------------------------------------------------------------------

    ------------------------
    >
    > My question is - what happened to the "style" tag in Mozilla ? As a
    > result,
    > the page does look VERY different than the page rendered by Explorer !
    >
    > In my ASP book I read that ASP.net, regardless of the language (VB,
    > C#...)
    > and the controls used, still sends the result in standard HTML, as
    > much as
    > possible (meaning that if a feature exists in ASP.NET but not in HTML,
    > obviously, it won't be taken into consideration by the browser).
    > Still, the
    > background-color is standard HTML, or the "width"- there's nothing
    > fancy
    > about this code, like, for instance, usage of a Calendar Web Control,
    > or an
    > Ad Rotator, or a RangeValidator. So either the book is wrong, either
    > Mozilla understands HTML only partially.
    >
    > Thank you,
    > Alex


    I guess ASP.NET is wrongly assuming that Mozilla doesn't know the style
    attribute.

    You can work around it by adding the style attribute to the asp:Listbox tag
    yourself.
    When you do, you will be able to check for yourself that Mozilla understands
    the HTML.

    --

    Jos
     
    Jos, Nov 22, 2004
    #2
    1. Advertising

  3. Yes,
    The Microsoft provided browser detection strings are braindead as
    they relate to any non-IE browser. You need to grab an updated
    browserCaps definition to paste into your web.config [or machine.config
    if you want]. The URL to grab an updated one is:

    http://slingfive.com/pages/code/browserCaps/

    Ben

    news.iq.ca wrote:
    > Hello,
    >
    > I am learning ASP.net (for the moment, I'm still writing the code by hand,
    > in Notepad - VS.NET can wait for now).
    >
    > The original text code is this:
    >
    > --------------------------------------------------------------------------------------------------
    > <p>
    > <asp:label id="lbl1" text="Unbound, with ListItem." runat="Server"/>
    > <p>
    > <asp:listbox id="lstBox1" onselectedindexchanged="listbox_Changed"
    > width="200" backcolor="Red" rows="3" runat="server">
    > <asp:listitem text="Red" value="R"/>
    > <asp:listitem text="Green" value="G" Selected="true"/>
    > <asp:listitem text="Blue" value="B"/>
    > </asp:listbox>
    > --------------------------------------------------------------------------------------------------
    >
    > Microsoft or not, the code, once compiled, translates into HTML like this:
    >
    > MS Explorer:
    > --------------------------------------------------------------------------------------------------
    > <p>
    > <span id="lbl1">Unbound, with ListItem.</span>
    > <p>
    > <select name="lstBox1" size="3" id="lstBox1"
    > style="background-color:Red;width:200px;">
    > <option value="R">Red</option>
    > <option selected="selected" value="G">Green</option>
    > <option value="B">Blue</option>
    > --------------------------------------------------------------------------------------------------
    >
    > And this is the code rendered by Mozilla:
    > --------------------------------------------------------------------------------------------------
    > <p>
    > <span id="lbl1">Unbound, with ListItem.</span>
    > <p>
    > <select name="lstBox1" size="3" id="lstBox1">
    > <option value="R">Red</option>
    > <option selected="selected" value="G">Green</option>
    > <option value="B">Blue</option>
    > --------------------------------------------------------------------------------------------------
    >
    > My question is - what happened to the "style" tag in Mozilla ? As a result,
    > the page does look VERY different than the page rendered by Explorer !
    >
    > In my ASP book I read that ASP.net, regardless of the language (VB, C#...)
    > and the controls used, still sends the result in standard HTML, as much as
    > possible (meaning that if a feature exists in ASP.NET but not in HTML,
    > obviously, it won't be taken into consideration by the browser). Still, the
    > background-color is standard HTML, or the "width"- there's nothing fancy
    > about this code, like, for instance, usage of a Calendar Web Control, or an
    > Ad Rotator, or a RangeValidator. So either the book is wrong, either Mozilla
    > understands HTML only partially.
    >
    > Thank you,
    > Alex
    >
    >
     
    Benjamin Gavin, Nov 22, 2004
    #3
  4. news.iq.ca

    news.iq.ca Guest

    Perfect ! Thank you - it worked like a charm. Now my pages looks the same in
    both IE and Mozilla.

    Thanks again,
    Alex.

    "Benjamin Gavin" <"ben <ns> wrote in message
    news:%...
    > Yes,
    > The Microsoft provided browser detection strings are braindead as they
    > relate to any non-IE browser. You need to grab an updated browserCaps
    > definition to paste into your web.config [or machine.config if you want].
    > The URL to grab an updated one is:
    >
    > http://slingfive.com/pages/code/browserCaps/
    >
    > Ben
    >
    > news.iq.ca wrote:
    >> Hello,
    >>
    >> I am learning ASP.net (for the moment, I'm still writing the code by
    >> hand, in Notepad - VS.NET can wait for now).
    >>
    >> The original text code is this:
    >>
    >> --------------------------------------------------------------------------------------------------
    >> <p>
    >> <asp:label id="lbl1" text="Unbound, with ListItem." runat="Server"/>
    >> <p>
    >> <asp:listbox id="lstBox1" onselectedindexchanged="listbox_Changed"
    >> width="200" backcolor="Red" rows="3" runat="server">
    >> <asp:listitem text="Red" value="R"/>
    >> <asp:listitem text="Green" value="G" Selected="true"/>
    >> <asp:listitem text="Blue" value="B"/>
    >> </asp:listbox>
    >> --------------------------------------------------------------------------------------------------
    >>
    >> Microsoft or not, the code, once compiled, translates into HTML like
    >> this:
    >>
    >> MS Explorer:
    >> --------------------------------------------------------------------------------------------------
    >> <p>
    >> <span id="lbl1">Unbound, with ListItem.</span>
    >> <p>
    >> <select name="lstBox1" size="3" id="lstBox1"
    >> style="background-color:Red;width:200px;">
    >> <option value="R">Red</option>
    >> <option selected="selected" value="G">Green</option>
    >> <option value="B">Blue</option>
    >> --------------------------------------------------------------------------------------------------
    >>
    >> And this is the code rendered by Mozilla:
    >> --------------------------------------------------------------------------------------------------
    >> <p>
    >> <span id="lbl1">Unbound, with ListItem.</span>
    >> <p>
    >> <select name="lstBox1" size="3" id="lstBox1">
    >> <option value="R">Red</option>
    >> <option selected="selected" value="G">Green</option>
    >> <option value="B">Blue</option>
    >> --------------------------------------------------------------------------------------------------
    >>
    >> My question is - what happened to the "style" tag in Mozilla ? As a
    >> result, the page does look VERY different than the page rendered by
    >> Explorer !
    >>
    >> In my ASP book I read that ASP.net, regardless of the language (VB,
    >> C#...) and the controls used, still sends the result in standard HTML, as
    >> much as possible (meaning that if a feature exists in ASP.NET but not in
    >> HTML, obviously, it won't be taken into consideration by the browser).
    >> Still, the background-color is standard HTML, or the "width"- there's
    >> nothing fancy about this code, like, for instance, usage of a Calendar
    >> Web Control, or an Ad Rotator, or a RangeValidator. So either the book is
    >> wrong, either Mozilla understands HTML only partially.
    >>
    >> Thank you,
    >> Alex
     
    news.iq.ca, Nov 22, 2004
    #4
  5. news.iq.ca

    Burak Guest

    <SPAN> tag's style doesn't show up in netscape Re: ASP with Mozilla

    Hello,

    I am creating an <asp:label> dynamically and setting its width in the
    code behind as follows

    Dim lbl3 As New Label
    lbl3.Text = name
    lbl3.Width = System.Web.UI.WebControls.Unit.Point(255)
    pnlMain.Controls.Add(lbl3)

    This gets rendered as

    <span style="width:255pt;">

    which shows up fine in IE but not in Netscape 7.1

    I added the browsercaps definition into the web.config file as you
    wrote but the width is still not getting set for the span in Netscape.

    Do you have any other suggestions?

    Thank you,

    Burak

    Benjamin Gavin <"ben <ns> wrote in message news:<#>...
    > Yes,
    > The Microsoft provided browser detection strings are braindead as
    > they relate to any non-IE browser. You need to grab an updated
    > browserCaps definition to paste into your web.config [or machine.config
    > if you want]. The URL to grab an updated one is:
    >
    > http://slingfive.com/pages/code/browserCaps/
    >
    > Ben
    >
    > news.iq.ca wrote:
    > > Hello,
    > >
    > > I am learning ASP.net (for the moment, I'm still writing the code by hand,
    > > in Notepad - VS.NET can wait for now).
    > >
    > > The original text code is this:
    > >
    > > --------------------------------------------------------------------------------------------------
    > > <p>
    > > <asp:label id="lbl1" text="Unbound, with ListItem." runat="Server"/>
    > > <p>
    > > <asp:listbox id="lstBox1" onselectedindexchanged="listbox_Changed"
    > > width="200" backcolor="Red" rows="3" runat="server">
    > > <asp:listitem text="Red" value="R"/>
    > > <asp:listitem text="Green" value="G" Selected="true"/>
    > > <asp:listitem text="Blue" value="B"/>
    > > </asp:listbox>
    > > --------------------------------------------------------------------------------------------------
    > >
    > > Microsoft or not, the code, once compiled, translates into HTML like this:
    > >
    > > MS Explorer:
    > > --------------------------------------------------------------------------------------------------
    > > <p>
    > > <span id="lbl1">Unbound, with ListItem.</span>
    > > <p>
    > > <select name="lstBox1" size="3" id="lstBox1"
    > > style="background-color:Red;width:200px;">
    > > <option value="R">Red</option>
    > > <option selected="selected" value="G">Green</option>
    > > <option value="B">Blue</option>
    > > --------------------------------------------------------------------------------------------------
    > >
    > > And this is the code rendered by Mozilla:
    > > --------------------------------------------------------------------------------------------------
    > > <p>
    > > <span id="lbl1">Unbound, with ListItem.</span>
    > > <p>
    > > <select name="lstBox1" size="3" id="lstBox1">
    > > <option value="R">Red</option>
    > > <option selected="selected" value="G">Green</option>
    > > <option value="B">Blue</option>
    > > --------------------------------------------------------------------------------------------------
    > >
    > > My question is - what happened to the "style" tag in Mozilla ? As a result,
    > > the page does look VERY different than the page rendered by Explorer !
    > >
    > > In my ASP book I read that ASP.net, regardless of the language (VB, C#...)
    > > and the controls used, still sends the result in standard HTML, as much as
    > > possible (meaning that if a feature exists in ASP.NET but not in HTML,
    > > obviously, it won't be taken into consideration by the browser). Still, the
    > > background-color is standard HTML, or the "width"- there's nothing fancy
    > > about this code, like, for instance, usage of a Calendar Web Control, or an
    > > Ad Rotator, or a RangeValidator. So either the book is wrong, either Mozilla
    > > understands HTML only partially.
    > >
    > > Thank you,
    > > Alex
    > >
    > >
     
    Burak, Nov 24, 2004
    #5
  6. news.iq.ca

    Jens Ansorg Guest

    Re: <SPAN> tag's style doesn't show up in netscape Re: ASP with Mozilla

    Burak wrote:
    > Hello,
    >
    > I am creating an <asp:label> dynamically and setting its width in the
    > code behind as follows
    >
    > Dim lbl3 As New Label
    > lbl3.Text = name
    > lbl3.Width = System.Web.UI.WebControls.Unit.Point(255)
    > pnlMain.Controls.Add(lbl3)
    >
    > This gets rendered as
    >
    > <span style="width:255pt;">
    >
    > which shows up fine in IE but not in Netscape 7.1
    >
    > I added the browsercaps definition into the web.config file as you
    > wrote but the width is still not getting set for the span in Netscape.
    >


    SPAN is an inline element as opposed to i.e. DIV,P which are block elements.

    inline elements get placed in the text flow of a page comparable to a
    single Letter/character and therefore cannot be defined to have a
    certain width.

    Mozilla rendering is as dpecified
    MSIE is wrong.

    If xou need something to be of y certain size it has to be a block level
    element like a DIV.

    You could try to override the render method of a control to get the
    correct HTML code


    ..net is from Microsoft and it shows on every corner :(
     
    Jens Ansorg, Nov 26, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Evanchik
    Replies:
    1
    Views:
    1,019
    Teemu Keiski
    Nov 10, 2003
  2. Jonel Rienton

    ASP.Net and Mozilla browsers

    Jonel Rienton, Nov 28, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    2,277
    stefano mostarda
    Nov 28, 2003
  3. nospam
    Replies:
    4
    Views:
    1,725
    nandulwc
    Sep 9, 2009
  4. Pai
    Replies:
    1
    Views:
    1,039
    Peter Blum
    Apr 23, 2004
  5. Henri
    Replies:
    9
    Views:
    1,862
    Toby Inkster
    Feb 22, 2005
Loading...

Share This Page