datarepeater question

  • Thread starter Thread starter Stephen
  • Start date Start date
S

Stephen

Hi,

I have a quick question. I am displaying all the orders that are active. I
am making use of a datarepeater with checkboxes to display data and a submit
button to insert into the database.

suppose i want to make the orders inactive using the checkboxes and click on
the submit button should update the database.

How do I capture the event such that only those check boxes that have been
checked are updated and not others?

Thanks,
Stephen.
 
I assume that the data the repeater is showing is in a DataTable in a
DataSet, right? If so, add a DataColumn to that table to store a Boolean
value that will be set via the checkbox in the repeater.

This way, when you call the Update method of the DataAdapter to migrate your
changes to the original data source, you can write your update command to
update only those records that have that Boolean flag set to true.

One note here, though. Repeater controls do not support editing of data, so
you should use either a DataList control or a DataGrid control.
 
Hi Scott,

Do you have any sample example or code that i can take a look at

Thanks,
Stephen.
 
Just paraphrasing here, so you will need to check this for accuracy.

'Assuming you have a DataSet that is populated already
'Create new column of the Boolean type and add to the table in the DataSet
dim dc as New DataColumn("UpdateColumn",boolean)

dsProds.Tables(0).Columns.Add(dc)



'When handling the Update button from the list control,

'check the checkbox of the selected row (use FindControl(controlName))

'to see if the checkbox was checked for that row



'As part of your UPDATE commandText add a WHERE clause

'that checks the row(s) for the boolean column for true

UPDATE .... WHERE "UpdateColumn" = True
 
Back
Top