Here's my code for my Facebook share link:
<a href="<%= HttpUtility.UrlPathEncode("http://www.facebook.com/sharer.php?u=http://www.apoads.com"+ Request.Url.PathAndQuery) %>" title="Share on Facebook" rel="nofollow" target="_blank"><img src="/Content/Img/Png/SocialIcons/facebook_16.png" width="16" height="16" alt="share on facebook" /></...
This seemed easier in Web Forms; I'd have a user control, with the logic in the code-behind, and I could just drop it on a page.
But apparently code-behinds are a no-no in MVC, and the logic is in controllers. I'm a little confused about how logic for a user control is "wired up".
I want to display an RSS Feed user control. So I have a...
Hi,
In my application I have the requirement to store, for the period the user stay logged in, some variables that's used to provide a customized experienced on how the user views it's data (pre-defined filters, language, etc.). My needed data is not more than 1Kb.
I have read many blog posts that definitely encourage to not store this...
Why would when using this code in one place set the default as it should but not when moving first two statements into Master file and the last one into View file (ASP.NET MVC app)?
$(function () {
$(".editDate").datepicker({ dateFormat: 'dd.mm.yy' });
$(".editDate").datepicker($.datepicker.regional['sl']);
$("#IssueDate").datepicker('s...
I just developed a simple asp.net mvc application project for English only. I want to block user's any input for a language other than English. Is it possible to know whether user inputs other languages when they write something on textbox or editor in order to give a popup message?
...
i am using asp.net MVC and have been using mvc for quite a while now but i have something along the lines of this:
@View.greeting | <a href="/Login/Logout">LOGOUT</a>
i have to but in the logout link as if i try to pass it over the @View will html encode
and show the html of the link, i would prefer to deliver a result of login or log...
On every page of my website a token is passed in as a querystring parameter. The server-side code checks to see if the token already exists in the database. (The token is a uniqueidentifider field in the database). If the token exists then it will use the existing one, if not then it will create a new row with the new token.
The problem...
Let's say we are developing an E-Commerce Web application for a small to medium sized business. Let's further assume that the business is likely to scale over time. In other words, the product line will typically grow.
Up to now I have developed n-tier solutions using ADO.NET and stored procedures with the help of the SqlHelper class. F...
I have a captcha in my MVC application that is called from a HttpHandler (.ashx).
It works fine in Visual Studio developer server.
I just configure in Global.asax:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{filename}.ashx/{*pathInfo}");//captcha
.........
It igno...
Which approach is more preferrable when changing just a single value in model? Aesthetically-speaking and performance-wise.
Looks clean(albeit with the overhead of pushing the entire model again to the View):
ModelState.Remove("Name");
guestResponse.Name = "John";
return View(guestResponse);
Looks performant:
ModelState["Name"] = ne...
I'm trying to document all the actions in my web app, and one of the things I want do is to provide a sample URL for an action.
Is there a way to list all the actions in a website along with their routes, or maybe a way to find the route from a MethodInfo?
I'm thinking I might have to write a custom attribute for each action to specify...
Hi!
Im looking for a DropDown Tree Select. I have looked at this Tree control, but im not sure how to combind this with a dropdown button where the selected values are shown in the button when not expanded?
BestRegards
SowJim
Edit : Dropdown tree looks somthing like this :
...
The "Admin" area in my app contains a bunch of controllers, and it's a bit repetitive to put an [Authorize] attribute on all of them. Is there a way of telling the framework that all controllers in a certain area should have certain attributes?
Edit: Inheritance is not a solution in this case. First of all the controllers already inheri...
Django has the Flatpages app, which lets site admins change content on specific pages without changing code. Flatpage content i stored in the database, sort of like in a CMS. Flatpages are typically used for about-pages and such.
Are there any good equivalents for ASP.Net MVC? I.e., a convenient way to manage page-content persisted to a...
I want to send a string data with jquery load function but its not sending, my code is
function dialog(data) {
$(function () {
alert(data);
var ph = $("#Org1");
ph.empty();
ph.load("/FrontEnd/DocsDownload", data, function () {
ph.dialog({
...
Hello,
I have a Windows Form project that I would like to migrate toward a web application using ASP.NET MVC2.
In this project I have some POCO classes as in this example that are part of a class library and that I would like to use with a binary reference
public class Person
{
public int PersonID { get; set; }
public string ...
Hi,
I got a adress like this : ~/Content/Files/AdImages/20/20_thumb.jpeg, I need this to be resolved. This was done in ASP.net with Control.ResolveUrl().
According to this article http://stephenwalther.com/blog/archive/2009/02/18/asp.net-mvc-tip-47-ndash-using-resolveurl-in-an-html.aspx, I should use somthing like this :
urlHelper.Co...
In an ASP.NET MVC application I have a CartController with this AddToCart action:
public RedirectToRouteResult AddToCart(Cart cart, decimal productId,
string returnUrl)
{
Product product = productsRepository.Products
.FirstOrDefault(p => p.prodID == productId);
cart.AddItem(product);
return R...
This is kind of a two parter:
1) Where should I be feeding my DDL's from? Right now I have List set in my viewmodel. I've seen a lot of people set the lists in the ViewData[]. Is that what I should be doing, and why?
I've noticed that the DDL values are not retained in the HttpPost and I have to reset them in the view model. If I u...
I feel my question is close to this one, but I want a more general discussion on where code like this should sit. http://stackoverflow.com/questions/2149855/asp-net-mvc-selectlist-refactoring-question
I currently create my selectlists directly on my entity model, like so.
public SelectList taskDeadlineTime
{
get { return ne...