raklos
raklos

Reputation: 28545

Pre-populate a textbox field with some text

How do you pre-populate a textbox field with some text? I tried this and it didnt work:

  <asp:TextBox ID="txtTelephone1" Text="+"  runat="server"></asp:TextBox>

Upvotes: 1

Views: 5090

Answers (2)

Waleed Eissa
Waleed Eissa

Reputation: 10513

For the text property, I believe you can specify the value like this:

<asp:TextBox ID="txtTelephone1" runat="server">+</asp:TextBox>

give it a go

Upvotes: 1

rahul
rahul

Reputation: 187050

You can do it in the server side code.

Example:

txtTelephone1.Text = "sample text";

The code that you have provided will also work.

If this also don't work then anywhere in your code you are overwriting the field's value.

Upvotes: 0

Related Questions