我有 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和空查询字符串参数
发布评论