Dim CheckID As CheckBox
Dim lbl_Email As Label
Dim i As Integer
Label1.Text = ""
For i = 0 To myGridView.Rows.Count - 1
CheckID = myGridView.Rows(i).FindControl("CheckID")
lbl_Email = myGridView.Rows(i).FindControl("lbl_Email")
If CheckID.Checked = True Then
'*** Have lblID.Text ***'
Me.Label1.Text = Me.Label1.Text & "" & lbl_Email.Text & ","
End If
Next
Tag : .NET, Oracle, Web (ASP.NET), VB.NET
Date :
2012-05-24 15:25:03
By :
mylovekukkai
View :
1059
Reply :
6
No. 1
Guest
Code (C#)
string[] mailAddress = (from GridViewRow msgRow in myGridView.Rows
where ((CheckBox)msgRow.FindControl("CheckID")).Checked
select ((Label)msgRow.FindControl("lbl_Email")).Text).ToArray();
MailMessage message = new MailMessage();
foreach (string address in mailAddress)
{
message.To.Add(new MailAddress(address));
}
.....
.....
.....
Dim CheckID As CheckBox
Dim lbl_Email As Label
Dim i As Integer
Dim strTo As String = ""
Label1.Text = ""
For i = 0 To myGridView.Rows.Count - 1
CheckID = myGridView.Rows(i).FindControl("CheckID")
lbl_Email = myGridView.Rows(i).FindControl("lbl_Email")
If CheckID.Checked = True Then
'*** Have lblID.Text ***'
Me.Label1.Text = Me.Label1.Text & "" & lbl_Email.Text & ","
IF strTo = "" Then
strTo = lbl_Email.Text
Else
strTo = strTo & "," lbl_Email.Text
End IF
End If
Next