Click here to Skip to main content
15,900,468 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: loginview Pin
arkiboys17-Feb-10 3:37
arkiboys17-Feb-10 3:37 
QuestionCreating Image on basis of space used Pin
Bajrang Singh16-Feb-10 20:04
Bajrang Singh16-Feb-10 20:04 
AnswerRe: Creating Image on basis of space used Pin
Covean16-Feb-10 23:50
Covean16-Feb-10 23:50 
QuestionSQL Query Pin
abglorie16-Feb-10 19:35
abglorie16-Feb-10 19:35 
AnswerRe: SQL Query Pin
Brij16-Feb-10 19:51
mentorBrij16-Feb-10 19:51 
AnswerRe: SQL Query Pin
keyur satyadev16-Feb-10 19:58
keyur satyadev16-Feb-10 19:58 
AnswerRe: SQL Query Pin
Not Active17-Feb-10 0:28
mentorNot Active17-Feb-10 0:28 
QuestionHow to get Confirmation message when i sent pdf as mail in asp.net Pin
naren.venkata@yahoo.com16-Feb-10 19:06
naren.venkata@yahoo.com16-Feb-10 19:06 
Hi all,
I am using Local reports(RDLC) for my reports in Asp.net

I am have the following code in my button.I am able to send my pdf report as mail,and every thing is ok,
But Problem is I am unable to produce a Confirmation message,like "Mail sent successfully".How could i change my code.Pls help me Very Urgent.
Here it is skipping message.I am directly getting preview and sending mail.


Private Sub BTN_ITCLETMAIL_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BTN_ITCLETMAIL.Click

Dim PrefAddrid As String = DDL_COMMUADDRS.SelectedValue
Dim rep As LocalReport = ReportViewer2.LocalReport
Dim Balmail As New Bal_EmailForm
RegisNum = Trim(LblItcRegNum.Text)

Dim conn As New SqlConnection(conString)
Dim da As New SqlDataAdapter
Dim ds As New ReportDataSource
Dim row As GridViewRow = Nothing
Dim Chkcount As Integer = 0
Dim intStatus As Integer

' ''For PDF
Dim warnings As Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim bytes As Byte()
Dim FolderLocation As String
'Dim FLAG_VIE_REPORT As String
'' ====================

FolderLocation = Path.GetTempPath
Dim filepath As String = FolderLocation & RegisNum & "ITCLetter.pdf"

Try

File.Delete(filepath)
Session.Contents.Remove("Error")
rep.ReportPath = System.AppDomain.CurrentDomain.BaseDirectory & "ReportRdlcs\ITCLetter.rdlc"

Dim cmd As SqlCommand = New SqlCommand("RepGetOnlyAdderssDataForDemandLetter", conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@RegistrationNumber", RegisNum)
cmd.Parameters.AddWithValue("@PrefContactAdderss", PrefAddrid)
da.SelectCommand = cmd
myDataSet.Clear()
da.Fill(myDataSet, "RepGetOnlyAdderssDataForDemandLetter")
ds.Name = "AddressDetforDemandLetter_RepGetOnlyAdderssDataForDemandLetter"
ds.Value = myDataSet.Tables(0)
rep.DataSources.Add(ds)

Dim params(3) As Microsoft.Reporting.WebForms.ReportParameter

Dim strDemStudName As String = Nothing
strDemStudName = Trim(LBL_CLIENT.Text)
Dim p1 As Microsoft.Reporting.WebForms.ReportParameter
p1 = New Microsoft.Reporting.WebForms.ReportParameter("Name", strDemStudName)
params(0) = p1

Dim strDemAccountNum As String = Nothing
strDemAccountNum = Trim(TXT_ITCACCNUM.Text)
Dim p2 As Microsoft.Reporting.WebForms.ReportParameter
p2 = New Microsoft.Reporting.WebForms.ReportParameter("ITCAccountNum", strDemAccountNum)
params(1) = p2

Dim strDemOutstandingamt As String = Nothing
strDemOutstandingamt = Trim(TXT_ITCAMTOUTSTAND.Text)
Dim p3 As Microsoft.Reporting.WebForms.ReportParameter
p3 = New Microsoft.Reporting.WebForms.ReportParameter("ITCAmtOutstanding", strDemOutstandingamt)
params(2) = p3

Dim strCurrentDate As String = Nothing
strCurrentDate = Format(Convert.ToDateTime(dbToday.fdate), "dd MMMM yyyy")
Dim p4 As Microsoft.Reporting.WebForms.ReportParameter
p4 = New Microsoft.Reporting.WebForms.ReportParameter("CurrentDate", strCurrentDate)
params(3) = p4

If myDataSet.Tables(0).Rows.Count > 0 Then

Hidecontrols.Value = 1
ReportViewer1.Visible = False
ReportViewer2.Visible = True
ReportViewer2.LocalReport.SetParameters(params)

'' ''For PDF Conversion
bytes = ReportViewer2.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)
Dim fs As New FileStream(FolderLocation & RegisNum & "ITCLetter.PDF", FileMode.Create)
fs.Write(bytes, 0, bytes.Length)
fs.Close()
Response.ContentType = "application/pdf"
Response.WriteFile(FolderLocation & RegisNum & "ITCLetter.PDF")


