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





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















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 '18 at 14:01











  • start by placing your .aspx page here. Also have you tried anything yourself to solve the issue

    – JustLearning
    Nov 22 '18 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 '18 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 '18 at 14:31


















0















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 '18 at 14:01











  • start by placing your .aspx page here. Also have you tried anything yourself to solve the issue

    – JustLearning
    Nov 22 '18 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 '18 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 '18 at 14:31














0












0








0








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 '18 at 8:46







fico

















asked Nov 22 '18 at 13:58









ficofico

16




16













  • Please help me..

    – fico
    Nov 22 '18 at 14:01











  • start by placing your .aspx page here. Also have you tried anything yourself to solve the issue

    – JustLearning
    Nov 22 '18 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 '18 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 '18 at 14:31



















  • Please help me..

    – fico
    Nov 22 '18 at 14:01











  • start by placing your .aspx page here. Also have you tried anything yourself to solve the issue

    – JustLearning
    Nov 22 '18 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 '18 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 '18 at 14:31

















Please help me..

– fico
Nov 22 '18 at 14:01





Please help me..

– fico
Nov 22 '18 at 14:01













start by placing your .aspx page here. Also have you tried anything yourself to solve the issue

– JustLearning
Nov 22 '18 at 14:02





start by placing your .aspx page here. Also have you tried anything yourself to solve the issue

– JustLearning
Nov 22 '18 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 '18 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 '18 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 '18 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 '18 at 14:31












3 Answers
3






active

oldest

votes


















1














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 '18 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 '18 at 14:19













  • I wrote class for textbox but it takes properties from in class of input type=text

    – fico
    Nov 22 '18 at 14:22











  • So overwrite them. in the class "text-hide"

    – adinas
    Nov 22 '18 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 '18 at 14:24





















1














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

































    0














    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 '18 at 14:13












    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',
    autoActivateHeartbeat: false,
    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









    1














    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 '18 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 '18 at 14:19













    • I wrote class for textbox but it takes properties from in class of input type=text

      – fico
      Nov 22 '18 at 14:22











    • So overwrite them. in the class "text-hide"

      – adinas
      Nov 22 '18 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 '18 at 14:24


















    1














    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 '18 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 '18 at 14:19













    • I wrote class for textbox but it takes properties from in class of input type=text

      – fico
      Nov 22 '18 at 14:22











    • So overwrite them. in the class "text-hide"

      – adinas
      Nov 22 '18 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 '18 at 14:24
















    1












    1








    1







    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 '18 at 14:16









    adinasadinas

    2,22732633




    2,22732633













    • adinas , What does CssClass="text-hide" in your code?

      – fico
      Nov 22 '18 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 '18 at 14:19













    • I wrote class for textbox but it takes properties from in class of input type=text

      – fico
      Nov 22 '18 at 14:22











    • So overwrite them. in the class "text-hide"

      – adinas
      Nov 22 '18 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 '18 at 14:24





















    • adinas , What does CssClass="text-hide" in your code?

      – fico
      Nov 22 '18 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 '18 at 14:19













    • I wrote class for textbox but it takes properties from in class of input type=text

      – fico
      Nov 22 '18 at 14:22











    • So overwrite them. in the class "text-hide"

      – adinas
      Nov 22 '18 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 '18 at 14:24



















    adinas , What does CssClass="text-hide" in your code?

    – fico
    Nov 22 '18 at 14:18





    adinas , What does CssClass="text-hide" in your code?

    – fico
    Nov 22 '18 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 '18 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 '18 at 14:19















    I wrote class for textbox but it takes properties from in class of input type=text

    – fico
    Nov 22 '18 at 14:22





    I wrote class for textbox but it takes properties from in class of input type=text

    – fico
    Nov 22 '18 at 14:22













    So overwrite them. in the class "text-hide"

    – adinas
    Nov 22 '18 at 14:23





    So overwrite them. in the class "text-hide"

    – adinas
    Nov 22 '18 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 '18 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 '18 at 14:24















    1














    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






























      1














      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




























        1












        1








        1







        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 '18 at 15:19









        Hinek

        6,744114471




        6,744114471










        answered Nov 22 '18 at 14:23









        SehaxXSehaxX

        5681717




        5681717























            0














            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 '18 at 14:13
















            0














            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 '18 at 14:13














            0












            0








            0







            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 '18 at 14:05









            ficofico

            16




            16








            • 3





              please edit your question end add this, not as an answer.

              – SehaxX
              Nov 22 '18 at 14:13














            • 3





              please edit your question end add this, not as an answer.

              – SehaxX
              Nov 22 '18 at 14:13








            3




            3





            please edit your question end add this, not as an answer.

            – SehaxX
            Nov 22 '18 at 14:13





            please edit your question end add this, not as an answer.

            – SehaxX
            Nov 22 '18 at 14:13


















            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.




            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

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?