Sorting a table in asp.net MVC

前端 未结 5 1261
半阙折子戏
半阙折子戏 2021-02-07 08:36

I was wondering how people were going about sorting a table in asp.net mvc? I\'ve heard of javascript solutions that work pretty well with non-paged tables, such as jquery\'s ta

5条回答
  •  我在风中等你
    2021-02-07 09:07

    If JavaScript is disabled, you have a problem.

    I'd go for a noscript solution.

    I'd have two radio button groups:

    direction:  ( ) ascending    (.) descending
    
    orderBy:  (.) Id   ( ) Name   ( ) Status
    

    I'd treat the View as a form with multiple submit buttons:

    (without JavaScript) ~~ same name for both buttons.

    on your .aspx page, add three buttons:

     
     
     
    

    in your Controller:

    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult Sort(string direction, string orderBy, string submitButton)
    {
        if (submitButton == "Requery")       //et cetera
    

    TMTOWTDI: There's More Than One Way To Do It

提交回复
热议问题