Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

update value of asp.net textbox

Hi,

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")


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

Open in new window

0
thegunner
Asked:
thegunner
1 Solution
 
CB_ThirumalaiCommented:
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()
0
 
aibusinesssolutionsCommented:
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") %>' />
0
 
thegunnerAuthor Commented:
ok thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now