update value of textbox

Posted on 2009-02-14
Last Modified: 2012-05-06

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

Question by:thegunner
    LVL 12

    Accepted Solution

    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()
    LVL 15

    Expert Comment

    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") %>' />

    Author Closing Comment

    ok thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now