CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 Displaying Empty Grids When No Search Criteria Is Specified

Print topic Send  topic

Author Message
hiraldesai

Posts: 38
Posted: 12/18/2007, 5:47 PM

Hi,

http://support.yessoftware.com/kb_article.asp?article_id=65

I have referred to this article but as it is mentioned at the bottom of that article, I have multiple search fields on the form.

What I have done is put a hidden field on Search Form called "Searching" with a default value of "True". In the Before Build Select event of the grid I have put this code.

  
	Dim Request As HttpRequest = HttpContext.Current.Request  
	If Request.QueryString("Searching") Is Nothing Then  
  
	 	DirectCast(Select_,TableCommand).Where = "1 <> 1"  '#Condition that always yields false  
  		DirectCast(Select_,TableCommand).Operation = "AND"  
  
	End If  

This code doesn't display any records on the grid. Which is exactly what I want to happen. But there are several problems.

1) "No Records" Row is not displayed
2) The grid's datasource still has all the records from the table resulting in
a) Navigator still getting displayed with page numbers
b) A label with "Retrieve Total Number of Records" action in before show event displays
total number of records from the table instead of 0

Is this fixable? If yes, does anyone know how?

Regards,
_________________
-------
Hiral
View profile  Send private message
Tuong Do
Posted: 12/19/2007, 8:04 PM

To solve your second problem

add the the extra below 2 lines after your DirectCast(...)

DirectCast(Count,TableCommand).Where = "1 <> 1"
DirectCast(Count,TableCommand).Operation = "AND"



"hiraldesai" <hiraldesai@forum.codecharge> wrote in message
news:84768784370049@news.codecharge.com...
> Hi,
>
> http://support.yessoftware.com/kb_article.asp?article_id=65
>
> I have referred to this article but as it is mentioned at the bottom of
> that
> article, I have multiple search fields on the form.
>
> What I have done is put a hidden field on Search Form called "Searching"
> with a
> default value of "True". In the Before Build Select event of the grid I
> have put
> this code.
>
>
  
> Dim Request As HttpRequest = HttpContext.Current.Request  
> If Request.QueryString("Searching") Is Nothing Then  
>  
> DirectCast(Select_,TableCommand).Where = "1 <> 1"  '#Condition that always  
> yields false  
>  DirectCast(Select_,TableCommand).Operation = "AND"  
>  
> End If  
> 
>
> This code doesn't display any records on the grid. Which is exactly what I
> want
> to happen. But there are several problems.
>
> 1) "No Records" Row is not displayed
> 2) The grid's datasource still has all the records from the table
> resulting in
> a) Navigator still getting displayed with page numbers
> b) A label with "Retrieve Total Number of Records" action in
> before show event displays
> total number of records from the table instead of 0
>
> Is this fixable? If yes, does anyone know how?
>
> Regards,
> _________________
> -------
> Hiral
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

hiraldesai

Posts: 38
Posted: 01/06/2008, 7:52 PM

Thanks for that Tuong . It solved both my problems.

Regards,
_________________
-------
Hiral
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.