Textboxes when not in Edit mode

C

Chip

Hello,

The scenario is this:

A user needs to enter a value (for example, expenses) for a number of
rows in a data grid (each row, for example, might be a customer the
user is working with).

I'd like to avoid having to have the user click edit, wait for the
refresh, edit the item, click OK, wait for the refresh and repeat for
each row. Rather, I'd like to have the user tab from text box to text
box and enter the data (in the example, the expenses for each client).
At the bottom of the screen would be an Update button.

Question 1: How do I bind the data in a datagrid to the text box?
I've tried template columns with a text box, but I cannot figure out
how to bind the data.

Question 2: How hard will the updating be?

Thanks for any help!

Chip
 
D

dada

Maybe this will help:
Top Questions about the DataGrid Web Server Control-Editing Multiple Rows At Once...

' Visual Basic
Private Sub btnUpdate_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnUpdate.Click
Dim i As Integer
Dim dgi As DataGridItem
Dim bookid As Integer
Dim TextBoxTitle As TextBox
Dim CheckBoxInStock As CheckBox
Dim TextBoxPrice As TextBox
Dim LabelBookId as Label

For i = 0 To DataGrid1.Items.Count - 1
dgi = DataGrid1.Items(i)
LabelBookId = CType(dgi.Cells(0).Controls(1), Label)
bookid = CType(LabelBookId.Text, Integer)
TextBoxTitle = CType(dgi.FindControl("TextBoxTitle"), TextBox)
CheckBoxInStock = _
CType(dgi.FindControl("CheckBoxInstock"), CheckBox)
TextBoxPrice = CType(dgi.FindControl("TextBoxPrice"), TextBox)
Me.dcmdUpdateBooks.Parameters("@bookid").Value = bookid
Me.dcmdUpdateBooks.Parameters("@Title").Value = TextBoxTitle.Text
Me.dcmdUpdateBooks.Parameters("@instock").Value = _
CheckBoxInStock.Checked
Me.dcmdUpdateBooks.Parameters("@Price").Value = TextBoxPrice.Text
Me.SqlConnection1.Open()
Me.dcmdUpdateBooks.ExecuteNonQuery()
Me.SqlConnection1.Close()
Next
End Sub
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top