Newbie question: Can a TextBox control be bound to a DataSource?

R

Ray Stevens

Binding do a dropdown, datagrid, etc. is doable, but I don't see a way to
bind a textbox control to a a DataSet Datatable column.
 
K

Karl Seguin

No. And your terminology is a little off, so it's hard to understand what
you are trying to do. Are you simply trying to assign a value of a column
from a given row to a textbox? that's cake. Are you actually trying to
Databind, via some DataSource mechanism a column? You can't bind columns to
anything...you can't bind textboxes to anything...

myTextBox.Text = someDataSet.Tables(0).Rows(0)("SomeColumn")

if you want to assign a value to a textbox while databinding in a repater:

<asp:textbox is="someId" runat="server" text='<%#
DataBinder.Eval(Container.DataItem, "SomeColumn")%>' />

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top