Reputation: 1453
I am using asp text box. In the code behind i.e in the cs page am not able to set the Value by id.Value="xy";
Please help me out. Thanks in advance
Upvotes: 0
Views: 1494
Reputation: 2184
You should have your text box in .aspx page like below:
<asp:TextBox runat="server" ID="TextBox1"></asp:TextBox>
Then in your code behind page like this will do this:
TextBox1.Text = "your text here";
Upvotes: 1
Reputation: 131
see if it is label it is having a value
property to display text
lbl.value ="labeltext"
if is textBox it is having a Text
property to display text
txt.Text ="textboxtext"
Upvotes: 0
Reputation: 94653
TextBox
class has Text
property.
Try, Markup:
<asp:TextBox id="txt1" runat="server"/>
<asp:TextBox id="txt2" runat="server" Text="Hello"/>
Code behind:
txt1.Text="Hello";
Upvotes: 3