0

Gooday. Could you help me figure out please why I get this: System.Web.UI.WebControls.TextBox on Label1:

DataListItem item = DataList1.Items[0];
TextBox nume = (TextBox)item.FindControl("numeTb");
Label1.Text = nume.ToString();

I specify that the numeTb element is put like this in the ASPX file:

<asp:TextBox ID="numeTb" runat="server" Width="400px" 
Text='<%# Eval("nume") %>' DataTextField="nume" DataValueField="nume"></asp:TextBox>

I just added the DataTextField bits thinking might help, but no. Thank you!

1 Answer 1

6

You need to use the Text property

Change this line

 Label1.Text = nume.ToString();

to

 Label1.Text = nume.Text;
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.