Hey guys,
I am running into an issue. Basically what I am trying to do is to create an invoice and send it via email.
So I am using Ajax CalendarExtender and I do have the Toolscrkipt manager registered at the top of my page and I am using .net 4 with VS 2010.
So after a few failure I decided to export the asp:panel containing the Invoice to a CSV and then send the CSV to email. I google a few stuff and found a few codes, so this is my code for now when I hit create invoice button:
Dim SB As New StringBuilder()
Dim SW As New StringWriter(SB)
Dim htmlTW As New HtmlTextWriter(SW)
pnCreateInvoice.RenderControl(htmlTW)
Dim strOut As String = htmlTW.ToString
Dim strCSV As String
strCSV = tbInvoiceNumber.Text & "_" & tbClientName.Text
For Each c In System.IO.Path.GetInvalidPathChars
strCSV = strCSV.Replace("c", "")
Next
strCSV = strCSV.Replace("/", "-")
Dim TargetFile As StreamWriter
Try
TargetFile = New StreamWriter("~/invoices/" & strCSV & ".csv", True)
TargetFile.Write(htmlTW)
TargetFile.WriteLine()
TargetFile.Write(strOut)
TargetFile.Close()
lblCreateInvoiceError.Text = "Completed"
Catch ex As Exception
lblCreateInvoiceError.Text = ex.Message.ToString
End TryThis is the error I get when I hit the button:
Extender control 'tbInvoiceDateCalendarExtender' is not a registered extender control. Extender controls must be registered using RegisterExtenderControl() before calling RegisterScriptDescriptors(). Parameter name: extenderControl Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Extender control 'tbInvoiceDateCalendarExtender' is not a registered extender control. Extender controls must be registered using RegisterExtenderControl() before calling RegisterScriptDescriptors(). Parameter
name: extenderControl
Source Error:
Line 364: Dim SW As New StringWriter(SB)
Line 365: Dim htmlTW As New HtmlTextWriter(SW)Line 366: pnCreateInvoice.RenderControl(htmlTW)Line 367: Dim strOut As String = htmlTW.ToString |