update value of asp.net textbox


I've created a textbox and I want the value of a record field to be it's value, but it doesn't appear to be updating....

Ho can this be done...

p.s there is a value for dr("description")

<asp:TextBox ID="txtDescription" runat="server" Columns="65" Rows="5" 
                                <% txtDescription.Text = dr("description")%>

Open in new window

Who is Participating?
you do this in the event that gets the datarow.  For example, if you have the datatable in the page_load, update the textbox there as
txtDescription.Text = dr("description").ToString()
Depending on the version of .NET you are using, you could bind the data to the control.  Is the control in a FormView, or any other type of data control?

<asp:TextBox ID="txtDescription" runat="server" Text='<%# Eval("description") %>' />

If not, you will need to set the value in the code behind like CB mentioned, unless the "dr" class is a public class, then you could do something like this:
<asp:TextBox ID="txtDescription" runat="server" Text='<%= dr("description") %>' />
thegunnerAuthor Commented:
ok thanks
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.