asp.net-mvc

ASP.NET MVC jquery.UI dialog - How to validate the dialog's input on server and return error?

I am using jQuery1.4.2, ASP.NET MVC 2 and jQuery.UI-1.8. I am creating a data input dialog which works OK when all the data is valid, but I want to validate the input data on the server and return an error to the dialog describing the error and I am not quite sure how to do that and keep the dialog open. The dialog is opened when a link...

Need an advice for ASP.NET MVC2 Newsletter Project

I'm new in ASP.NET MVC2. But I want to develop a simply Newsletter site. The main problem which stuck me is how correctly use MVC pattern in News details and comments list. For example: I have a NewsController and action Details inside. And two model classes News and Comments. I want show all comments belongs to this News record and te...

jqGrid - edit function never getting called

I'm having a problem with JQGrid using ASP.NET MVC. I'm trying to follow this example (after you go to that link, over on the left side of the page please click Live Data Manipulation, then Edit Row), but my edit function is never getting called (i.e. it's never getting into the $("#bedata").click(function(). Does anyone know what could ...

What should every ASP.Net programmer know ?

How does one be called a ninja ASP.Net programmer? What set of tools and immediate knowledge(Without having to open MSDN, SO, or Google) should be known to be considered a master? Webforms or MVC... ...

How to Display Validation Error Messages on an ASP.NET MVC Page?

I am pretty new to ASP.NET and C# I have spent the day learning the basics of the ASP.NET Membership provider I have built all my validator but are getting stuck at outputting my error message on the page. private void LogCreateUserError(MembershipCreateStatus status, string username) { string reasonText = status.ToString(); s...

asp.net-mvc routing how to map Home/Action/id to just action/id ?

At the moment I have just this route defined routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" } ); I want to map the /Home/Action1/id...

asp.net mvc, jquery dialog + select + getJson (different results in ff, ie and chrome)

Hi everybody. i'm using jquery 1.3.2, and have a problem in situatsuin where i fill select via getJson html : <div id="dialDiv"> <select id="select_elem" name="select_elem" style="font-size: 1.4em; line-height: 1em; font-weight: bold; color: #333;"> <input type="button" name="lock" id="lock" value="Lock" onclick="LockTime();" ...

fill data in dropdown box as per previous dropdown box data selected in aspnet mvc 1

hi, i'm buildin' an employee registration form in aspnet mvc, i have fields like "School" list in 1 dropdown box and "Department" list another, problem is i want to show Department list on change of School list, i have done followin' code: public ActionResult EmployeeCreate() { var getSchool = SchoolRepository.GetAllSchoolsInArray(...

Can we Get the Session Values in Views in asp.net MVC?

Can we Get those Values which is in Session directly in asp.net MVC Views? I have tried it in Controller it Works,I can easily get & set the Value, But how to Get value directly from Session in Views? ...

Best practice for conditional output in ASP.NET MVC?

I'm ramping up on ASP.NET MVC and looking at how I output messages in the view. What's the best way to do something like this? Helpers? Controls? Or just as is? <% if (ViewData.ContainsKey("message") && !string.IsNullOrEmpty(ViewData["message"].ToString())) { %> <div class="notice"> <%= ViewData["message"] %> </div> ...

Ninject: Abstract Class

Do I need to do something different in an abstract class to get dependency injection working with Ninject? I have a base controller with the following code: public abstract class BaseController : Controller { public IAccountRepository AccountRepository { get; set; } } My module looks like this: public cla...

converting an interface to a type in MVC

Hi. I have a small isuse regarding an interface. Consider this code: [HttpPost()] public void Update(IAuctionItem item) { RedirectToAction("List"); } Whenever I call this I get an exception saying I can't create an instance of type which i totally correct. But is there a way of telling what the interface should map to without ac...

Is there anything "objective" about C# 4.0, or ruby-like?

This is a very "high-level" question. I'm looking for insight into this problem that c# has. It has so many features that it supports almost ANY task, alas there are alternatives that are better suited for some tasks. With the advent of MVC(old news) + ruby, people are starting to have "fun" AND getting things to work. C# seems like a...

Ideas - storing jquery parameters for later use in partial view

Ok, let me try to clearly explain what I'm attempting to accomplish here. Basically, I have a site that is using a liberal dose of jquery to retrieve partialviews into a consolidated 'single view'. So far so good - it all works great and is very performant. However, I would like to have the ability to 'flag' (using a button) any such ...

How to either return JSON or RedirectToAction?

I have an Action Method that I'd either like to return JSON from on one condition or redirect on another condition. I thought that I could do this by returning ActionResult from my method but doing this causes the error "not all code paths return a value" Can anyone tell me what I'm doing wrong? Or how to achieve the desired result? He...

Cascading MVC controllers with CatchAll Routes

Hi, I have an MVC app which has its routes defined with the final route being a catch all route to a "PageController" for a database driven collection of pages. What I want to achieve is to be able to plugin to the app a second controller to the catch all route which the first controller passes on to if it does not find the url recieved...

I can't get RedirectToAction to work

I have the following Action Method that I'm trying to redirect from if the user is valid. But nothing happens. The breakpoint in the redirected-to action method never gets hit. [AcceptVerbs(HttpVerbs.Post)] public ActionResult Login(User user) { try { if (ModelState.IsValid) { ...

Update Table in Asp.Net MVC

I have table [HTML Table] on page i want to delete record from table and also update table after deletion record. <%= Ajax.ActionLink("Delete Ajax", "PostTypeDelete",new { id = item.int_PostTypeId }, new AjaxOptions{LoadingElementId="status"}) %> I used above code its working fine (it delete record) but it doesn't update table. ...

how to create code behind class file in asp.net mvc?

hai, i want to create index.aspx.cs file in mvc.can anybody tell me the process for this? thank u. ...

how to add default value to the textbox helper through viewdata in asp.net mvc?

i want to add default value to the html text box by the view data. the foolwing code will give an idea wht i want to do exactly <%= Html.TextBox("quantity", <%= Html.Encode(ViewData["quantity"]) %>, new { maxlength = 4 })%> but it shows an error. plz tel me the solution for this. thank in advance.... ...