MVC :: MVC3 RC2 Bug Binding From Request Parameters To Method Parameters?

Dec 10, 2010

Since ASP.NET MVC3 RC2 I encounter a bug when posting values to a controller method of which one of the parameter is a nullable int. Steps to reproduce:

I've created a test method

[code]....

In MVC3 RC1 this was working without any problems with the nullable int

Update:
I don't seem to have the problem with a newly created MVC3 website. What could I have in my project that influence model binding to nullable int's? And why would there be a difference between RC1 and RC2?

View 10 Replies


Similar Messages:

SQL Server :: What If Multiple Output Parameters And Input Parameters And Also Want A Select Table

Feb 16, 2011

[Code]....

When I want to get the output values its okay but I also want returning a table as a result data.But Datareader has no rows.is it possible if I want a returning query result and multiple output values togather ?I wrote a test above.I can get output values as sqlparameters. But Datareader attached to a Gridview is empty.can you detect whats wrong here and it doesnt return a query result.So stored procedure is not standart or ı am doing something wrong.this doesnt raise any exception.but not returning any data.

[code]....

View 8 Replies

How To Define A Route That Have 2 Optional Parameters In The Middle Of The URL The Start An End Parameters Are Digits

Jun 7, 2010

I want to define a route that have 2 optional parameters in the middle of the URL the start an end parameters are digits

[Code].....

View 1 Replies

WCF / ASMX :: Too Many Parameters 400 Bad Request Error

Dec 23, 2010

I created a WCF. The web.config is as follows,

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
</system.serviceModel>
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
The following can be seen in the service.svc file,
class AppServiceHostFactory : ServiceHostFactory
{
protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
{
return new WebServiceHost2(serviceType, true, baseAddresses);
}
}
This is the method in the service.svc.cs,
[WebHelp(Comment="Sample description for GetData")]
[WebGet(UriTemplate="/GetData/param1/{i}/param2/{s}")]
[OperationContract]
public SampleResponseBody GetData(string i, string s)
{
// TODO: Change the sample implementation here
// if (i < 0) throw new WebProtocolException(HttpStatusCode.BadRequest, "param1 cannot be negative", null);
return new SampleResponseBody()
{
Value = String.Format("Sample GetData response: '{0}', '{1}'", i, s)
};
}

The following is the webservice url. It returns data if it's run through the asp.net engine but throws bad request when run from IIS. I added the following entry in the web.config but no use. it still fails.

<httpRuntime maxRequestLength="1500000" executionTimeout="180"/>

[URL]-499,500~~~/param2/621100,621600,622100,611500,611600,611700,561300,611100,611200,611300,611400,622200,622300,623100,621100,621600,622100,611500,611600,611700,561300,611100,611200,611300,611400,622200,622300,623100,621100,621600,622100,611500,611600,611700,561300,611100,611200,611300,611400,622200,622300,623100,,622100,611500,611600,611700,561300,611100,611200,611300,611400,622200,622300,623100,611100,611200,611300,611400,622200,622300,623100,611100,611200,611300,611400,622200,622300,623100,611100,611200,611300,611400,622200,622300,623100,623100,611100,611200,611300,611400,622200,622300,623100,623100,611100,611200,611300,611400,622200,622300,623100,622300,623100,623100,611100,611200,611300,611400,622200,622300,623100,622300,623100,623100,611100,611200,611300,611400,622200,622300,623100,623100,623100,611100,611200,611300,611400,622200,622300,623100,623100,623100,611100,611200,611300,611400,622200,622300,623100,623100,623100,611100,611200,611300,611400,622200,622300,623100

View 2 Replies

Why Parameters Are Encoded When Sent Through HTTP Request

Feb 17, 2011

I am curious to know the reasons why the HTTP request encodes(URLEncoded) all the parameters before sending it across the network in POST request.

View 1 Replies

How To Get The Individual Parameters From The List Of Dynamic Parameters In A Webmethod

May 12, 2010

I am using jquery ajax method on my aspx page,which will invoke the webmethod in the code behind.Currently the webmethod takes a couple of parameters like firstname,lastname,address etc which I am passing from jquery ajax method using

data:JSON.stringify({fname:firstname,lname:lastname,city:city})

now my requirement has been changed such that,the number and type of parameters that are going to be passed is not fixed for ex.parameter combination can be something like fname,city or fname,city or city,lname or fname,lname,city or something else.So the webmethod should be such that it should accept any number parameters.I thought of using arrays to do so, as described here.

