ASP:QueryStringParameter和空查询字符串参数

编程入门 行业动态 更新时间:2024-10-23 08:24:33
本文介绍了ASP:QueryStringParameter和空查询字符串参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有 ASP:GridView控件使用 ASP显示的客户端请求:SqlDataSource的。我想限制由客户端显示的信息:

I haveasp:GridView displaying client requests using asp:SqlDataSource. I want to limit displayed information by client:

View.aspx 已显示所有的内容, View.aspx?客户端= 1 已显示仅请求客户端ID#1。

View.aspx has to display everything, View.aspx?client=1 has to display only requests from client ID #1.

所以,我用< ASP:QueryStringParameter名称=客户端QueryStringField =客户端/> 查询EXEC GetRequest的@client。

一切工作正常指定某些客户端时。但是不要 - 如果不是

Everything works properly when some client is specified. But don't - if not.

我测试使用SSMS我的SP - 能正常工作,在这两种情况下 - 指定的参数时,当它不是( NULL 明确通过)

I tested my SP using SSMS - it works properly in both cases - when parameter is specified and when it isn't (NULL passed explicitly).

我有什么做的?

推荐答案

的SqlDataSource不会,如果它们的参数为null,除非另行指定火:

SqlDataSource won't fire if any of it's parameters are null, unless you specify otherwise:

<asp:SqlDataSource CancelSelectOnNullParameter="False" />

这也可能需要一个空默认值添加到您的查询参数:

It might also be necessary to add a null default value to your querystring parameter:

<asp:QueryStringParameter Name="client" QueryStringField="client" DefaultValue="" ConvertEmptyStringToNull="True" />

更多推荐

ASP:QueryStringParameter和空查询字符串参数

本文发布于:2023-10-29 03:57:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538654.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   参数   ASP   QueryStringParameter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!