473,395 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to populate DataTable Column with buttons or TextBoxes

153 100+
I am trying to provie a way to add or minus or just type the quantity of the desired product on my datatable so I'm thinking the best way is the add a text box or button in a column for each row. How could this be done? Or does anyone know a better way
I populate and create like so...

Expand|Select|Wrap|Line Numbers
  1.  
  2. dt.Columns.Add(new DataColumn("ImagePath", Type.GetType("System.String")))
  3.  
  4. row["ImagePath"] = ResolveUrl(url);
  5.  
How could I create a column which holds buttons or text boxes and dynamically populate?

Would also love to know how to the image showing inthe gridview rather than the path, resolveUL doesn't work.
Aug 2 '09 #1
1 16377
MrMancunian
569 Expert 512MB
You can't add controls like a button or a textbox to a DataTable. You can however bind your DataTable to a DataGridView and add a DataGridViewButtonColumn and a DataGridViewTextBoxColumn to your GridView afterwards.

Expand|Select|Wrap|Line Numbers
  1. DataGridView1.DataSource = tblData;
  2. DataGridViewTextBoxColumn dcText = new DataGridViewTextBoxColumn();
  3. DataGridViewButtonColumn dcButton = new DataGridViewButtonColumn();
  4. DataGridView1.Columns.Add(dcText);
  5. DataGridView1.Columns.Add(dcButton);
Steven
Aug 3 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Job Lot | last post by:
My DataGrid is bound to a datatable named “dtClient” with following columns Date, BalanceCF, Income, Expenses, Withdrawls and BalanceCF. BalanceCF is an expression column. The column Withdrawals...
4
by: Aaron | last post by:
Hello, I have six textboxes that there text needs to be transferred to be datatable column names. I have tried 2 ways 1st way private void txtFine1_TextChanged(object sender,...
4
by: Mike L | last post by:
I'm open for any suggestions on how to better program this. I want the user to select a license from a combo box, cboPrivilege and then the user will click the add button, then a record will be...
3
by: Mike | last post by:
Dear group, I'm currrently investigating a bug within a piece of our software whereby if a DataGridView (bound directly to a DataTable) is ordered by column headers (containing lookup combo...
3
by: rn5a | last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB table. The records retrieved depends upon 2 conditions (the conditions depend on what a user selects in an ASPX page). If...
1
by: =?Utf-8?B?UGF0cmljayBG?= | last post by:
I have a gridview on the page that i want to dynamically populate with radiobuttons, so i went out on the net and found something that works perfectly, it created radionuttons and the postback with...
1
by: Ryan Liu | last post by:
Hi, I read a csv file to a datatable. I don't know what are the column types at this moment, so I treat all columns as string type. After I read data from file, I use...
5
by: kalboako1987 | last post by:
hello guys Im trying to autopopulate my form from a table in my database called Enrollment.it will fill the textboxes in my form whenever the id number typed in the textbox is existing in my...
3
by: ASPnewb1 | last post by:
I am currently filling a dataTable then adding this table to a dataset, setting the dataset to the Gridview's datasource. If I set the Gridview to generate columns automatically it will fill the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.