Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#MVC添加参数以过滤MVCGrid,但url显示查询字符串false_C#_Asp.net Mvc - Fatal编程技术网

C#MVC添加参数以过滤MVCGrid,但url显示查询字符串false

C#MVC添加参数以过滤MVCGrid,但url显示查询字符串false,c#,asp.net-mvc,C#,Asp.net Mvc,如果向Url添加参数,则会将“?”和“=”显示为“%3f”和“%3d” Index/%3fgrid-filter%3dName__1__searchname 我需要的应该是这样的: Index/?grid-filter=Name__1__searchname 我有一个表单,可以在其中插入新用户。单击save按钮后,它将重定向到网格,并使用用户提供的名称调用过滤器 控制器-Save(): 我尝试了Uri.EncodeUriString等等,但是url没有改变。我发现了一些类似的问题,但没有一

如果向Url添加参数,则会将“?”和“=”显示为“%3f”和“%3d”

 Index/%3fgrid-filter%3dName__1__searchname
我需要的应该是这样的:

Index/?grid-filter=Name__1__searchname
我有一个表单,可以在其中插入新用户。单击save按钮后,它将重定向到网格,并使用用户提供的名称调用过滤器

控制器-Save():

我尝试了Uri.EncodeUriString等等,但是url没有改变。我发现了一些类似的问题,但没有一个对我有效。我做错了什么?

嘿,谢谢你的帮助。 它与此代码一起工作

 filter = "Name__1__" + name.Name;
    var dictionary = new RouteValueDictionary();
                        dictionary.Add("grid-filter", filter);                 
                        return RedirectToAction("Index", dictionary);
因此,url将右键显示参数:

/Index?grid-filter=Name__1__tttttttt
嘿,谢谢你的帮助。 它与此代码一起工作

 filter = "Name__1__" + name.Name;
    var dictionary = new RouteValueDictionary();
                        dictionary.Add("grid-filter", filter);                 
                        return RedirectToAction("Index", dictionary);
因此,url将右键显示参数:

/Index?grid-filter=Name__1__tttttttt

var filter=“Name\uuuu 1\uuuuu”+user.Name;返回RedirectToAction(“Index”,new{grid filter=filter})他不知道网格过滤器。我收到一条错误消息,它需要是
grid\u filter
(下划线,而不是连字符)ok我现在可以重定向到视图,但网格没有筛选名称。它仍然显示所有条目。Url now:/Index?grid\u filter=Name\uuuuu 1\uuuu test12与/Index?grid filter=Name\uuuuu 1\uuuu test12一起工作。因此,我认为错误在于URL中现在的下划线。您没有显示任何代码
Index()
,也没有显示您如何过滤数据(有人怎么能猜到您在做什么)
var filter=“Name\uuuuu 1\uuuuu”+user.Name;返回RedirectToAction(“Index”,new{grid filter=filter})他不知道网格过滤器。我收到一条错误消息,它需要是
grid\u filter
(下划线,而不是连字符)ok我现在可以重定向到视图,但网格没有筛选名称。它仍然显示所有条目。Url now:/Index?grid\u filter=Name\uuuuu 1\uuuu test12与/Index?grid filter=Name\uuuuu 1\uuuu test12一起工作。因此,我认为错误在于URL中的下划线。您没有显示任何代码
Index()
,也没有显示您如何过滤数据(谁能猜到您在做什么)