473,657 Members | 2,953 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

binding dt to txt

hey all,
i have an incoming datatable in my web page and i'd like to bind one of the
fields to a textbox. can someone please show me how to do this?

thanks,
rodchar
Mar 29 '07 #1
2 1389

Hi,

When you say binding an incoming datatable to a textbox, do you mean
binding a specific row's column value of the datatable?

Incase you need to bind the textbox to a specific row's cell value, then
probably you could try this option:

<input type="text" id="txtcon" value="<%= dt.Rows[0][0]%>" />

But then, if you need an asp:textbox to be bound through your html code, in
that case, the asp:textbox needs to be supported with another hidden input
textbox, followed by a script.

<input type="text" id="txtcon"
style="DISPLAY: none;"
value="<%= dt.Rows[0][0]%>" />
<asp:TextBox ID="txtContent " runat="Server"> </asp:TextBox>

<script type="text/javascript">
document.getEle mentById("txtCo ntent").value =
document.getEle mentById("txtco n").value
</script>

This code will be useful if you specifically want to bind in the html source
itself.

But if that is not mandatory, the same can be achived by simply assigning
the text property of the asp:textbox to the particular field value of the
datatable.

Also, the textbox can be bound to only 1 cell value of the entire datatable
at a time.

I hope this helps.
-Parvathy.

Mar 30 '07 #2
thank you very much for the help.
rod.

"Parvathy Padmanabhan" wrote:
>
Hi,

When you say binding an incoming datatable to a textbox, do you mean
binding a specific row's column value of the datatable?

Incase you need to bind the textbox to a specific row's cell value, then
probably you could try this option:

<input type="text" id="txtcon" value="<%= dt.Rows[0][0]%>" />

But then, if you need an asp:textbox to be bound through your html code, in
that case, the asp:textbox needs to be supported with another hidden input
textbox, followed by a script.

<input type="text" id="txtcon"
style="DISPLAY: none;"
value="<%= dt.Rows[0][0]%>" />
<asp:TextBox ID="txtContent " runat="Server"> </asp:TextBox>

<script type="text/javascript">
document.getEle mentById("txtCo ntent").value =
document.getEle mentById("txtco n").value
</script>

This code will be useful if you specifically want to bind in the html source
itself.

But if that is not mandatory, the same can be achived by simply assigning
the text property of the asp:textbox to the particular field value of the
datatable.

Also, the textbox can be bound to only 1 cell value of the entire datatable
at a time.

I hope this helps.
-Parvathy.
Mar 30 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
10413
by: Zlatko Matiæ | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws As DAO.Workspace Dim db As DAO.Database Dim qdf As DAO.QueryDef Dim rs As DAO.Recordset
1
2622
by: Bruce | last post by:
Hi, there, I meet a problem about comboBox binding. -------------------- Database: Northwind Tables: 1) Products 2) Categories I create a form (named "form1") to edit the record from Products table.
0
4794
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having manually inserted a row in the table bound to the Combo box. The InsertAt Method of adding a row just does not work. Hope this helps anyone with this problem. john
30
2817
by: lgbjr | last post by:
hi All, I've decided to use Options Strict ON in one of my apps and now I'm trying to fix a late binding issue. I have 5 integer arrays: dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) as integer The integers in these arrays are actually pointers to different columns of data in a text file.
15
3103
by: Tom Gur | last post by:
Hi, What is early/late binding ?
0
8718
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8499
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.