Asp.net input type =“text” vs asp:textbox











up vote
0
down vote

favorite












I'm new Asp.Net.I have input type="text" also I have css class for input[type="text"]. So I have an asp:textbox. How can I write css class for my asp:textbox which is a different css class then the one for input?



My asp:textbox takes properties from
.login-box input[type=text], input[type=password]



<div class="login-box" style="padding:70px 30px">
<img src="Imageshuman.png" class="man"/>
<h1>Login Here</h1>
<p>Username</p>
<input id="username" type="text" name="username" placeholder="Enter Username" runat="server"/>
<p>Password</p>
<input type="password" name="password" placeholder="Enter Password"/>
<asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click"/>
<asp:TextBox ID="txtError" CssClass="text-hide" runat="server">Incorrect username or password!</asp:TextBox>
<a href="#">Forgot Password</a>
</div>


My style.css below:



.login-box input {
width: 100%;
margin-bottom: 20px;
}
.text-hide {
height:40px;
border-color:Transparent;
background-color:Transparent;
color:Red;
}
.login-box input[type=text], input[type=password] {
height: 40px;
border: 0;
border-bottom: 1px solid #fff;
background-color: transparent;
color: #fff;
font-size: 16px;
outline: none;
}









share|improve this question
























  • Please help me..
    – fico
    Nov 22 at 14:01










  • start by placing your .aspx page here. Also have you tried anything yourself to solve the issue
    – JustLearning
    Nov 22 at 14:02






  • 2




    add CssClass="class1 class2 classX" this is the way you can add multiple classes to asp.net webform elements.
    – SehaxX
    Nov 22 at 14:16










  • The term "css class" is usually used for the name that is specified in the "class" attribute on the element. input[type=text] is a selector, probably before a block of declarations in a .css file (or style element) ref. What exactly do you mean?
    – Hans Kesting
    Nov 22 at 14:31















up vote
0
down vote

favorite












I'm new Asp.Net.I have input type="text" also I have css class for input[type="text"]. So I have an asp:textbox. How can I write css class for my asp:textbox which is a different css class then the one for input?



My asp:textbox takes properties from
.login-box input[type=text], input[type=password]



<div class="login-box" style="padding:70px 30px">
<img src="Imageshuman.png" class="man"/>
<h1>Login Here</h1>
<p>Username</p>
<input id="username" type="text" name="username" placeholder="Enter Username" runat="server"/>
<p>Password</p>
<input type="password" name="password" placeholder="Enter Password"/>
<asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click"/>
<asp:TextBox ID="txtError" CssClass="text-hide" runat="server">Incorrect username or password!</asp:TextBox>
<a href="#">Forgot Password</a>
</div>


My style.css below:



.login-box input {
width: 100%;
margin-bottom: 20px;
}
.text-hide {
height:40px;
border-color:Transparent;
background-color:Transparent;
color:Red;
}
.login-box input[type=text], input[type=password] {
height: 40px;
border: 0;
border-bottom: 1px solid #fff;
background-color: transparent;
color: #fff;
font-size: 16px;
outline: none;
}









share|improve this question
























  • Please help me..
    – fico
    Nov 22 at 14:01










  • start by placing your .aspx page here. Also have you tried anything yourself to solve the issue
    – JustLearning
    Nov 22 at 14:02






  • 2




    add CssClass="class1 class2 classX" this is the way you can add multiple classes to asp.net webform elements.
    – SehaxX
    Nov 22 at 14:16










  • The term "css class" is usually used for the name that is specified in the "class" attribute on the element. input[type=text] is a selector, probably before a block of declarations in a .css file (or style element) ref. What exactly do you mean?
    – Hans Kesting
    Nov 22 at 14:31













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm new Asp.Net.I have input type="text" also I have css class for input[type="text"]. So I have an asp:textbox. How can I write css class for my asp:textbox which is a different css class then the one for input?



My asp:textbox takes properties from
.login-box input[type=text], input[type=password]



