locked
Why can i not view the css style on browser but can see it on my design view? RRS feed

  • Question

  • User-539871281 posted
    <%@ Page Title="Student Registration Form" Language="VB" MasterPageFile="~/MasterPages/University.master" 
    AutoEventWireup="false" CodeFile="Register2.aspx.vb" Inherits="Register" %>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    
    <style type="text/css">
            .style1
            {
                width: 600px;
            }
            .style3
            {
                color: #000000;
                height: 39px;
            }
            .style4
            {
                color: #000000;
                height: 66px;
            }
            .style5
            {
                color: #000000;
                height: 33px;
            }
            .style6
            {
                color: #000000;
                height: 80px;
            }
        </style>
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="contentArea" Runat="Server">
    
        <h2 class="formTable">
            STUDENT REGISTRATION FORM</h2>
        <table class="formTable">
            <tr class="rowodd">
                <td class="style3">
                    Name:</td>
                <td class="style3">
                    <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredName" runat="server" 
                        ControlToValidate="txtName" ErrorMessage="RequiredFieldValidator">*Required value </asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr class="roweven">
                <td class="style4">
                    Student ID:</td>
                <td class="style4">
                    <asp:TextBox ID="txtStudentID" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredID" runat="server"
                    ControlToValidate="txtStudentID" ErrorMessage="RequiredFieldValidator"> *Required value</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                    ControlToValidate="txtStudentID" ErrorMessage="Please Enter Your Student ID Again" ValidationExpression="[Ss](\d{8})?"> *Incorrect ID</asp:RegularExpressionValidator>        
    
                </td>
            </tr>
            <tr class="rowodd">
                <td class="style5">
                    Password: </td>
                <td class="style5">
                    <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox>
                </td>
                
            </tr>
            <tr class="roweven" >
                <td class="style5">
                    Programme</td>
                <td class="style5">
                    <asp:DropDownList ID="ddlProgram" runat="server">
                        <asp:ListItem>BSc</asp:ListItem>
                        <asp:ListItem>BA</asp:ListItem>
                        <asp:ListItem>BComm</asp:ListItem>
                        <asp:ListItem>BEng</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr class="rowodd">
                <td class="style6">
                    Majors:</td>
                <td class="style6">
                    <asp:CheckBoxList ID="cblMajors" runat="server" RepeatColumns="3" 
                        DataSourceID="xdsMajors" DataTextField="name">
                    </asp:CheckBoxList>
                    <asp:XmlDataSource ID="xdsMajors" runat="server" 
                        DataFile="~/App_Data/Majors.xml"></asp:XmlDataSource>
                </td>
            </tr>
            <tr class="roweven">
                <td class="style3">
                    </td>
                <td class="style3">
    
                    <asp:Button ID="btnRegister" runat="server" Text="Register Me" />
                </td>
            </tr>
        </table>
        <p class="formTable">
            
        </p>
        <p class="formTable">
            
        </p>
        <p class="formTable">
            
            <asp:Label ID="lblVerify" runat="server"></asp:Label>
            
            <asp:AccessDataSource ID="adsStudent" runat="server" 
                DataFile="~/App_Data/Students.mdb" 
                DeleteCommand="DELETE FROM [Student] WHERE (([Stu_ID] = ?) OR ([Stu_ID] IS NULL AND ? IS NULL))" 
                InsertCommand="INSERT INTO [Student] ([Stu_ID], [Stu_Name], [Stu_Passwd], [Stu_Prog]) VALUES (?, ?, ?, ?)" 
                SelectCommand="SELECT * FROM [Student]" 
                UpdateCommand="UPDATE [Student] SET [Stu_Name] = ?, [Stu_Passwd] = ?, [Stu_Prog] = ? WHERE (([Stu_ID] = ?) OR ([Stu_ID] IS NULL AND ? IS NULL))">
                <DeleteParameters>
                    <asp:Parameter Name="Stu_ID" Type="String" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="Stu_ID" Type="String" />
                    <asp:Parameter Name="Stu_Name" Type="String" />
                    <asp:Parameter Name="Stu_Passwd" Type="String" />
                    <asp:Parameter Name="Stu_Prog" Type="String" />
                </InsertParameters>
                <UpdateParameters>
                    <asp:Parameter Name="Stu_Name" Type="String" />
                    <asp:Parameter Name="Stu_Passwd" Type="String" />
                    <asp:Parameter Name="Stu_Prog" Type="String" />
                    <asp:Parameter Name="Stu_ID" Type="String" />
                </UpdateParameters>
            </asp:AccessDataSource>
            <asp:AccessDataSource ID="adsMajors" runat="server" 
                DataFile="~/App_Data/Students.mdb" 
                DeleteCommand="DELETE FROM [StuMajors] WHERE (([Stu_Id] = ?) OR ([Stu_Id] IS NULL AND ? IS NULL)) AND (([Stu_Majors] = ?) OR ([Stu_Majors] IS NULL AND ? IS NULL))" 
                InsertCommand="INSERT INTO [StuMajors] ([Stu_Id], [Stu_Majors]) VALUES (?, ?)" 
                SelectCommand="SELECT * FROM [StuMajors]">
                <DeleteParameters>
                    <asp:Parameter Name="Stu_Id" Type="String" />
                    <asp:Parameter Name="Stu_Majors" Type="String" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="Stu_Id" Type="String" />
                    <asp:Parameter Name="Stu_Majors" Type="String" />
                </InsertParameters>
            </asp:AccessDataSource>
            
        </p>
    </asp:Content>
    
    


    <%@ Page Title="Student Registration Form" Language="VB" MasterPageFile="~/MasterPages/University.master" AutoEventWireup="false" CodeFile="Register2.aspx.vb" Inherits="Register" %> <asp:content id="Content1" contentplaceholderid="head" runat="Server"> <style type="text/css"> .style1 { width: 600px; } .style3 { color: #000000; height: 39px; } .style4 { color: #000000; height: 66px; } .style5 { color: #000000; height: 33px; } .style6 { color: #000000; height: 80px; } </style> </asp:content> <asp:content id="Content2" contentplaceholderid="contentArea" runat="Server"></asp:content>

    STUDENT REGISTRATION FORM

    Name: <asp:textbox id="txtName" runat="server"></asp:textbox> <asp:requiredfieldvalidator id="RequiredName" runat="server" controltovalidate="txtName" errormessage="RequiredFieldValidator">*Required value </asp:requiredfieldvalidator>
    Student ID: <asp:textbox id="txtStudentID" runat="server"></asp:textbox> <asp:requiredfieldvalidator id="RequiredID" runat="server" controltovalidate="txtStudentID" errormessage="RequiredFieldValidator"> *Required value</asp:requiredfieldvalidator> <asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server" controltovalidate="txtStudentID" errormessage="Please Enter Your Student ID Again" validationexpression="[Ss](\d{8})?"> *Incorrect ID</asp:regularexpressionvalidator>
    Password: <asp:textbox id="txtPassword" runat="server" textmode="Password"></asp:textbox>
    Programme <asp:dropdownlist id="ddlProgram" runat="server"> <asp:listitem>BSc</asp:listitem> <asp:listitem>BA</asp:listitem> <asp:listitem>BComm</asp:listitem> <asp:listitem>BEng</asp:listitem> </asp:dropdownlist>
    Majors: <asp:checkboxlist id="cblMajors" runat="server" repeatcolumns="3" datasourceid="xdsMajors" datatextfield="name"> </asp:checkboxlist> <asp:xmldatasource id="xdsMajors" runat="server" datafile="~/App_Data/Majors.xml"></asp:xmldatasource>
    <asp:button id="btnRegister" runat="server" text="Register Me"></asp:button>

    <asp:label id="lblVerify" runat="server"></asp:label> <asp:accessdatasource id="adsStudent" runat="server" datafile="~/App_Data/Students.mdb" deletecommand="DELETE FROM [Student] WHERE (([Stu_ID] = ?) OR ([Stu_ID] IS NULL AND ? IS NULL))" insertcommand="INSERT INTO [Student] ([Stu_ID], [Stu_Name], [Stu_Passwd], [Stu_Prog]) VALUES (?, ?, ?, ?)" selectcommand="SELECT * FROM [Student]" updatecommand="UPDATE [Student] SET [Stu_Name] = ?, [Stu_Passwd] = ?, [Stu_Prog] = ? WHERE (([Stu_ID] = ?) OR ([Stu_ID] IS NULL AND ? IS NULL))"> <deleteparameters> <asp:parameter name="Stu_ID" type="String"></asp:parameter> </deleteparameters> <insertparameters> <asp:parameter name="Stu_ID" type="String"></asp:parameter> <asp:parameter name="Stu_Name" type="String"></asp:parameter> <asp:parameter name="Stu_Passwd" type="String"></asp:parameter> <asp:parameter name="Stu_Prog" type="String"></asp:parameter> </insertparameters> <updateparameters> <asp:parameter name="Stu_Name" type="String"></asp:parameter> <asp:parameter name="Stu_Passwd" type="String"></asp:parameter> <asp:parameter name="Stu_Prog" type="String"></asp:parameter> <asp:parameter name="Stu_ID" type="String"></asp:parameter> </updateparameters> </asp:accessdatasource> <asp:accessdatasource id="adsMajors" runat="server" datafile="~/App_Data/Students.mdb" deletecommand="DELETE FROM [StuMajors] WHERE (([Stu_Id] = ?) OR ([Stu_Id] IS NULL AND ? IS NULL)) AND (([Stu_Majors] = ?) OR ([Stu_Majors] IS NULL AND ? IS NULL))" insertcommand="INSERT INTO [StuMajors] ([Stu_Id], [Stu_Majors]) VALUES (?, ?)" selectcommand="SELECT * FROM [StuMajors]"> <deleteparameters> <asp:parameter name="Stu_Id" type="String"></asp:parameter> <asp:parameter name="Stu_Majors" type="String"></asp:parameter> </deleteparameters> <insertparameters> <asp:parameter name="Stu_Id" type="String"></asp:parameter> <asp:parameter name="Stu_Majors" type="String"></asp:parameter> </insertparameters> </asp:accessdatasource>

    Wednesday, April 29, 2020 7:31 AM

Answers

  • User288213138 posted

    Hi Sweta_k,

    Why can i not view the css style on browser but can see it on my design view?

    I tested your code, it works fine in my site. Because the font color is black by default, color: # 000000 does not change the font color, you can try other color.

    Are there any settings in your master page that will change the style?

    The result:

    Best regards,

    Sam

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 30, 2020 3:36 AM

All replies

  • User288213138 posted

    Hi Sweta_k,

    Why can i not view the css style on browser but can see it on my design view?

    I tested your code, it works fine in my site. Because the font color is black by default, color: # 000000 does not change the font color, you can try other color.

    Are there any settings in your master page that will change the style?

    The result:

    Best regards,

    Sam

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 30, 2020 3:36 AM
  • User-539871281 posted
    <link id="Link1" href="~/Styles/default.css" runat="server" rel="stylesheet" type="text/css" media="screen" />

    I checked my Master page and this code was there so i just removed a part of the code and wrote it again. For some reason it worked!

    Thanks.

    Friday, May 1, 2020 3:08 AM