|
Hopefully, I am posting on correct forum.
I have a report with a parameter called loc.
The intended purpose of the report is to allow users to select a location from the dropdownlist and then records associated with that location are displayed to the users.
The dropdownlist is getting populated with values just fine.
However, when I select a location from the dropdownlist, I get an error that says:
Value cannot be null. Parameter name: reportParameters
Everything works fine when I pass a value as textbox but not as dropdown.
Any ideas what I am doing wrong?
Below are relevant code.
'---Dropdownlist control
<asp:Panel runat="server" ID="pnlLoc" Font-Names="Calibri" BorderStyle="Solid" BorderWidth="1" Style="margin: 0 auto; width:300px;">
<table>
<tr>
<td>
<asp:Label runat="server" ID="lblLoc" Text="Location: " />
</td>
<td>
<asp:DropDownList runat="server" ID="ddLoc" DataSourceID="dslocator6" AutoPostBack="True">
</asp:DropDownList>
</td>
</tr>
</table>
</asp:Panel
--Report viewer control
<rsweb:ReportViewer ID="ReportViewer1" runat="server" AsyncRendering="true" SizeToReportContent="true" Font-Names="Arial"
Height="675px" Width="750px">
<LocalReport EnableExternalImages="true" ReportPath="">
</LocalReport>
</rsweb:ReportViewer></center>
<asp:ObjectDataSource ID="LOC" runat="server" SelectMethod="GetData" TypeName="ManageReportsTableAdapters.searchBylocationsTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="ddLoc" Name="Location" DefaultValue=" " />
</SelectParameters>
</asp:ObjectDataSource>
--This code populates the ddLoc dropdownlist
Protected Sub btnLoc_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnLoc.Click
ReportViewer1.LocalReport.ReportPath = ""
pnlLoc.Visible = True
which.Value = "P"
dslocator6.SelectCommand = "SELECT location FROM Locations ORDER BY [location]"
ddLoc.DataTextField = "location"
ddLoc.DataValueField = "location"
End Sub
Sub Run_Report(ByVal sel As String)
ReportViewer1.Reset()
ReportViewer1.LocalReport.DataSources.Clear()
Dim params(0) As ReportParameter
ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("locs", LOC.ID))
ReportViewer1.LocalReport.ReportPath = "locations.rdlc"
ReportViewer1.LocalReport.Refresh()
params(0) = New ReportParameter("loc", sel, False)
ReportViewer1.LocalReport.SetParameters(params) '<-- error points to this line
End Sub
I have been stuck on this for two days. Your assistance is greatly appreciated.
|
|
|
|
|
This means sel is null. If you debug you should find the issue.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
<asp:DropDownList runat="server" ID="ddLoc" DataSourceID="dslocator6" AutoPostBack="True">
</asp:DropDownList>
in your dropdownlist add listitems
<asp:listitem value="location">Location
|
|
|
|
|
Hi All, i'm after a bit of advice on the homepage of my app there is one particular section (Repeater) that queries the DB to provide a high level overview of the latest version of an application. Loading the data into this repeater is having an impact on the load time of the homepage so my thought on this is to is to add a checkbox to the page and on the initial page load do not populate the repeater but if the user checks the checkbox to display the data then go an query the DB to populate the repeater. Aside from only loading this data on request what other way could I control the populating of this repeater so that is not impacting performance?
|
|
|
|
|
i am beginner in asp.net so please recommend a book and articles please
|
|
|
|
|
|
|
wrox professional asp net 4 in c# and vb.
|
|
|
|
|
|
|
AM trying to integrate an online payment system, where the secure payment gateway will send a notification to a specified URL on my site - I have given a generic handler (.ashx) address. I can read the data they send (it's a simple POST), but they require that I send back:
a notification with a response of: "HTTP/1.1 200 OK".
I am not sure what they want... Is a simple
context.Response.ContentType = "text/plain"
context.Response.Write("HTTP/1.1 200 OK")
enough? Perhaps necessarily preceded with
context.Response.StatusCode = 200
?
Or is something more sophisticated required, along the lines of
Dim req As System.Net.HttpWebRequest = System.Net.WebRequest.Create("https://secure-gateway-url")
req.Method = "POST"
req.ContentType = "application/x-www-form-urlencoded"
req.Accept = "HTTP/1.1 200 OK" ?????
req.Headers .Add ( ?????
Dim param As Byte() = context.Request.BinaryRead(HttpContext.Current.Request.ContentLength)
Dim strRequest As String = Encoding.ASCII.GetString(param)
req.ContentLength = strRequest.Length
Dim streamOut As System.IO.StreamWriter = New System.IO.StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII)
streamOut.Write(strRequest)
streamOut.Close()
with what needed at the lines flagged ????
I’d be very grateful for any advice... thanks
|
|
|
|
|
|
Thanks - Google doesn't like me, I've decided I did try and Google this myself....
|
|
|
|
|
I've written that before years ago, it was just easier for me to find it through search and post a link. Took me a while to find the right one.
|
|
|
|
|
i have a project where the client has to place a purchase order, when the client save the purchase order it moves to a aspx web page there the purchase order is displaced as image file, with two button one to generate PDF and the next To Send EMAIL
i can generate a pdf when pdf button is clicked and it get downloaded when opening the pdf file its someother pdf file.i mean the generated pdf is not getting download insist of that another purchased order pdf details is seen but with current file name. i dont know what i did work in my coding, my coding is
Inherits System.Web.UI.Page
Private obj As New SqlHelper
Private _i As Integer = 1
Private att As String
Private PONO1 As Integer
Private pat As String
Private Att_ As String
'Private MailPoId As String
'Private objApp As Outlook.Application = Nothing
'Private objMail As Outlook.MailItem = Nothing
'Private Declare Function ShellExecute Lib _
' "shell32.dll" Alias "ShellExecuteA" _
' (ByVal hwnd As Long, _
' ByVal lpOperation As String, _
' ByVal lpFile As String, _
' ByVal lpParameters As String, _
' ByVal lpDirectory As String, _
' ByVal nShowCmd As Long) As Long
'Private Const SW_SHOW As Integer = 1
Protected Sub btnPdf_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPdf.Click
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]() = Nothing
Dim Folder As String
bytes = ReportViewer1.LocalReport.Render("PDF", "", mimeType, encoding, extension, streamids, warnings)
Dim str As String = Session("POrderNO")
'Folder = ' & DateTime.Now.ToString("dd-MM-yyyy")
'If Folder = vbNullString Then
' lblPdf.Text = "Please set the Pdf path"
' Exit Sub
'End If
Folder = Server.MapPath("~\PDFDownload\PO")
Dim di As DirectoryInfo = New DirectoryInfo(Folder)
Dim path As String
Dim fs As FileStream
Dim data As Byte()
If di.Exists Then
If Not File.Exists(Folder & "\" & str & ".pdf") Then
path = Folder & "\" & str & ".pdf"
Session("MailId") = path
fs = New FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite)
data = New Byte(fs.Length - 1) {}
fs.Write(bytes, 0, bytes.Length)
fs.Close()
End If
Else
di.Create()
If Not File.Exists(Folder & "\" & str & ".pdf") Then
path = Folder & "\" & str & ".pdf"
Session("MailId") = path
fs = New FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite)
data = New Byte(fs.Length - 1) {}
fs.Write(bytes, 0, bytes.Length)
fs.Close()
di.Refresh()
End If
End If
'
'Session("MailId") = str & ".pdf"
'Dim paths As String = Server.MapPath("~/PDFD/Uploads/")
Dim fName As String = Server.MapPath("~\PDFDownload\PO\" & str & ".pdf")
Dim fi As New FileInfo(fName)
Dim sz As Long = fi.Length
Response.ClearContent()
Response.ContentType = "Application/pdf"
Response.AddHeader("Content-Disposition", String.Format("attachment; filename = {0}", System.IO.Path.GetFileName(fName)))
Response.AddHeader("Content-Length", sz.ToString("F0"))
Response.TransmitFile(Server.MapPath("~\PDFDownload\PO\" & str & ".pdf"))
Response.End()
End Sub
|
|
|
|
|
You'll need to debug it and see what is happening.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi,
I have a pretty long and complex logic that needs to be run when the page loads.
The logic can't be changed.
What happens is that while the logic is executed, the page is of course stuck.
It involves drawing on the canvas element.
What options do I to work around this issue?
|
|
|
|
|
|
Thanks, I'll go over this info.
|
|
|
|
|
Thanks for your feedback.
I went through those links.
It looks something that could handle my problem but I need to draw a very complicated structure on the canvas + perform some interactions on it later and to do that, I need an access to the DOM + window which I don't
have through the web worker.
Any ideas how can I get around this?
|
|
|
|
|
I am writing to seek help, in regards to figuring out, how can I verify my email address using mx record. I am currently new into using MX records and so far, I have method which returns a mx record for specific domain (as shown below):
public static string mailMX()
{
string domainName = "#######.com";
string mail = "";
var response = DnsClient.Default.Resolve(domainName , RecordType.Mx);
var records = response.AnswerRecords.OfType<MxRecord>();
foreach (var record in records)
{
return (record.ExchangeDomainName).ToString();
}
return mail = records.ToString();
}
My desire goal is to create a method, which can verify the email address "info@reply.####.com" has a valid mx record and return the email address. I am slightly struggling in this area, as I am not to sure how to structure this task.
Any hints would be most appreciated. Thank you
|
|
|
|
|
Ignore the ExchangeDomainName - that's just the name of the server which accepts email for the specified domain.
If there are any MX records for the domain, then the domain is valid. It won't tell you whether the mailbox actually exists, but you can't determine that without trying to send an email.
Try something like this:
public static bool IsValidEmailDomain(MailAddress address)
{
if (address == null) return false;
var response = DnsClient.Default.Resolve(address.Host, RecordType.Mx);
if (response == null || response.AnswerRecords == null) return false;
return response.AnswerRecords.OfType<MxRecord>().Any();
}
public static bool IsValidEmailDomain(string address)
{
if (string.IsNullOrWhiteSpace(address)) return false;
MailAddress theAddress;
try
{
theAddress = new MailAddress(address);
}
catch (FormatException)
{
return false;
}
return IsValidEmailDomain(theAddress);
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you very much for your reply. Apology for the late response.
When I tested the IsValidEmailDomain method, for my domain, it showed up as false. I tried adding in the try...catch block, but I am still getting a false domain address (####.com) and I have also tried testing it using my personal domain address (####@gmail.com), which also results in false.
I have tried compiling many variations of the test method, to catch the error within the IsValidEmailDomain , but I keep experiencing false/null for each of the domain address.
public static bool IsValidEmailDomain(MailAddress address)
{
if (address == null) return false;
var response = DnsClient.Default.Resolve(address.Host, RecordType.Mx);
try
{
if (response == null || response.AnswerRecords == null) return false;
}
catch (FormatException)
{
return false;
}
return response.AnswerRecords.OfType<MxRecord>().Any();
}
public static string test()
{
string mail = "#####6@gmail.com";
bool? answer = null;
Exception ex;
try
{
answer = IsValidEmailDomain(mail);
}
catch (Exception e)
{
ex = e;
}
if (answer.HasValue)
{
return answer.ToString();
}
else
{
return null;
}
}
However, when I test the following domain address (###.com) with my original mx() method, it displays a mx-record (mail.###.com) for my domain address. I have also tested my mx() method using my gmail address and it outputs an mx-record for it.
public static string mailMX()
{
string domainName = "#######.com";
string mail = "";
var response = DnsClient.Default.Resolve(domainName, RecordType.Mx);
var records = response.AnswerRecords.OfType<MxRecord>();
foreach (var record in records)
{
return (record.ExchangeDomainName).ToString();
}
return mail = records.ToString();
}
I am trying to send email via XML to 3rd party client via web request and in order to send the email, i need to pass a email (reply.###.com) with a valid mx-record. hence, how can I build method, which define, that domain address (###.com) is valid with the following (mail.###.com) mx record.
Any hints to where I may be going wrong or what logic I should be applying, would be most helpful.
Many thanks for your time and help.
modified 3-Oct-14 6:56am.
|
|
|
|
|
I'm assuming the DnsClient class comes from the ArSoft.Tools.Net[^] project?
Based on their documentation, I've made one slight adjustment to the methods I previously posted:
public static bool IsValidEmailDomain(MailAddress address)
{
if (address == null) return false;
var response = DnsClient.Default.Resolve(address.Host, RecordType.Mx);
if (response == null) return false;
if (response.ReturnCode != ReturnCode.NoError && response.ReturnCode != ReturnCode.NxDomain) return false;
if (response.AnswerRecords == null) return false;
return response.AnswerRecords.OfType<MxRecord>().Any();
}
public static bool IsValidEmailDomain(string address)
{
if (string.IsNullOrWhiteSpace(address)) return false;
MailAddress theAddress;
try
{
theAddress = new MailAddress(address);
}
catch (FormatException)
{
return false;
}
return IsValidEmailDomain(theAddress);
}
Testing those methods using v1.8.1 of the library produces the expected results:
IsValidEmailDomain("test@gmail.com") == true;
IsValidEmailDomain("test@test.test") == false;
If those methods don't product true for a gmail.com address, then you need to check your DNS servers. Open a command prompt and type the following:
nslookup
set type=mx
gmail.com
You should see a list of the MX records for the domain.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi friends,
I am using ajaxtoolkit (autocomplete for textbox) in asp.net, I have two textbox1 and textbox2. Based on textbox1 return value
I want to get value of textbox 2. please help some send me sample code or example in vb.net
thank you.
regards,
asad
|
|
|
|