<div class="login-box" style="padding:70px 30px">
<img src="Imageshuman.png" class="man"/>
<h1>Login Here</h1>
<p>Username</p>
<input id="username" type="text" name="username" placeholder="Enter Username" runat="server"/>
<p>Password</p>
<input type="password" name="password" placeholder="Enter Password"/>
<asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click"/>
<asp:TextBox ID="txtError" CssClass="text-hide" runat="server">Incorrect username or password!</asp:TextBox>
<a href="#">Forgot Password</a>
</div>


My style.css below:



.login-box input {
width: 100%;
margin-bottom: 20px;
}
.text-hide {
height:40px;
border-color:Transparent;
background-color:Transparent;
color:Red;
}
.login-box input[type=text], input[type=password] {
height: 40px;
border: 0;
border-bottom: 1px solid #fff;
background-color: transparent;
color: #fff;
font-size: 16px;
outline: none;
}









share|improve this question















I'm new Asp.Net.I have input type="text" also I have css class for input[type="text"]. So I have an asp:textbox. How can I write css class for my asp:textbox which is a different css class then the one for input?



My asp:textbox takes properties from
.login-box input[type=text], input[type=password]



<div class="login-box" style="padding:70px 30px">
<img src="Imageshuman.png" class="man"/>
<h1>Login Here</h1>
<p>Username</p>
<input id="username" type="text" name="username" placeholder="Enter Username" runat="server"/>
<p>Password</p>
<input type="password" name="password" placeholder="Enter Password"/>
<asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click"/>
<asp:TextBox ID="txtError" CssClass="text-hide" runat="server">Incorrect username or password!</asp:TextBox>
<a href="#">Forgot Password</a>
</div>


My style.css below:



.login-box input {
width: 100%;
margin-bottom: 20px;
}
.text-hide {
height:40px;
border-color:Transparent;
background-color:Transparent;
color:Red;
}
.login-box input[type=text], input[type=password] {
height: 40px;
border: 0;
border-bottom: 1px solid #fff;
background-color: transparent;
color: #fff;
font-size: 16px;
outline: none;
}






asp.net webforms






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 at 8:46

























asked Nov 22 at 13:58









fico

14




14












  • Please help me..
    – fico
    Nov 22 at 14:01










  • start by placing your .aspx page here. Also have you tried anything yourself to solve the issue
    – JustLearning
    Nov 22 at 14:02






  • 2




    add CssClass="class1 class2 classX" this is the way you can add multiple classes to asp.net webform elements.
    – SehaxX
    Nov 22 at 14:16










  • The term "css class" is usually used for the name that is specified in the "class" attribute on the element. input[type=text] is a selector, probably before a block of declarations in a .css file (or style element) ref. What exactly do you mean?
    – Hans Kesting
    Nov 22 at 14:31


















  • Please help me..
    – fico
    Nov 22 at 14:01










  • start by placing your .aspx page here. Also have you tried anything yourself to solve the issue
    – JustLearning
    Nov 22 at 14:02






  • 2




    add CssClass="class1 class2 classX" this is the way you can add multiple classes to asp.net webform elements.
    – SehaxX
    Nov 22 at 14:16










  • The term "css class" is usually used for the name that is specified in the "class" attribute on the element. input[type=text] is a selector, probably before a block of declarations in a .css file (or style element) ref. What exactly do you mean?
    – Hans Kesting
    Nov 22 at 14:31
















Please help me..
– fico
Nov 22 at 14:01




Please help me..
– fico
Nov 22 at 14:01












start by placing your .aspx page here. Also have you tried anything yourself to solve the issue
– JustLearning
Nov 22 at 14:02




start by placing your .aspx page here. Also have you tried anything yourself to solve the issue
– JustLearning
Nov 22 at 14:02




2




2




add CssClass="class1 class2 classX" this is the way you can add multiple classes to asp.net webform elements.
– SehaxX
Nov 22 at 14:16