But I do not understand how can I identify which and how many parameters have been passedto the webmethod to insert/update the data to the DB.

View 4 Replies

C# - Binding Parameters To OLEDB Command Throws Error

Jul 9, 2010

I am using AS 400 OLEDB with .NET. It uses '?' instead of '@param to bind parameters with a commandNow there is a situation where the command is like

SELECT ...
FROM
(SELECT ...
ROW_NUMBER() OVER(ORDER BY ColumnName) as RowNum
FROM Employees e
) as DerivedTableName
WHERE RowNum BETWEEN @startRowIndex AND (@startRowIndex + @maximumRows) - 1
Now my command becomes
SELECT ...
FROM
[code]...

View 1 Replies

DataSource Controls :: Request.querystring In Select Parameters?

Aug 7, 2010

I need to get a querystring in a select parameter

datasource.selectparameters.add("PostId", request.querystring("PostId"))

Something like that...but...i cant get the snytax right.

View 3 Replies

Databinding - ObjectDataSource Binding With ASP.NET Gridview Auto Adding Parameters?

Feb 16, 2010

I have a gridview databound to an objectdatasource. Everything worked great until I changed 2 columns from asp:BoundField to asp:TemplateField. These are the UPC column and the Part column. I wanted to show a link button for each of these fields that take the user to another page. Now asp.net expects these two fields to be parameters on the update store procedure. Why is this? How do I get it to not assume these columns need to be passed to the store procedure?

Here is the code for the grid view:

[code]....

View 1 Replies

WCF / ASMX :: How To Pass The Parameters Into Webservice Method

Jan 4, 2011

i am working in the webservice project. I have one project when i run it then shows the text box for parameters and return the result after passing the parameters.

But another webservice does not allow me to enter the paramerters when execute then list of methods displayed and then show the soap xml when click at any method.

what difference found in both webserivces are Excuting-one that have the Text boxes: Test: "To test the operation using the HTTP POST protocol, click the 'Invoke' button."

2nd One Not provide the parameter text boxes: Test: "The test form is only available for methods with primitive types as parameters"

Dont know how to fix that. Because i want to debug the webservice and as i am unable to provide the parameter then how can i fix it.

how can i pass the parameters in the 2nd webservice as it has different information mentioned above.

View 1 Replies

WCF / ASMX :: Passing Multiple Parameters To A Web Method?

Dec 15, 2010

I am creating a Web Service, which will be used by a client to send data to our Database.The client will be sending close to 30 fields that will be updated to our table. If I write a Web method, I will need to have all these 30 fields as parameters to that method. Is there a better way than sending all of them as parameters?

View 3 Replies

WCF / ASMX :: Passing Parameters To Webservice Method?

Nov 13, 2010

i have the following method, however i want to pass methods to it, i know how to do it the usual way, however when it comes to Webservices/API's what is the correct way to do it. Here is my method so far;

[Code]....

View 1 Replies

.net - Avoid Web Method Parameters Using Proxy Classes?

May 13, 2010

I have a serializable POCO called DataUnification.ClientData.ClientInfo in a .NET class library project A.It's used in a parameter for a web service defined in project B:

public XmlDocument CreateNewClient(ClientInfo ci, string system)

I now wish to call this web method from project C and use the original DataUnification.ClientData.ClientInfo type in the parameter. However due to the generated proxy class it has now become a different type: WebServices.ClientDataUnification.DataUnificationWebService.ClientInfo.As far as .NET is concerned these are not the same types.

View 3 Replies

Modify Request Querystring Parameters To Build A New Link Without Resorting To String Manipulation

Apr 6, 2010

