mvc

Problem with View - it does not refresh after db update

Hi, I am working with small ASP.NET MVC project - online store. I have addToCart method which adds selected product to cart - it updates cart table in my db and showing cart view with its content. But I have problems. While db is updating correctly the view does not. I see that quantity of the product in my db is incremented correctly ...

View / ViewModel - what is the sense (in a WPF control)?

Not as funny as it sounds. Normally the View / ViewModel should decouple the presentation from the business logic. Good. Now, a Control in WPF is basically invisible unless made different (with the exceptions of UserControl and Window that have XAML directly attached). The Style is putting in the "visual presentation" - which basicall...

how to call a helper method from controller in rails?

I created a helper method for some simple calculation. This helper method will just return an integer. I need the helper in both controllers and views. Unfortunately, it work well in views but not in controllers. I get the undefined local variable or method error. How can I fix it? Thanks all ...

CheckBox in asp.net mvc

i have two options One <%= Html.CheckBox("postType", false, new { @id = item.int_PostTypeId.ToString() })%> Second <input type="checkbox" name="postType" value="<%= item.int_PostTypeId.ToString() %> 1st question: what is differenct between these two method of check box declaration. 2nd question: and how can we get value of chec...

Bind Child table data on View field- MVC ASP.Net

I have two tables Contact and Addresses. Addresses is the child table of Contact. When i create view for Contact. i also want to get addresses for user as many as user wants. For contact table i bind the textbox and add validation like this <%= Html.TextBoxFor(model => model.ContactName) %> <%= Html.ValidationMessageFor(model => model.C...

MVC, Service Layer and file upload/storage

Hello, I'm a using a layered architecture with Zend Framework. I have MVC with : Controllers > (DTOs) Services (Service Layer) > (DOs) Repositories > Persistance Now i have to handle image galleries. The upload process is handle by the front, but what part is responsible for the thumbs generation ? Do i have to store pictures to a ...

Best way and problems when using ajax tabs with an MVC PHP project

Hi, I'm building an IMDB.com like website using PHP/jQuery and a MVC approach (no OOP). I have an index.php base controller to 'rule them all' :), a controllers folder with all the controllers, a models folder and a view folder. In some pages of the website I have tabbed navigation, when the visitor clicks on one of those tabs to get m...

mvc consistent route parameters without re-initializing every action

Trying to consistently tack on a route parameter for every action without having to set it every action I tried this with ViewData but it seems ineffecient to do to every action. when I have over 40-50 actions, and Sessions are a no go for me. Is there a simpler way through filters or something else I could use? eg. http://localhost/myC...

PHP-How to choose XML section based on an attribute?

All, I have a config xml file in the following format: <?xml version="1.0"?> <configdata> <development> <siteTitle>You are doing Development</siteTitle> </development> <test extends="development"> <siteTitle>You are doing Testing</siteTitle> </test> <production extends="development"> <siteTit...

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...

ASP.NET MVC AuthorizeAttribute passing values to ActionMethod?

Hi everyone I'm only a newcomer to ASP.NET MVC and am not sure how to achieve a certain task the "right way". Essentially, I store the logged in userId in HttpContext.User.Identity and have written an EnhancedAuthorizeAttribute to perform some custom authorization. In the overriden OnAuthorization method, my domain model hits the data...

How to set the default error message in mvc2 validation

Hi How can I change the default error message for required rule validation for example? ...

how to return an error in an Ajax scenario from ASP.NET MVC action

I am using ASP.NET MVC with jquery. I have the following MVC Action that returns a partial page on Success. On Application Error, I am not sure what to send it for correctly handling it at the client side. public ActionResult LoadFilterSet(int filterSetId) { try { BreadCrumbManager bcManag...

How does MVC Client Side validation work exactly?

I have used MVC MVC 2.0 Client Side validation, but it does not work as expected. Now I am trying to find out, what I did wrong. How does it work? I have this rendered form: <form method="post" action="/Sprint/Edit/68d4886b-a86a-4f0b-b713-39219febddf3"> <fieldset> <legend>Sprint</legend> <table> <tb...

KO3: How to deal with stylesheets and scriptfiles

I'm using Kohana 3 and it's template controller. My main site template controller currently looks something like this: <?php defined('SYSPATH') or die('No direct script access.'); abstract class Controller_SiteTemplate extends Controller_Template { public function before() { parent::before(); // Initialize defa...

How to redirect every uri calls to one controller, except some static ones?

Hey, I'm using codeigniter and want to make my portal a bit more SEO friendly. I have a controller (articles) which handles every article on my portal. The URL looks like this: example.com/articles/category-sub-category/article-name I'm using mod rewrite module to hide my index.php, and codeigniter routing to hide the controller actio...

How do I close an infowindow with Google Maps 3 API?

I've seen the other posts, but they dont have the markers being looped through dynamically like mine. How do I create an event that will close the infowindow when another marker is clicked on using the following code? $(function(){ var latlng = new google.maps.LatLng(45.522015,-122.683811); var settings = { zoom: 10, ...

ASP.NET MVC Head Verb and Selenium RC

Selenium (RC) is being used to test an ASP.NET 1.1 site. When we make a request via Selenium RC (which in turn automates the request via a configured browser - in this case Firefox) the http verb is "HEAD". We have several form action methods that have separate GET and POST methods decorated with AcceptVerbs(HttpVerbs.Get) or HttpVerbs...

C# - Is it possible to start my project with a class instead of a form?

I want my project to be started through an class instead of a form, is there any way to do this? Or to be more precise is there any good way to make sure that the first class, except Program, that is started isn't a form-class. I tried to change to my class in Program.main() but it looks like Application.run() needs a ApplicationContext...

Cannot remove an entity that has not been attached on delete

repository : public IQueryable<Feature> GetAllFeaturesByLinkAndParentID(int id) { return from gp in db.Features where gp.int_ParentId == id && gp.bit_IsLink == false select gp; } controller: int GetFeatureId = Convert.ToInt32(collection["FeatureList"]); //dropdown var DeleteFeat...