0

I have ASP.NET web form there is html input text:

<input type="text" class="input" runat="server" id="txtFirstName"/>

i want to change width this way but it does not works

protected void btnRegister_Click(object sender, EventArgs e) 
    {
        if (txtFirstName.Value.Length > 15)
        {
            txtFirstName.Attributes.Add("width", "15px");
        }
    }

p.s. i have access on this text input. Im inputting more than 15 characters and if works good

1 Answer 1

2
txtFirstName.style["width"]= "15px";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.