add CssClass="class1 class2 classX" this is the way you can add multiple classes to asp.net webform elements.
– SehaxX
Nov 22 at 14:16












The term "css class" is usually used for the name that is specified in the "class" attribute on the element. input[type=text] is a selector, probably before a block of declarations in a .css file (or style element) ref. What exactly do you mean?
– Hans Kesting
Nov 22 at 14:31




The term "css class" is usually used for the name that is specified in the "class" attribute on the element. input[type=text] is a selector, probably before a block of declarations in a .css file (or style element) ref. What exactly do you mean?
– Hans Kesting
Nov 22 at 14:31












3 Answers
3






active

oldest

votes

















up vote
1
down vote













Use CssClass property. Like so:



<asp:TextBox ID="txtError" CssClass="text-hide" runat="server">


This will turn into :



<input type="text" class="text-hide">


on the page






share|improve this answer





















  • adinas , What does CssClass="text-hide" in your code?
    – fico
    Nov 22 at 14:18










  • When using a webforms server control and you want to give it a CSS class you use "CssClass". In this case we are telling the tag to use the CSS class "text-hide"
    – adinas
    Nov 22 at 14:19












  • I wrote class for textbox but it takes properties from in class of input type=text
    – fico
    Nov 22 at 14:22










  • So overwrite them. in the class "text-hide"
    – adinas
    Nov 22 at 14:23










  • for example if you have input[type="text"]{color:red} and in .text-hide{color:blue} then the blue will override the red
    – adinas
    Nov 22 at 14:24




















up vote
1
down vote













You want to use a label, literal or panel all can be used with asp: prefix to show some message in ASP.Net Web Form.



You don't add messages in input fields like in your example



<asp:Label ID="txtError" CssClass="text-hide" runat="server" Text="Incorrect username or password!"></asp:Label>


After this you can reference this class in your CSS like this:



.text-hide {
}





