asp.net-mvc

Does Razor syntax provide a compelling advantage in UI markup?

I notice Scott Guthrie is starting to mention Razor a fair bit on his blog but I'm just not that sure that it's a good fit for my style. Granted it's a fairly unfamiliar style for someone who's pretty used to a "standard" sort of ASP.Net markup (content place holders and inline code), but it just feels like a lot of additional pages to ...

Your thoughts on "ASP.NET MVC 2 in Action"

Hey fellow ASP.NET MVC devs, I'm looking to buy ASP.NET MVC 2 in Action but I wanted to see if anyones read it and if they would recommend it/or another ASP.NET MVC book. I've already read NerdDinner and I really enjoyed it but am hoping to extend my knowledge and read something else. The description seems quite promising but as they s...

display jquery dialog till data is loaded.

Hi, I have 2 div one to load data from an ajax request and another to display Jquery dialog with gif image which says loading. The jquery dialog is displayed when the page is requested while the ajax function gets the data from the controller. I want to close the dialog when the ajax function completes the request but not sure hot to ...

ASP.NET MVC2 Strongly-typed view databinding question

I'll start off by saying my terminology might be off, which is why I might be having trouble finding an answer to this question, and apologising for the wall of text. I have a strongly-typed view that inherits from a custom type called Record. Record has a dictionary of named fields of varying datatypes - some strings, some ints, some D...

State Management of javascript conent in MVC

I am using asp.net MVC2. i am facing a problem in state management of javascript contents. i have got a image map in which on click on various part of image i am showing same page (redirect with parameters) with some parameter like : Secure/BodyWork?view=7 and on basis of value in parameter view i am showing various content on page. in t...

How to place two submit buttons in form

I have two submit buttons in one form. I want to call different actions in both buttons. Is there any way to accomplish this without using JavaScript. ...

UpdateModel raise exception

I have a strong typed view model and a MetaData partial class which has annotation attributes on required fields and field type. The Create.aspx view page has a form when submitted will execute Create method in the controller. When the user submit the form without all the required fields entered, upon reaching UpdateModel() line an exce...

How to avoid default URL encoding in ASP.NET MVC Html Helpers like RouteLink

I want my url like this: "http://domain.com/tag/高兴" My route mapping: routes.MapRoute("Tag", "tag/{name}", new { controller = "Tag", action="Index" }); But Html.RouteLink will encode the parameters as default. If I use Html.RouteLink in my View, the generated html is: <a href="/tag/%E9%AB%98%E5%85%B4">高兴</a> Is there any way to a...

How to send data to controller by using YAHOO connect and json

I can not send data to MVC controller using YAHOO connect library. Parameters query and filter are NULL. Where is the problem? // --- JavaScript --- // var callbacks = { // Successful XHR response handler success: function (o) { var messages = []; // Use the JSON Utility to parse the data...

jqgrid : send edited data back to controller

I am using ASP.Net MVC and placed a jqgrid on my page. The data source for my jqgrid is a xml file. I have populated a datatable from source xml and then converted this datatable into JSonObject to fill my jqgrid. I know it can be done in better ways but for now I have to apply it this way only.. In the jqgrid, I have enabled editmode f...

getting hidden input type=file to work as desired

I'm trying to do a hidden file upload to iframe and i'm stuck. What seems to be not working is choosing a file. When I unhide form controls and use them everything works fine. If I use form controls to pick a file and then submit form via "send" link - it works fine. When i use choose file link, I can see that file control filled up with...

Cannot open database, Login failed for user

Hi guys, I'm running the nerddinner MVC application on visual studio, and the database is on sql server 2008. I was previously having problems with permissions, etc but I seemed to have these sorted. I created a user - taraw in SQL Server Management Studio, and got this all working. I can log into it fine. When I test the application...

Security Request for JSon Result in Asp.Net MVc

Hello Guys, I developed an application in ASP.NET MVC. This app has an action that returns a JsonResult and I get it with jquery in client side. Everything works fine but I'd like to know, if is there any way to make a security in this action to return only requests that came from my website. Is there any way to avoid others websites t...

When using Castle Validator how can I disable client-side validation for a particular button?

I have an MVC Application that is performing client-side validation using Castle Validator which is enabled with this... <%= Html.ClientSideValidation("formCreateUser", Model, "errorContainer")%> I have one particular submit button on the form that I want to cause a postback without performing the client-side validation. How can I dis...

Action with a string array as parameter

I want to call an action with something similar to this uri: http://server/controller/action/?columns=firstname&amp;columns=lastname&amp;columns=age and use it like this: public ActionResult Action(string[] columns) { } how do I do it? ...

In ASP.NET MVC controller, can I get the view result by calling an action on a different controller

I tried to simply new up a different controller and then calling the action method. The return value is of type ViewResult and the model was created, but the View is null. I guess the context in which the runtime tries to find the correct view is wrong. How can I achieve this? Background Trying to see if a template controller can use ...

How to build URL of WCF REST web services

Hi, I am using the new .NET 4 WCF REST web services. In order to link resources, I'd like to put links in my responses. In ASP.NET I can generate URLs from my routing configuration (e.g. UrlHelper.Action(...)) With WCF REST web services I have an ASP.NET routing configuration plus Uri templates: [WebGet(UriTemplate = "{id}")] MyResult ...

MVC 2; Use a datepicker to input a date in a grid.

Has anyone successfully assigned a datepicker to a date field that is repeated in a grid? Surely someone has done it before? I find a problem with doing this is that the ID for each field in a row is repeated in the next row. So when I assign a date on the 4th row, I update the same field in the first row because their ID is the same. ...

How to stop view returning default value in ASP.NET MVC

I have a site running with ASP.NET MVC 1 and have encountered a bug where a bool in my model is being reset to default because the value is not used in the view. The code for the Controller: public ActionResult Edit(Guid id) { Service service = GetService(id); if (service == null) return View("NotFound"); return ...

Dynamically updating html.listBox in MVC 1.0?

The client will choose an item from a dropDown list, this newly selected value will then be used to find assets linked to that selected item, these assets will then be loaded into the listBox. This sounds simple enough, and I'm aware I could use a partial View but it seems overkill for just updating one component on a form. Any ...