MVC :: IEnumerable - Null Files Parameter
Feb 3, 2010i'm using MVC 2, RC, and i have a controller method:
[Code]....
and i have an <input type="file"../> in my form. during post, however, the files parameter is null.
i'm using MVC 2, RC, and i have a controller method:
[Code]....
and i have an <input type="file"../> in my form. during post, however, the files parameter is null.
I have code that's working beautifully on my development machine,but when deployed to the server is throwing null reference exception.So,I can't step through the code,but I've pinned down the culprit.But now I am puzzled.Here's the code.The question is below.
Dim certs = From p In persons _
Select New Certificate( _
p.Value, _
New CertificateData.Seminar(thisEvent.Seminar.Name, _
[code]...
In the code above persons is a dictionary of custom class,and certs is of IEnumerable type.Now here's the quandary.The first line that sets the label returns False,so certs is not null.But the second line throws an null reference exception.
I am using dropdownlist in my view page with some values which will display corresponding ID(primary key of other table) in my database.If i leave my dropdownlist blank and save it in database then its showing null parameter error. Can you explain how to use this reference type to overcome this error
View 2 RepliesI have this code in my code behind class. I keep getting this error that "Value cannot be null, parameter name source"
[Code]....
[Code]....
If this information does not exist in the table displays this error:Value Can not BE null. Parameter name: Entity
<cc1:ConfirmButtonExtender DisplayModalPopupID="ModalPopupExtender4" ID="ConfirmButtonExtender4"
runat="server" TargetControlID="lnkremoveloc" Enabled="False" OnClientCancel="RemoveLocations">
</cc1:ConfirmButtonExtender>
[code]...
VS2010 .NET 4 - This simple app works using my local system. When I publish it on an IIS 7 web server, I get this error when the application runs this Linq query with a containes function.
var results = view_UserInfoRepository.View_UserInfo.Where(x => x.Email.Contains(eMail)).OrderBy(x => x.Email);
Server Error in '/' Application.Value cannot be null. Parameter name: textDescription: 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.ArgumentNullException: Value cannot be null.Parameter name: text Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: text]
System.Data.Linq.SqlClient.SqlHelpers.GetStringContainsPattern(String text, Char escape, Boolean& usedEscapeChar) +595083
[code]...
I am triing to bind the data to a listbox from sql server then got the error "Value cannot be null.Parameter name: key"
ddlCountry = new Obout.ComboBox.ComboBox();
ddlCountry.Width = 200;
ddlCountry.Height = 200;
ddlCountry.DataTextField = "Country";
ddlCountry.DataValueField = "Country";
sqlCommand = "SELECT [Country] FROM [tbl_LookupCountry] where [Country] IS NOT NULL";
SqlConnection sqlConCountry = new SqlConnection(connectString);
SqlCommand sqlCommCountry = new SqlCommand();
sqlCommCountry.Connection = sqlConCountry;
sqlCommCountry.CommandType = System.Data.CommandType.Text;
sqlCommCountry.CommandText = sqlCommand;
sqlCommCountry.CommandTimeout = 300;
sqlConCountry.Open();
reader = sqlCommCountry.ExecuteReader();
ddlCountry.DataSource = reader;
ddlCountry.DataBind();
sqlConCountry.Close();
I have a simple web-service and want to invoke it from a client. this service has a parameter but when I invoke it from client and send to it a parameter , in server side service run successfully but always parameter has no value and is null ( depend on parameter's type ex if it's string , value will be string and if it's int , value will be zero ) here is server and client code:
[Code]....
there was server and cliend ( proxy class code ) but when I run it and trace in server side always parameter that I send to it has no value.
I have got a problem about setting the optional parameter to NULL in sql sp. Initially I set all the parameters null in the sql sp. That's OK. But I would like to set the parameters to Null again if a particular parameter has a value of - 1 by using the "IF ELSE" statement block. However, the problem was that I was unable to set the parameter to NULL in the IF ELSE statement. So please correct my IF ELSE statement in the store procedure. This is really urgent and important for my project.
spGetMealsByNutritions]
@MealTypeID Int,
@Gluten Bit = Null,
@Dairy Bit = Null,
@Egg Bit = Null,
@Fish Bit = Null,
@Veg Bit = Null,
@Pork Bit = Null,
@Beef Bit = Null,
@Soy Bit = Null,
@Sesame Bit = Null
[code]...
I'm having this very annoying issue.Trying to make ASP.NET profile work in my MVC2 application.This is the C# code:
[Code]....
Here is the web.config file:
[Code]....
And finally the controller action:
[Code]....
As soon as I submit the form I get an error. I can't even debug C# as the error occurs before stepping into
public ActionResult Create(UserProfile model, string submitButton)...The error is:
Server Error in '/' Application.
Value cannot be null.Parameter name: username
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.ArgumentNullException: Value cannot be null.Parameter name: username Source Error:
[Code]....
Stack Trace:
[Code]....
[ArgumentNullException: Value cannot be null.
Parameter name: username]
System.Web.Util.SecUtility.CheckParameter(String& param, Boolean checkForNull, Boolean checkIfEmpty, Boolean
[code]...
i am inserting the value of dynamic controls into the db like so;
Dim ae1 As DropDownList = FindControl("AreasExpertise1")
If (ae1 IsNot Nothing) Then
x.Parameters.AddWithValue("@areasexpertise1", ae1.SelectedValue)
End If
then in my query i have parameters like so;
INSERT INTO [foo] ([etc], [etc], [etc], [areasexpertise1], [areasexpertise2])
VALUES (@etc, @etc, @etc, @areasexpertise1, @areasexpertise2)
When the user fills out the form, they see only areasexpertise1 and have to press a button to dynamically insert another area of expertise...If they only have 1 area of expertise, the query crashes and says 'must declare variable @areasexpertise2.Please can you tell me a way to either insert nulls when the parameters are empty, or to ignore them?
I'm trying to write a query that will work in two situations. In some situations the value for AOL will be Null and in others there will be a vnumeric value. How do I get this procedure to accept Null if its passed in but also accept a numeric value if it's passed in?
[Code]....
for some reason i get an error saying the following. i have tried to look it up on google but there seems to be nothing about this error.
View 2 RepliesHow can i check if an output parameter is null before i bind it to a asp literal, and if it is null i want to just make the literal
hname1.Text = cmd.Parameters("@hotel1").Value
hname1.DataBind()
hname2.Text = cmd.Parameters("@hotel2").Value
[code]...
I have set the value of an int parameter to the attribute of a textbox.The textbox can be empty or null, how to check whether the parameter is empty or null?
View 5 RepliesI'm using a custom route to create the following URL (http://mysite/subscriber/12345) where 12345 is the subscriber number. I want it to run the ShowAll action in the Subscriber controller. My route is firing and using Phil's route debugger, when I pass in the above url, the route debugger shows ID as 12345.
My controller is accepting an int as subscriberID. When it fires, the controller throws the error "The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32". Why does the route debugger show a value and the controller doesn't see it?
Here's my route (first one is the culprit)
routes.MapRoute(
"SubscriberAll",
"subscriber/{id}",
new { controller = "Subscriber", action = "ShowAll", id=0 },
new { id = @"d+" } //confirm numeric
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
I'm getting a null in the ShowAll action? Here is the action method signature:
public ActionResult ShowAll(int id)
How to check the query string value null, if null then display the default value instead of object reference error.
View 1 RepliesWHEN I USE IS NULL VALUE DIRECTLY INTO MY QUERY IT WORKS GREAT BUT WHEN I TRY TO ASSIGN IS NULL VALUE FROM A PARAMETER ITS WORKING BUT NO ROW RETURN.MY SP LOOK LIKE THISITS WORKING
AND Profile.MarketID IS NULL
AND Profile.SourceID IS NULL
AND Profile.NationalID IS NULL
AND Profile.CRMLanguagesID IS NULL
AND Profile.MarketID LIKE @PMarketID
AND Profile.SourceID LIKE @PSourceID
AND Profile.NationalID LIKE @PNationalID
AND Profile.CRMLanguagesID @CRMLanguagesID
I am trying to use the datadesigner for a project I normally have written the datalayer by hand seems to me you have much more control over whats going on , however , I am starting a project which is going to have the datalayer done in the data designer but I cannot get past the most basic of tasks .Parameter name: Original_LastName
[ArgumentNullException: Value cannot be null.Parameter name: Original_LastName] DAL.northwindTableAdapters.EmployeesTableAdapter.Update(String LastName, String FirstName, String Title, String TitleOfCourtesy, Nullable`1 BirthDate, Nullable`1 HireDate, String Address, String City, String Area, String PostalCode, String Country, String HomePhone, String Extension, Byte[] Photo, String Notes, Nullable`1 ReportsTo, String PhotoPath, String test, Int32 Original_EmployeeID, String Original_LastName, String Original_FirstName, String Original_Title, String Original_TitleOfCourtesy, Nullable`1 Original_BirthDate, Nullable`1 Original_HireDate, String Original_Address, String Original_City, String Original_Area, String Original_PostalCode, String Original_Country, String Original_HomePhone, String Original_Extension, Nullable`1 Original_ReportsTo, String Original_PhotoPath, String Original_test, Int32 EmployeeID) in C:Users
[code]...
I am creating a TableAdapter using corresponding wizard, with a GetDataByID() query. The select statement is like this:select * from books where ID = ?Thus books are filtered by ID. But in case a null is passed as a parameter, I want to select all records rather than none. Could you please tell me how I can do it?
View 4 Repliesi have a WebSite project which i published, in the machine where i published the WebSite everything works smooth. when i moving it to the server, i got the Error:
Value cannot be null.Parameter name: type
Description:
An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.Parameter name: type
and the details of it:
[code]...
How can i fix it?
this is my html code [Code]....
i need to set null value to SqlDataSource Insert Parameter at runtime
i am used this code
[Code]....
I have a SQLDataSource on an ASP.Net C# page. I want the ability to add a Control Parameter based on a DropDown List that will either display records that are either NULL or Not NULL In a Column. I have the following Code Snippet:
SelectCommand="SELECT [PATID], [LastName], [FirstName], [UIN], [Rate], [Account], [Project], [Supervisor], [HireDate], [Assistantship], [Hourly], [FundingStartDate], [FundingEndDate], [TerminationDate], [Citizenship], [TitleCode], [Email], [Notes],
[SupervisorUpdateEnabled], [SupervisorTargetSemesterCode], [PATCertDate] FROM [PATAccounts] WHERE TerminationDate @Terminated ORDER BY [LastName]"
I have article.aspx page that there is some Textboxs and fileupload control and insert when users click on btnInsert their data insert into database below is Behind code
protected void btnInsert_Click1(object sender, ImageClickEventArgs e)
{
string path = Server.MapPath(".") + "../image/House/article/pdf";
string filename = System.IO.Path.GetFileName(fuppdf.PostedFile.FileName);
string[] validext = { ".pdf" };
string ext = System.IO.Path.GetExtension(fuppdf.PostedFile.FileName);
if (Array.IndexOf(validext, ext.ToLower()) < 0)
[code]....