''For Sending mail
Balmail.ToAddress = Trim(TXT_StudItcEmail.Text)
Balmail.BccAddress = Trim(TXT_StudItcBCc.Text)
Balmail.CCAddress = Trim(TXT_StudItcCc.Text)
Balmail.Subject = Trim(TXT_ItcSubject.Value)
Balmail.Message = Trim(TXT_ItcBody.Value)
Balmail.Attachementone = FolderLocation & RegisNum & "ITCLetter.PDF"

intStatus = Balmail.SendMailNew()

If intStatus = 0 Then
Dim strScript As String = "<script type=text/javascript language=javascript defer=defer>;"
strScript += "myAlert('Management College of Southern Africa', 'Mail Sent Successfully', 'return false;');"
strScript += "</script>"
Page.ClientScript.RegisterStartupScript(Me.GetType(), "myAlert", strScript)
End If
Response.End()

Else

Hidecontrols.Value = 0

End If

Catch SqlExep As SqlException
s = "An SQL Server 2005 Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Space(5) + SqlExep.StackTrace.ToString + "<br>" + "<b>" + "Error Description:" + Space(5) + SqlExep.Message + "</b>"
Session("Error") = s
Catch IOExep As IOException
s = "An IO Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Space(5) + IOExep.StackTrace.ToString + "<br>" + "<b>" + "Error Description:" + Space(5) + IOExep.Message + "</b>"
Session("Error") = s

Finally
If Not (Session("Error") = "") Then
Response.Redirect("../Exception_Throw.aspx")
End If
RegisNum = ""
End Try

End Sub
Regards,
Narendra.S
AnswerRe: How to get Confirmation message when i sent pdf as mail in asp.net Pin
keyur satyadev16-Feb-10 19:45
keyur satyadev16-Feb-10 19:45 
GeneralRe: How to get Confirmation message when i sent pdf as mail in asp.net Pin
naren.venkata@yahoo.com17-Feb-10 0:43
naren.venkata@yahoo.com17-Feb-10 0:43 
QuestionHow to select Directory Pin
sjs4u16-Feb-10 18:49
sjs4u16-Feb-10 18:49 
AnswerRe: How to select Directory Pin
Brij16-Feb-10 19:06
mentorBrij16-Feb-10 19:06 
GeneralRe: How to select Directory Pin
mylogics16-Feb-10 23:21
professionalmylogics16-Feb-10 23:21 
GeneralRe: How to select Directory Pin
Brij17-Feb-10 0:35
mentorBrij17-Feb-10 0:35 
QuestionCOM Problem Pin
JC.KaNNaN16-Feb-10 18:44
JC.KaNNaN16-Feb-10 18:44 
AnswerRe: COM Problem Pin
Brij16-Feb-10 19:16
mentorBrij16-Feb-10 19:16 
GeneralRe: COM Problem Pin
JC.KaNNaN16-Feb-10 20:38
JC.KaNNaN16-Feb-10 20:38 
QuestionHow to move columns of Gridview at Runtime ? Pin
H_i_M16-Feb-10 18:37
H_i_M16-Feb-10 18:37 
AnswerRe: How to move columns of Gridview at Runtime ? Pin
Brij16-Feb-10 19:12
mentorBrij16-Feb-10 19:12 
AnswerRe: How to move columns of Gridview at Runtime ? Pin
gajendra_kshatriya16-Feb-10 21:19
gajendra_kshatriya16-Feb-10 21:19 
QuestionUpdatePanel and controls with javascript Pin
Member 103390716-Feb-10 9:04
Member 103390716-Feb-10 9:04 
AnswerRe: UpdatePanel and controls with javascript Pin
Not Active16-Feb-10 9:36
mentorNot Active16-Feb-10 9:36 
GeneralRe: UpdatePanel and controls with javascript Pin
Member 103390728-Feb-10 9:34
Member 103390728-Feb-10 9:34 
QuestionHow to refresh only Content page without refreshing master page Pin
Raheem MA16-Feb-10 6:52
Raheem MA16-Feb-10 6:52 
AnswerRe: How to refresh only Content page without refreshing master page Pin
gajendra_kshatriya16-Feb-10 18:26
gajendra_kshatriya16-Feb-10 18:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.