How do I add a Textbox to my DataGrid?

B

B Holt

Here's the problem: I am using WebMatrix and although I have a lot of IDE
experience, I am a newbie at Web-based apps.

How Do I get a TextBox into (each row of) my DataGrid to allow the user to
edit the value of one column?

I have seen a lot of "sample code", but all of it contains syntax that I
simply do not understand.

Can anyone PLEASE just explain in simple terms the steps I need to take? I
have all the column. I just want one of them to be editable. I AM using a
DataGrid control, and not an MxDataGrid (which I believe is correct.)

Please help!!!!
 
J

Josh Behl

There are a couple of ways to approach this.

First, you can right click your datagrid, choose property builder, in the
window that opens, click on the 'columns' link on the left hand side. This
will open another window which will allow you to allow the addition of all
columns, specific columns, edit/select/cancel buttons, etc..... At the top
of this window there are two listboxes. On the left hand listbox, scroll
down or collapse the first node. expand the next node which is called
'buttons' I think (I'm trying to remember this off the top of my head).
Once expanded, select the edit, select option and pass that to the right
hand lsit box. Click OK.

There is some other code which you need to save your changes, get the cancel
button to work, etc. You can find that information at the following link:
http://msdn.microsoft.com/library/d...ughusingdatagridwebcontroltoreadwritedata.asp
This example is probably one of the easiest ones to follow for a 'newbie'.
Another site which I have refernced before as a good one stop shop to find
articles about datagrids is www.datagridgirl.com. Another is
www.4guysfromrolla.com. If you are new to web appls it may be a bit tricky
to latch on to at first.

Good Luck
 
B

B Holt

Now I have my TextBoxes in the DataGrid. How do I read them and update the
information in the database? My Update Query is returning the correct
number of "RowsAffected", but the data is not changing. Do I need to UnBind
the DataGrid before Updating? Any ideas?


Thanks for the help!
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top