Extending the System.EventArgs class / AddHandler inside DataList

S

Scott Hamlin

I have created an ASP.NET application that has a series of TextBox and Label
controls inside a DataList. I need to determine what the Label Control is
(it will hold the primary key of the DB record to update) and the
TextBox.Text value. I have the following methods defined, though if there is
another way, I'll be more than happy to change the way my page works. I have
it this way because I only want the update function (which I had planned on
putting in the TextChanged method) to run for the rows that have changed. I
can go through all the rows an update them all whether they have been
changed or not, but I would like to make it as efficient as possible.

I had also considered using the OleDbDataAdapter.Update command, but I'm not
sure how to use that correctly in ASP.NET. If you can point me to some good
examples, maybe that is the way to go.


Public Sub TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Response.Write("<br>Test has changed in datalist: " & sender.ID _
& " and value = " & CType(sender, TextBox).Text)
End Sub


Private Sub DataList1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataListItemEventArgs) Handles
DataList1.ItemDataBound
Response.Write("<br>Item bound")
AddHandler CType(e.Item.FindControl("txtNumber"),
TextBox).TextChanged, AddressOf TextChanged
End Sub


Thank you for your time,
Scott
 

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,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top