Click here to Skip to main content
14,663,258 members
Home » Discussions » ASP.NET
   

ASP.NET

 
GeneralRe: EntityFramework: Can we minimize sorting code Pin
Mou_kol8-Feb-18 1:52
MemberMou_kol8-Feb-18 1:52 
GeneralRe: EntityFramework: Can we minimize sorting code Pin
Richard Deeming8-Feb-18 1:58
mveRichard Deeming8-Feb-18 1:58 
QuestionAny free health monitoring dashboard exist Pin
Mou_kol5-Feb-18 22:00
MemberMou_kol5-Feb-18 22:00 
AnswerRe: Any free health monitoring dashboard exist Pin
Richard MacCutchan5-Feb-18 23:29
mveRichard MacCutchan5-Feb-18 23:29 
QuestionSending a collection of objects to the view in MVC Pin
Davstr5-Feb-18 4:42
MemberDavstr5-Feb-18 4:42 
AnswerRe: Sending a collection of objects to the view in MVC Pin
Richard Deeming5-Feb-18 8:25
mveRichard Deeming5-Feb-18 8:25 
GeneralRe: Sending a collection of objects to the view in MVC Pin
Davstr5-Feb-18 18:24
MemberDavstr5-Feb-18 18:24 
QuestionASP.Net MVC:clicking on routelink url not passing all the data to action Pin
Mou_kol5-Feb-18 3:50
MemberMou_kol5-Feb-18 3:50 
i have creating url using routelink.
@Html.RouteLink("Edit", "PageWithId",
            new
            {
                controller = "Customers",
                action = "Edit",
                id = item.CustomerID,
                page = ViewBag.CurrentPage
            })


i am using this routing PageWithId with route link
routes.MapRoute(
        name: "PageWithId",
        url: "{controller}/{action}/{page}/{id}",
        defaults: new { controller = "Customers", action = "Edit", page = UrlParameter.Optional, id = UrlParameter.Optional }
    );


i have 3 routing code in route.config file. here is all
routes.MapRoute(
        name: "PageWithSort",
        url: "{controller}/{action}/{page}/{SortColumn}/{CurrentSort}",
        defaults: new { action = "Index", page = UrlParameter.Optional, SortColumn = UrlParameter.Optional, CurrentSort = UrlParameter.Optional }
    );

    routes.MapRoute(
        name: "PageWithId",
        url: "{controller}/{action}/{page}/{id}",
        defaults: new { controller = "Customers", action = "Edit", page = UrlParameter.Optional, id = UrlParameter.Optional }
    );

    routes.MapRoute(
        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );


when i run my program the route link generate url like http://localhost:55831/Customers/Edit/1/ALFKI

when i click on the link the Edit action is getting called but customer id is getting null where as ALFKI is there in url as customer id.

here is my edit action details
public ActionResult Edit(string id, int page)
{
    if (id == null)
    {
        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
    }
    Customer customer = db.Customers.Find(id);
    if (customer == null)
    {
        return HttpNotFound();
    }
    ViewBag.CurrentPage = page;
    return View(customer);
}


please tell me why id is getting null when ALFKI as passing as customer id?

thanks
AnswerRe: ASP.Net MVC:clicking on routelink url not passing all the data to action Pin
Richard Deeming5-Feb-18 8:17
mveRichard Deeming5-Feb-18 8:17 
GeneralRe: ASP.Net MVC:clicking on routelink url not passing all the data to action Pin
Mou_kol5-Feb-18 21:56
MemberMou_kol5-Feb-18 21:56 
QuestionHow to calculate page no for newly inserted records Pin
Mou_kol5-Feb-18 2:54
MemberMou_kol5-Feb-18 2:54 
AnswerRe: How to calculate page no for newly inserted records Pin
Maciej Los5-Feb-18 3:23
mveMaciej Los5-Feb-18 3:23 
Questionasp.net mvc routing with two controller reference Pin
Mou_kol5-Feb-18 1:18
MemberMou_kol5-Feb-18 1:18 
AnswerRe: asp.net mvc routing with two controller reference Pin
Richard Deeming5-Feb-18 8:09
mveRichard Deeming5-Feb-18 8:09 
GeneralRe: asp.net mvc routing with two controller reference Pin
Mou_kol5-Feb-18 21:54
MemberMou_kol5-Feb-18 21:54 
GeneralRe: asp.net mvc routing with two controller reference Pin
Richard Deeming6-Feb-18 2:11
mveRichard Deeming6-Feb-18 2:11 
GeneralRe: asp.net mvc routing with two controller reference Pin
Mou_kol6-Feb-18 2:38
MemberMou_kol6-Feb-18 2:38 
GeneralRe: asp.net mvc routing with two controller reference Pin
Richard Deeming6-Feb-18 2:50
mveRichard Deeming6-Feb-18 2:50 
QuestionWhat is Kubernetes and its usage Pin
Mou_kol4-Feb-18 22:11
MemberMou_kol4-Feb-18 22:11 
AnswerRe: What is Kubernetes and its usage Pin
Richard MacCutchan4-Feb-18 23:04
mveRichard MacCutchan4-Feb-18 23:04 
GeneralRe: What is Kubernetes and its usage Pin
Mou_kol5-Feb-18 0:36
MemberMou_kol5-Feb-18 0:36 
GeneralRe: What is Kubernetes and its usage Pin
Richard MacCutchan5-Feb-18 0:42
mveRichard MacCutchan5-Feb-18 0:42 
Questionwhat is needed to create a payment getway? Pin
Ayrton Yagami2-Feb-18 6:34
MemberAyrton Yagami2-Feb-18 6:34 
AnswerRe: what is needed to create a payment getway? Pin
OriginalGriff2-Feb-18 6:35
mveOriginalGriff2-Feb-18 6:35 
QuestionASP.Net MVC: Need guide line for a specific routing Pin
Mou_kol1-Feb-18 23:04
MemberMou_kol1-Feb-18 23:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.