Click here to Skip to main content
15,884,950 members
Home / Discussions / ASP.NET
   

ASP.NET

 
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
Mou_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
Mou_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
Ayrton 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
Mou_kol1-Feb-18 23:04 
My routing code is not working.

i am showing data in tabular format with sorting and pagination. my solution is working. when i hover mouse on column then url looks like
HTML
http://localhost:55831/Customers?page=2&SortColumn=CompanyName&CurrentSort=ContactName


when i click on pagination numeric link then url looks like
HTML
http://localhost:55831/Customers?page=3&SortColumn=ContactName


i want my url should look like

HTML
1) http://localhost:55831/Customers/2/CompanyName/ContactName 
2) http://localhost:55831/Customers/3/ContactName


so i add one routing code. here it is
C#
routes.MapRoute(
        name: null,
        url: "Customers/{page}/{SortColumn}/{CurrentSort}",
        defaults: new
        {
            action = "Index",
            page = UrlParameter.Optional,
            SortColumn = UrlParameter.Optional,
            CurrentSort = UrlParameter.Optional
        }
    );


after adding the above routing code url looks bit weird. now url looks like

C#
http://localhost:55831/Customers/1/CompanyName/CompanyName?controller=Customers
http://localhost:55831/Customers/2/CompanyName?controller=Customers


so when i click on above links then i am not redirecting to proper controller and action rather getting error.

so it means there is some problem in code which i added as routing in route.config.cs file.

my full routing code
C#
routes.MapRoute(
        name: null,
        url: "{controller}/{action}/{page}/{SortColumn}/{CurrentSort}",
        defaults: new
        {
            action = "Index",
            page = UrlParameter.Optional,
            SortColumn = UrlParameter.Optional,
            CurrentSort = UrlParameter.Optional
        }
    );

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

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

so please help me to get my desired url what i mention above. thanks

modified 2-Feb-18 5:25am.

AnswerRe: ASP.Net MVC: Need guide line for a specific routing Pin
F-ES Sitecore2-Feb-18 1:33
professionalF-ES Sitecore2-Feb-18 1:33 
GeneralRe: ASP.Net MVC: Need guide line for a specific routing Pin
Mou_kol4-Feb-18 8:10
Mou_kol4-Feb-18 8:10 
QuestionHow to create a popup when button clicked in parent form and display data grid view with selected columns data and with find and cancel buttons in popup and How to pass a selected value from popup window to parent form's TextBox? Pin
Member 113056081-Feb-18 6:22
Member 113056081-Feb-18 6:22 
AnswerRe: How to create a popup when button clicked in parent form and display data grid view with selected columns data and with find and cancel buttons in popup and How to pass a selected value from popup window to parent form's TextBox? Pin
Richard MacCutchan1-Feb-18 6:46
mveRichard MacCutchan1-Feb-18 6:46 
QuestionWhat type of db is stored in app_data folder of asp.net project Pin
Mou_kol1-Feb-18 1:51
Mou_kol1-Feb-18 1:51 
AnswerRe: What type of db is stored in app_data folder of asp.net project Pin
A_Griffin1-Feb-18 23:52
A_Griffin1-Feb-18 23:52 
QuestionBootstrap CSS: How to bring X icon for textbox Pin
Mou_kol29-Jan-18 23:18
Mou_kol29-Jan-18 23:18 
AnswerRe: Bootstrap CSS: How to bring X icon for textbox Pin
Richard Deeming30-Jan-18 0:50
mveRichard Deeming30-Jan-18 0:50 
GeneralRe: Bootstrap CSS: How to bring X icon for textbox Pin
A_Griffin30-Jan-18 1:09
A_Griffin30-Jan-18 1:09 
GeneralRe: Bootstrap CSS: How to bring X icon for textbox Pin
Richard Deeming30-Jan-18 1:16
mveRichard Deeming30-Jan-18 1:16 
GeneralRe: Bootstrap CSS: How to bring X icon for textbox Pin
Richard Deeming30-Jan-18 7:05
mveRichard Deeming30-Jan-18 7:05 
GeneralRe: Bootstrap CSS: How to bring X icon for textbox Pin
A_Griffin30-Jan-18 7:23
A_Griffin30-Jan-18 7:23 
GeneralRe: Bootstrap CSS: How to bring X icon for textbox Pin
Mou_kol30-Jan-18 21:31
Mou_kol30-Jan-18 21:31 
GeneralRe: Bootstrap CSS: How to bring X icon for textbox Pin
Mou_kol30-Jan-18 21:33
Mou_kol30-Jan-18 21:33 
GeneralRe: Bootstrap CSS: How to bring X icon for textbox Pin
Richard Deeming31-Jan-18 7:53
mveRichard Deeming31-Jan-18 7:53 
GeneralRe: Bootstrap CSS: How to bring X icon for textbox Pin
Mou_kol31-Jan-18 20:42
Mou_kol31-Jan-18 20:42 
Questionhide a column in gridview Pin
Member 1364937528-Jan-18 22:43
Member 1364937528-Jan-18 22:43 

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.