Search Results

Search found 14 results on 1 pages for 'jova'.

Page 1/1 | 1 

  • How to get HandleUnauthorizedRequest to return correct url?

    - by Jova
    I'm writing a custom AuthorizeAttribute which should redirect unauthorized users to the login page. My HandleUnauthorizedRequest method looks like this, protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext) { RouteValueDictionary returnRoute = new RouteValueDictionary(); returnRoute["controller"] = "Account"; returnRoute["action"] = "Login"; returnRoute["returnUrl"] = filterContext.HttpContext.Request.Url.AbsolutePath; filterContext.Result = new RedirectToRouteResult(returnRoute); } Unfortunately it's not working properly as the returning url looks like this, www.mydomain.com/?controller=Account&action=Login&returnUrl=%2FUser%2FEditProfile%2FUsername What is the reason for this and how do I correct it?

    Read the article

  • Changing an extention method from linq-to-sql to entity framework

    - by Jova
    I'm changing my project from working with Linq-to-SQL to working with Entity Framework. I have some extention methods that extend the classes created by LINQ and I'm wondering how to change them to work with the entities instead Here's an example. public static int GetPublishedArticlesCount(this Table<Article> source) { return GetPublishedArticles(source.Context as DataContext, null).Count(); } This method gets the number of published articles. Instead of using this Table<Article>, what should I use instead?

    Read the article

  • Jquery - Get all other menus to slide up

    - by Jova
    I have a drop down menu made with Jquery. Right now, if you hover over all the menu items, their submenus will all show at the same time. I would like that if I hover over one menu, then go to the next, that the previous menu's submenu will slide back up. As it is now, I have to hover out of the submenus for them to slide up. To put it simpler, when hovering over a parent menu, slide up all other parent menu's submenus if they're open. $("#DropDownMenu li.parent").hover(function() { $(this).find(".subMenu").slideDown('fast').show(); $(this).parent().find(".subMenu").hover(function() { }, function() { $(this).parent().find(".subMenu").slideUp('slow'); }); });

    Read the article

  • Is looping through the entityreference the correct way?

    - by Jova
    I want to get all users that have a specific role to a list of usernames. Is using .Include to include all the users, and going through the UsersReference the best way to loop through all the users that are associated with the role? I noticed I could not do a foreach(User user in role.Users) but UsersReference seem to work, but is that how it's supposed to be done? Going through the reference? using (var context = new MyEntities()) { List<string> users = new List<string>(); Role role = (from r in context.Roles.Include("Users") where r.RoleName == roleName select r).FirstOrDefault(); foreach (User user in role.UsersReference) users.Add(user.UserName); return users.ToArray(); }

    Read the article

  • ASP.NET MVC Cookie loses value when page is changed

    - by Jova
    When a user logs in to my site, I create a cookie with some info in it. However, whenever they change page from logging in, the cookie loses it's value. Cookie is still there but it's empty. I've checked my code and the cookie doesn't get rewritten by anything I've done. Does anyone have any idea to why the cookie becomes empty when the page is changed?

    Read the article

  • Why can't I use resources as ErrorMessage with DataAnnotations?

    - by Jova
    Why can't I do like this? [Required(ErrorMessage = "*")] [RegularExpression("^[a-zA-Z0-9_]*$", ErrorMessage = Resources.RegistrationModel.UsernameError)] public string Username { get; set; } What is the error message telling me? An attribute argument must be a constant expression , typeof expression or array creation expression of an attribute parameter type.

    Read the article

  • Using a NullTempDataProvider crashes at PossiblyLoadTempData()

    - by Jova
    I'm trying to use a dummy TempDataProvider for some of my controllers. The provider looks like this. public class NullTempDataProvider : ITempDataProvider { public IDictionary<string, object> LoadTempData(ControllerContext controllerContext) { return new TempDataDictionary(); } public void SaveTempData(ControllerContext controllerContext, IDictionary<string, object> values) { } } But I'm getting an error that says System.NullReferenceException: Object reference not set to an instance of an object. at System.Web.Mvc.Controller.PossiblyLoadTempData() Any help for figuring out the reason for it is much appreciated.

    Read the article

  • Problem with ASP.NET MVC DropDownList not displaying selected value

    - by Jova
    I have an aspx page which allows me to edit articles. Among things I can edit is which category the article belongs to. The category is chosen through a DropDownList as shown here, <%= Html.DropDownList("categoryID", (IEnumerable<SelectListItem>)ViewData["CategoryID"], new { @class = "textbox" }) %> However, the articles category isn't selected when I go to that page. The ViewData I use for the DropDownList looks like this, ViewData["CategoryID"] = new SelectList(categories, "CategoryID", "Title", article.CategoryID); Which should select the article.CategoryID as it's selected value. Have I done this wrong?

    Read the article

  • Jquery - Hide specific div

    - by Jova
    I have several divs that share a common class. If one of these divs do not have a child div, I want to hide the div. I can find the right div but I'm unable to hide it. This is my code, $(function() { if ($(".adRight.childen('div')").length == 0) { $(this).hide(); } }); What should I use instead of (this)? this refers to the document and not the div the if-statement found.

    Read the article

  • Upgraded jquery to 1.4.2. Now project doesn't find jquery

    - by Jova
    I have a C# ASP.NET MVC application which has been using jquery 1.3.2 in VS2008 environment. I decided to upgrade to 1.4.2 and added the file to my project. Changed the reference in my masterpage header to the new version. But now nothing works, it's like it can't find the jquery library. What could be wrong?

    Read the article

  • Expression Blend 3, solution not supported

    - by Jova
    I'm trying to open a silverlight 4 application solution in Expression Blend 3. However, Blend says that the solution is not supported. Is there something I'm missing? I'm following an example in the book Microsoft Silverlight 4 Business Application Development.

    Read the article

  • How to get a related element with Jquery?

    - by Jova
    <div class="severalDivs"> <table> <tbody> <tr> <td class="target"> <a href="link"></a> </td> <tr> </tbody> </table> <div class="fromHere"> <a href="somescript()"></a> </div> </div> How do I with Jquery get "link" in "target" when clicking the anchor with "somescript()" in "fromHere"? Hope It's clear what I want to do. =)

    Read the article

1