share|improve this answer






























    up vote
    0
    down vote













    Username



        <input id="username" type="text" name="username" placeholder="Enter Username" runat="server"/>
    <p>Password</p>
    <input type="password" name="password" placeholder="Enter Password"/>
    <asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click"/>
    <asp:TextBox ID="txtError" class="text-hide" runat="server">Incorrect username or password!</asp:TextBox>





    share|improve this answer

















    • 3




      please edit your question end add this, not as an answer.
      – SehaxX
      Nov 22 at 14:13










    • Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
      – Bidou
      Nov 22 at 14:45











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53432596%2fasp-net-input-type-text-vs-asptextbox%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    Use CssClass property. Like so:



    <asp:TextBox ID="txtError" CssClass="text-hide" runat="server">


    This will turn into :



    <input type="text" class="text-hide">


    on the page






    share|improve this answer





















    • adinas , What does CssClass="text-hide" in your code?
      – fico
      Nov 22 at 14:18










    • When using a webforms server control and you want to give it a CSS class you use "CssClass". In this case we are telling the tag to use the CSS class "text-hide"
      – adinas
      Nov 22 at 14:19












    • I wrote class for textbox but it takes properties from in class of input type=text
      – fico
      Nov 22 at 14:22










    • So overwrite them. in the class "text-hide"
      – adinas
      Nov 22 at 14:23










    • for example if you have input[type="text"]{color:red} and in .text-hide{color:blue} then the blue will override the red
      – adinas
      Nov 22 at 14:24

















    up vote
    1
    down vote













    Use CssClass property. Like so:



    <asp:TextBox ID="txtError" CssClass="text-hide" runat="server">


    This will turn into :



    <input type="text" class="text-hide">


    on the page






    share|improve this answer





















    • adinas , What does CssClass="text-hide" in your code?
      – fico
      Nov 22 at 14:18










    • When using a webforms server control and you want to give it a CSS class you use "CssClass". In this case we are telling the tag to use the CSS class "text-hide"
      – adinas
      Nov 22 at 14:19












    • I wrote class for textbox but it takes properties from in class of input type=text
      – fico
      Nov 22 at 14:22










    • So overwrite them. in the class "text-hide"
      – adinas
      Nov 22 at 14:23










    • for example if you have input[type="text"]{color:red} and in .text-hide{color:blue} then the blue will override the red
      – adinas
      Nov 22 at 14:24















    up vote
    1
    down vote










    up vote
    1
    down vote









    Use CssClass property. Like so:



    <asp:TextBox ID="txtError" CssClass="text-hide" runat="server">


    This will turn into :



    <input type="text" class="text-hide">


    on the page






    share|improve this answer












    Use CssClass property. Like so:



    <asp:TextBox ID="txtError" CssClass="text-hide" runat="server">


    This will turn into :



    <input type="text" class="text-hide">


    on the page







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 22 at 14:16









    adinas

    2,10732531




    2,10732531












    • adinas , What does CssClass="text-hide" in your code?
      – fico
      Nov 22 at 14:18










    • When using a webforms server control and you want to give it a CSS class you use "CssClass". In this case we are telling the tag to use the CSS class "text-hide"
      – adinas
      Nov 22 at 14:19












    • I wrote class for textbox but it takes properties from in class of input type=text
      – fico
      Nov 22 at 14:22










    • So overwrite them. in the class "text-hide"
      – adinas
      Nov 22 at 14:23










    • for example if you have input[type="text"]{color:red} and in .text-hide{color:blue} then the blue will override the red
      – adinas
      Nov 22 at 14:24




















    • adinas , What does CssClass="text-hide" in your code?
      – fico
      Nov 22 at 14:18










    • When using a webforms server control and you want to give it a CSS class you use "CssClass". In this case we are telling the tag to use the CSS class "text-hide"
      – adinas
      Nov 22 at 14:19












    • I wrote class for textbox but it takes properties from in class of input type=text
      – fico
      Nov 22 at 14:22










    • So overwrite them. in the class "text-hide"
      – adinas
      Nov 22 at 14:23










    • for example if you have input[type="text"]{color:red} and in .text-hide{color:blue} then the blue will override the red
      – adinas
      Nov 22 at 14:24


















    adinas , What does CssClass="text-hide" in your code?
    – fico
    Nov 22 at 14:18




    adinas , What does CssClass="text-hide" in your code?
    – fico
    Nov 22 at 14:18












    When using a webforms server control and you want to give it a CSS class you use "CssClass". In this case we are telling the tag to use the CSS class "text-hide"
    – adinas
    Nov 22 at 14:19






    When using a webforms server control and you want to give it a CSS class you use "CssClass". In this case we are telling the tag to use the CSS class "text-hide"
    – adinas
    Nov 22 at 14:19














    I wrote class for textbox but it takes properties from in class of input type=text
    – fico
    Nov 22 at 14:22




    I wrote class for textbox but it takes properties from in class of input type=text
    – fico
    Nov 22 at 14:22












    So overwrite them. in the class "text-hide"
    – adinas
    Nov 22 at 14:23




    So overwrite them. in the class "text-hide"
    – adinas
    Nov 22 at 14:23












    for example if you have input[type="text"]{color:red} and in .text-hide{color:blue} then the blue will override the red
    – adinas
    Nov 22 at 14:24






    for example if you have input[type="text"]{color:red} and in .text-hide{color:blue} then the blue will override the red
    – adinas
    Nov 22 at 14:24














    up vote
    1
    down vote













    You want to use a label, literal or panel all can be used with asp: prefix to show some message in ASP.Net Web Form.



    You don't add messages in input fields like in your example



    <asp:Label ID="txtError" CssClass="text-hide" runat="server" Text="Incorrect username or password!"></asp:Label>


    After this you can reference this class in your CSS like this:



    .text-hide {
    }





    share|improve this answer



























      up vote
      1
      down vote













      You want to use a label, literal or panel all can be used with asp: prefix to show some message in ASP.Net Web Form.



      You don't add messages in input fields like in your example



      <asp:Label ID="txtError" CssClass="text-hide" runat="server" Text="Incorrect username or password!"></asp:Label>


      After this you can reference this class in your CSS like this:



      .text-hide {
      }





      share|improve this answer

























        up vote
        1
        down vote










        up vote
        1
        down vote









        You want to use a label, literal or panel all can be used with asp: prefix to show some message in ASP.Net Web Form.



        You don't add messages in input fields like in your example



        <asp:Label ID="txtError" CssClass="text-hide" runat="server" Text="Incorrect username or password!"></asp:Label>


        After this you can reference this class in your CSS like this:



        .text-hide {
        }





        share|improve this answer














        You want to use a label, literal or panel all can be used with asp: prefix to show some message in ASP.Net Web Form.



        You don't add messages in input fields like in your example



        <asp:Label ID="txtError" CssClass="text-hide" runat="server" Text="Incorrect username or password!"></asp:Label>


        After this you can reference this class in your CSS like this:



        .text-hide {
        }






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 22 at 15:19









        Hinek

        6,599114370




        6,599114370










        answered Nov 22 at 14:23









        SehaxX

        5601516




        5601516






















            up vote
            0
            down vote













            Username



                <input id="username" type="text" name="username" placeholder="Enter Username" runat="server"/>
            <p>Password</p>
            <input type="password" name="password" placeholder="Enter Password"/>
            <asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click"/>
            <asp:TextBox ID="txtError" class="text-hide" runat="server">Incorrect username or password!</asp:TextBox>





            share|improve this answer

















            • 3




              please edit your question end add this, not as an answer.
              – SehaxX
              Nov 22 at 14:13










            • Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
              – Bidou
              Nov 22 at 14:45















            up vote
            0
            down vote













            Username



                <input id="username" type="text" name="username" placeholder="Enter Username" runat="server"/>
            <p>Password</p>
            <input type="password" name="password" placeholder="Enter Password"/>
            <asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click"/>
            <asp:TextBox ID="txtError" class="text-hide" runat="server">Incorrect username or password!</asp:TextBox>





            share|improve this answer

















            • 3




              please edit your question end add this, not as an answer.
              – SehaxX
              Nov 22 at 14:13










            • Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
              – Bidou
              Nov 22 at 14:45













            up vote
            0
            down vote










            up vote
            0
            down vote









            Username



                <input id="username" type="text" name="username" placeholder="Enter Username" runat="server"/>
            <p>Password</p>
            <input type="password" name="password" placeholder="Enter Password"/>
            <asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click"/>
            <asp:TextBox ID="txtError" class="text-hide" runat="server">Incorrect username or password!</asp:TextBox>





            share|improve this answer












            Username



                <input id="username" type="text" name="username" placeholder="Enter Username" runat="server"/>
            <p>Password</p>
            <input type="password" name="password" placeholder="Enter Password"/>
            <asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click"/>
            <asp:TextBox ID="txtError" class="text-hide" runat="server">Incorrect username or password!</asp:TextBox>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 22 at 14:05









            fico

            14




            14








            • 3




              please edit your question end add this, not as an answer.
              – SehaxX
              Nov 22 at 14:13










            • Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
              – Bidou
              Nov 22 at 14:45














            • 3




              please edit your question end add this, not as an answer.
              – SehaxX
              Nov 22 at 14:13










            • Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
              – Bidou
              Nov 22 at 14:45








            3




            3




            please edit your question end add this, not as an answer.
            – SehaxX
            Nov 22 at 14:13




            please edit your question end add this, not as an answer.
            – SehaxX
            Nov 22 at 14:13












            Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
            – Bidou
            Nov 22 at 14:45




            Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
            – Bidou
            Nov 22 at 14:45


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53432596%2fasp-net-input-type-text-vs-asptextbox%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            What visual should I use to simply compare current year value vs last year in Power BI desktop

            Alexandru Averescu

            Trompette piccolo