相关疑难解决方法(0)

如何从查询字符串中的表单中删除空字段?

我有一个简单的表格,有四个输入.当我提交表单时,我想使用GET http方法.

例如:

aaa : foo
bbb : ____
ccc : bar
ddd : ____
Run Code Online (Sandbox Code Playgroud)

我想要这个查询字符串:

/?aaa=foo&ccc=bar
Run Code Online (Sandbox Code Playgroud)

问题是我有这个查询字符串:

/?aaa=foo&bbb=&ccc=bar&ddd=
Run Code Online (Sandbox Code Playgroud)

如何从查询字符串中的表单中删除空字段?

谢谢.

forms get query-string

22
推荐指数
4
解决办法
7225
查看次数

在地址栏中隐藏传递给控制器​​的参数(URL 重写或其他内容)

我有以下路线:

routes.MapRoute("Event Overview", "{city}/{type}/{id}",
                            new {city="LA", controller = "BaseEvent", action = "EventOverview"}, new {city = new CityConstraint()});

routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
Run Code Online (Sandbox Code Playgroud)

而且,我网站上的几个链接:

@Html.ActionLink("Make", "EventOverview", "BaseEvent", new { id = eventInfo.Key.OID, type = eventInfo.Key.XPObjectType.TypeName.GetShortTypeName(), activeTab = "#scheduleLink", session = eventInfo.Key.EventSchedules[0].SessionId, hall = eventInfo.Key.EventSchedules[0].HallId, client = eventInfo.Key.EventSchedules[0].BasePlace.PremieraClientId}, null)

@Html.ActionLink("Make", "EventOverview", "BaseEvent", new { id = eventInfo.Key.OID, type = eventInfo.Key.XPObjectType.TypeName.GetShortTypeName(), activeTab …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc asp.net-mvc-3

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

asp.net-mvc ×1

asp.net-mvc-3 ×1

forms ×1

get ×1

query-string ×1