
xphpx
|
| Posted: 06/30/2003, 4:22 AM |
|
How can I make the grid not to show data, unless Search button is pressed !! while both the detail_grid and the search_grid are in the same page.
Rgds
|
|
|
 |
rrodgers
|
| Posted: 06/30/2003, 5:14 AM |
|
In the where clause for the grid set one of your search parameters to an impossible value.
rob
|
|
|
 |
xphpx
|
| Posted: 06/30/2003, 5:47 AM |
|
Thanks I tried that, but my application is different. Is there a way to set the grid to visible, when clicking on the search button of another grid, this would help me allot.
Rgds
|
|
|
 |
rrodgers
|
| Posted: 06/30/2003, 6:12 AM |
|
Sure, Your grid component has a visible property. Set it to False on the before show event for the grid.
rob
|
|
|
 |
xphpx
|
| Posted: 06/30/2003, 6:43 AM |
|
I did that, so it does not show, but how do I make it show when the search button is clicked, I tried to set on click event of the search button, but it does not work.
Thanks
|
|
|
 |
Strider
|
| Posted: 06/30/2003, 1:05 PM |
|
All,
What I did was very simple. I don't want to show the grid before doing or using any kind of serach criteria, if there is some data available in the serach control then do the search and show the Grid. This is the code that I'm using to do that and it's working Fine.
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
'End Page_Load Event
'Page_Load Event BeforeIsPostBack @1-3CFCCABC
If Not IsPostBack Then
'HERE IS YOUR CODE
End If
'End Page_Load Event BeforeIsPostBack
'THIS IS THE CODE THAT I WROTE
if Acc_CustomerSearchs_Dealer_Client.text <> "" or Acc_CustomerSearchs_Dealer_Client_Name.text <> "" or Acc_CustomerSearchs_Dealer_Category.text <> "" or Acc_CustomerSearchs_Dealer_Category_Desc.text <> "" or Acc_CustomerSearchs_Sales_Rep.text <> "" or Acc_CustomerSearchs_Sales_Rep_Name.text <> "" or Acc_CustomerSearchs_City.text <> "" or Acc_CustomerSearchs_State.text <> "" or Acc_CustomerSearchs_Zipcode.text <> "" or Acc_CustomerSearchs_Phone_No.text <> "" then
Acc_CustomerRepeater.Visible = True
else
Acc_CustomerRepeater.Visible = False
end if
'Page_Load Event tail @1-E31F8E2A
End Sub
Keep in mind that Acc_CustomerRepeater will vary depending the name of your grid.
Thanks
Strider
|
|
|
 |
Strider
|
| Posted: 06/30/2003, 1:10 PM |
|
Sorry, I forgot to mention that the if statement what is doing is verifying that there is something written in the textboxes of the search control. If any of those textboxes are not null the show the grid.
if TB1.text <> "" or TB2.text <> "" then
mygrid.visible = true
else
mygrid.visible = false
end if
maybe this is a better explanation than the one that I posted before
Strider
|
|
|
 |
cornwell
|
| Posted: 06/30/2003, 3:01 PM |
|
In the before execute select try:
if (grdName.command.Where = "") then
grdName.visible = false
end if
Same event:
You can show an empty grid:
if (grdName.command.Where = "") then
grdRecords.command.Where = "1=2"
end if
|
|
|
 |
dblayout
|
| Posted: 07/05/2003, 10:05 PM |
|
This code was mentioned in an earlier post in this thread:
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
'End Page_Load Event
'Page_Load Event BeforeIsPostBack @1-3CFCCABC
I am using ASP. Exactly where do I find this Event so I will know where to place my code?
Thanks
Chris
|
|
|
 |
Strider
|
| Posted: 07/07/2003, 7:45 AM |
|
Hi Chris,
I'm using ASP.Net (VB) And the event where I put the piece of code can be found under the aspx.vb file of the page.
Thanks
Strider
|
|
|
 |
Strider
|
| Posted: 07/07/2003, 7:50 AM |
|
Hi Chris,
I'm using ASP.Net (VB) And the event where I put the piece of code can be found under the aspx.vb file of the page.
Thanks
Strider
|
|
|
 |
Sjg
|
| Posted: 07/12/2003, 2:26 AM |
|
Keep it Simple.....
***************************************
Option #1
You know the search grid will have parameters in the URL string for the search to work.
So, on the link to the search page, pass a parameter that will result in no records.
For example.
I have the following search grid page:
http://localhost/UserAccess_list.asp
This will bring back a list of all the users that have access. If I don't want the grid to show records to begin with, I use the following to link to the page:
http://localhost/UserAccess_list.asp?s_User_AccessStatus=noval
noval will never be an access status so no records will appear in the grid.
To accomplish this, set the properties for the link object.
On HRef Source Property, create a Link Parameter.
For the link Parameter:
Source Type: Expression
Parameter Source: "noval"
Parameter Name: s_User_AccessStatus
When the link is generated, it will be:
http://localhost/UserAccess_list.asp?s_User_AccessStatus=noval
Which will result in no records being shown.
***************************************
Option #2
Follow Option #1...
On HRef Source Property, create a Link Parameter.
For the link Parameter:
Source Type: Expression
Parameter Source: 0
Parameter Name: NoVal
When the link is generated, it will be:
http://localhost/UserAccess_list.asp?NoVal=0
Then .....
On the Grid Page (UserAccess_list.asp) add the value to the where clause
User_ID = {NoVal}
The User_ID Parameter is of Type URL.
Note: User_ID is a key field on the table, one that is not used in the search, In this case, I used User_ID which is the primary autogenerated key. It will never be zero so no records are shown.
On the Search, it is removed from the URL and the other search values are placed int the URL string.
***************************************
Amount of code written - ***** NONE ******.
Code to Maintain ***** NONE ******.
While this may not work for every possible scenerio or requirement, it will work as appropriate.
If Code Charge has been consistant in the models, this should work for PHP, .Net, etc... as well.
While a lot of good coding methods to do this are posted, If you want to change your project to another environment (ASP to PHP) all that code that was put in the exits will have to be rewritten.
Look for the features of code charge, learn them, and apply them when appropriate.
I would also question the requirement to show no records to begin with. If you can go ahead and show the first 10 (or some other number) of records, let it show them and show them every time the search grid is brought up. It will mean less coding or altering the default properties (like solution above). This in turn means less maintainence.
If it is required to not show any records until a search is done, use the method #1 or #2 described above and have the search grid always not show records until a search is done. It will require no coding and make the project more portable to a different language.
Either show the records initially or do not show the records intially. Pick one of the two methods and be consistent.
If you are not showing records initially use option #1 or Option #2, your choice.
Option two has the User_ID and NoVal over on the Grid too. This can be a reminder that you are starting with no records. However, two items are being mofified; the page link item to the grid page and the rid on the grid page.
Sjg....
|
|
|
 |
gm
|
| Posted: 07/14/2003, 2:17 PM |
|
I do this all the time by specifying using "null" as the default in the where criteria.
|
|
|
 |
|

|