I want to dynamically populate a link with the URI of the current request, but set one specific query string parameter. All other querystring paramaters (if there are any) should be left untouched. Eg, imagine I want to build a link back to the current page, but with the querystring parameter "valueOfInterest" always set to be "wibble" (I'm doing this from the code-behind of an aspx page, .Net 3.5 in C# FWIW).Eg, a request for either of these two:

/somepage.aspx
/somepage.aspx?valueOfInterest=sausages

would become:

/somepage.aspx?valueOfInterest=wibble

And most importantly (perhaps) a request for:

/somepage.aspx?boring=something
/somepage.aspx?boring=something&valueOfInterest=sausages

would preserve the boring params to become:

/somepage.aspx?boring=something&valueOfInterest=wibble

Caveats: I'd like to avoid string manipulation if there's something more elegant in asp.net that is more robust. However if there isn't something more elegant, so be it. I've done (a little) homework: I found a blog post which suggested copying the request into a local HttpRequest object, but that still has a read-only collection for the querystring params. I've also had a look at using a URI object, but that doesn't seem to have a querystring

View 3 Replies

MVC :: Routing Is Correct, But Parameters Don't Reach The Action Method.

Jul 1, 2010

I've been struggling for some time now with an MVC routing issue, but I have finally reached a point where the basic routing is correct; that is, the application is invoking the correct action method and .aspx page, but the action method fails because no parameters are passed to it.

Before I show detailed screenshots of the problem, I had better provide some background. This is a bibliographic application which, among other things, analyzes text abstracts to identify unique words and the number of occurrences for each word in each document. This data will eventually be inserted into a SQL Server database, but for the time being I only want to do the calculation and display the results, on a document-by-document basis, in an .ASPX view set up for the purpose. The data structure of the application is as follows:

Collections -this is a set of fifty or so CollectionDetails items.CollectionDetails represent individual documents, in this case books in an academic library. Attributes of the CollectionDetail record are those typical of a library book--author, call number, title, year, and so on. The title and subject catalog headings are combined to form a quasi-abstract, which becomes the basis of the text analysis. In a few cases, I added additional text from Google Books or Amazon synopses and reviews.

MasterStopList contains common words such as pronouns and prepositions that we want to exclude from consideration.

View 8 Replies

Calling Action Method In MVC With JQuery And Parameters Not Working

Dec 27, 2010

I'm trying to call an action method in an MVC application using jQuery. Basically what I want is to take the value of a couple of input fields and call the action method by clicking a button, passing the values of the input fields as parameters. But I only get the value of the "number" parameter, not the "year" parameter.

function selectWeek() {
$('#selectWeekButton').click(function (event) {
var number = $("#selectWeekId").val();
[code]...

I checked the url with an alert, as you can see, and it seems to contain both values fine. But when I check the value of the year parameter in the action method it is null.Here are the input fields:

<span>Vecka: </span>
<input type="text" id="selectWeekId" />
<span>År: </span>
<input type="text" id="selectYearId" />
<input type="button" value="Välj vecka" id="selectWeekButton" />

And the beginning of the action method:

public ActionResult Edit(string number, string year)
//etc...

I know that this looks like a strange thing to do instead of just binding fields, but the reason is that these input fields and their values is not the main purpose of this View. They're just there to select another week in this timesheet application. And besides, I'm going to replace the input fields with a jQuery calendar eventually, so I will still have to do something like this.

So what's the easiest way to do this, and why isn't it working as it is?

View 2 Replies

Pass Entire Entity To Method Or Each Property As Parameters?

Oct 14, 2010

We're developing a business ASP.NET application. Is it better to pass an entire entity to a method or pass each property of this entity as parameters? What is the best practice?

Case 1. Pass Customer entity to a manager - InsertCustomer(Customer cust)
Case 2. Pass each property as a parameter - InsertCustomer(string name, string address...etc)

View 3 Replies

Custom CreateUser Method With Additional Parameters - Store In The Db

Mar 5, 2010

i have implemented custom MembershipProvider and now i would like to use CreateUserWizard to create new users.. the problem is that i want to store in the db more information that normally (e.g. first and last name). There is function:

public override MembershipUser CreateUser(string username, string password, string email,
string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey,
out MembershipCreateStatus status)
{
throw new NotImplementedException();
}

which i can implement but it won't store first name etc. i found here: [URL] solution that i can overload this function and call it manually but the default CreateUser function will still be called in this case...

View 1 Replies

WCF / ASMX :: Any Examples For Consuming Web Service Method By XML Parameters Using MVC?

Jan 18, 2011

For example, we are going to consume web method GetEmployeeByQuery(ConnInfoXML, Query, RecordDetail), ConnInfoXML is login information in XML, Query is a SQL statement selecting records, RecordDetail is all records retrieved. All data are in XML format.

So how to write these parameters in XML to consume this web method and get all the information in XML, and then transfer XML to normal string format ?

View 1 Replies

Thread Safety In Parameters Passed To A Static Method

Jan 10, 2011

Assuming a static method like below is called from ASP.NET page,can a different thread(b) overwrite the value of s1 after the first line is executed by thread(a)?If so, can assigning parameters to local variables before manipulation solve this?

public static string TestMethod(string s1, string s2, string s3)
{
s1 = s2 + s3;
....
...
return s1;
}

Is there are a simple way to recreate such thread safety related issues?

View 3 Replies

DataSource Controls :: Selectcount Method Ignoring Parameters?

Jul 15, 2010

I've got the following scenario:

one object datasource configured with a storedprocedure that has PROCEDURE [dbo].[GetContractsPaged] ( @startRowIndex int, @maximumRows int )

but later I realized that I needed an extraparameter so first I tried to add an extra parameter as a filter like:

<asp:ObjectDataSource ID="odsContrato" runat="server" DeleteMethod="Delete" InsertMethod="Insert" SelectMethod="GetContractsPaged" EnablePaging="True" TypeName="Facturacion.DAL.ContratoDataLayer" UpdateMethod="Update" SelectCountMethod="TotalNumberOfContratos"
FilterExpression="emprnume ='{0}'">
<FilterParameters>
<asp:SessionParameter Name="emprnume" SessionField="emprnume" Type="String" />
</FilterParameters>

Which worked fine but with one problem... apparently selectcount method is ignoring filter parameter and is returning the full set of data. Surfing the net I found that select parameters when used are also taken by seleccount method... the problem is that when I used:

<SelectParameters>
<asp:SessionParameter
Name="emprnume"
SessionField="emprnume"
Type="String"
/>
</SelectParameters>

Inmediately, I received the error : ObjectDataSource 'odsContrato' could not find a non-generic method 'GetContractsPaged' that has parameters: emprnume, maximumRows, startRowIndex.

So I decided to modify my stored procedure to receive an additional parameter and modify my class to reflect the change but when trying to use it I kept on receiving the same error I showed above in bold.

View 10 Replies

How To Give Full Path For Two Required Parameters Of Copy Method

Feb 5, 2011

I have already create special folder to copy default picture for new user and put it inside that folder.

I have used copy method (system.io.file) to do that and works fine but I have to give full path for two required parameters of copy method for example:

I want to pass

sourceDir = "~xyzdefault.gif"
destDir= "~xyz" + userId + ".gif"

can anyone guid me to another method to do that without write full path?

View 6 Replies

MVC :: Making An Html Button Call An Action Method With Parameters?

Mar 10, 2011

how to make a stadard HTML button call an action method and pass parameters to it? Can you please show me an example of how to do this? THis is the method:

public ActionResult CCDReview([DefaultValue(1) int CUrrentPage])
{
//method code is here.
}

Yes, my button is wrapped in a form, and it's a "submit" button.

View 9 Replies

Javascript - Pass Multiple Parameters To OnSuccess Method Of PageMethod?

Dec 9, 2010

I'm calling PageMethod "SameMethod" from javascript method "caller" so that I can get some values from DB. After I get values, control is continuing in "onSuccess" method. Problem is that I need to use some variable values ("importantValue") from javascript method "caller" in "onSuccess" method.


function caller(){
var importantValue = 1984;
PageMethod.SomeMethod(param1,..., onSuccess, onFailure)
}

onSuccess method should be something like this:

function onSuccess(pageMethodReturnValue, importantValue ){
}

Is it possible and, if it is, how to pass multiple parameters (besides return values of page method) to "onSuccess" method of PageMethod?

View 2 Replies

Jquery Dialog Calls A Server Side Method With Button Parameters?

May 27, 2010

I have a gridview control with delete asp:ImageButton for each row of the grid. What I would like is for a jquery dialog to pop up when a user clicks the delete button to ask if they are sure they want to delete it.
So far I have the dialog coming up just fine, Ive got buttons on that dialog and I can make the buttons call server side methods but its getting the dialog to know the ID of the row that the user has selected and then passing that to the server side code. The button in the page row is currently just an 'a' tag with the id 'dialog_link'. The jquery on the page looks like this:

$("button").button();
$("#DeleteButton").click(function () {
$.ajax({

[code]...

The dialog itself is just a set of 'div' tags. Ive thought of lots of different ways of doing this (parameter passing, session variable etc...) but cant figure out how to get any of them working.Any ideas are most welcome

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved