I have a rowdatabound event that generates an automated email. I want to change the value of a checkbox in the row as part of the event, not every row in the table (tried gridview1.rowupdate) and it chnanged all rows in table. I am using VB.net. What is method to change each row as it is databound?
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
Dim fname As New Label
Dim lname As New Label
Dim repemail As New Label
Dim completedate As New Label
Dim address As New Label
Dim city As New Label
Dim state As New Label
Dim zipcode As New Label
Dim emailaddress As New Label
Dim homephone As New Label
Dim cellphone As New Label
Dim clientno As New Integer
Dim rowid As New Integer
Dim cbcp1 As CheckBox = DirectCast(Me.GridView1.FindControl("cp1"), CheckBox)
If e.Row.RowType = DataControlRowType.DataRow Then
<-------------------------------------------------------------------------------------------would like to change value of checkbox CP1 (column index 6) here prior to assigning email information----------------------->
fname.Text = e.Row.Cells(0).Text
lname.Text = e.Row.Cells(1).Text
repemail.Text = e.Row.Cells(2).Text
completedate.Text = e.Row.Cells(4).Text
address.Text = e.Row.Cells(7).Text
city.Text = e.Row.Cells(8).Text
state.Text = e.Row.Cells(9).Text
zipcode.Text = e.Row.Cells(10).Text
emailaddress.Text = e.Row.Cells(11).Text
homephone.Text = e.Row.Cells(12).Text
cellphone.Text = e.Row.Cells(13).Text
clientno = e.Row.Cells(14).Text
rowid = GridView1.EditIndex
Const ToAddress As String = "alm0@mchsi.com"
'(1) Create the MailMessage instance
Dim mm As New MailMessage("ReferralUpdate@creditability.org", ToAddress)
'(2) Assign the MailMessage's properties
mm.Subject = "CreditAbility Client Referral Update"
mm.Body = "<font face='arial'>Just to remind you <b>" + fname.Text + " " + lname.Text _
& "</b> finished our credit repair program on<b> " + completedate.Text _
& "</b>.<br><br><br>We have provided your client's contact information below." _
& "<br><br><br><b>" + fname.Text + " " + lname.Text _
& "<br>" + address.Text _
& "<br>" + city.Text + ", " + state.Text + " " + zipcode.Text _
& "<br>Email: " + emailaddress.Text _
& "<br>Home: " + homephone.Text _
& "<br>Cell: " + cellphone.Text _
& "</b><br><br><br><br>" _
& "CreditAbility provides this update to referral sources to help you keep in touch with you potential clients!" _
& "<br> We will be reminding you again about this client in about 60 days" _
& "<br><br><br><b>CreditAbility" _
& "<br>266 Blairs Ferry Road NE, Suite 200" _
& "<br>Cedar Rapids, Iowa 52402" _
& "<br>Phone: 888-573-2822</b>"
mm.IsBodyHtml = True
mm.Priority = MailPriority.High
'(3) Create the SmtpClient object
Dim smtp As New SmtpClient("relay-hosting.secureserver.net")
'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End If
End Sub
Thanks for your help on tihs.