CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 How to hide grid forms in a page, if the rcordset has no record

Print topic Send  topic

Author Message
Ahaa
Posted: 10/24/2004, 10:29 PM

I have multiple grid forms on a page and I want to hide them when the page is loaded and before a search is done.

If no records were found, don't show the gird. I have tried few codes like the one below but it doesn't work.

Any idea of what works. Please help.

$<form>before_show_event:

global $employees1;
$p=CCGetParam("emp_id",0);
if ($p > 0)
{
$employees1->Visible = True;
}
else
{
$employees1->Visible = False;
}

Thanks,
Ahaa
DonB
Posted: 10/25/2004, 6:30 AM

Do that in the PAGE's Before Show event and it will prevent the data from
being fetched (the grid's beforeshow event is too late, it's already been
fetched in the grid's class initialization ). I don't know how to
interprete " $<form>before_show_event:, because your code should be in a
function that says "function Show()". Are you actually declaring the event
handler through the properties panel of the IDE, or just trying to write the
code yourself?

--
DonB

http://www.gotodon.com/ccbth


"Ahaa" <Ahaa@forum.codecharge> wrote in message
news:5417c8f54befc5@news.codecharge.com...
> I have multiple grid forms on a page and I want to hide them when the page
is
> loaded and before a search is done.
>
> If no records were found, don't show the gird. I have tried few codes like
the
> one below but it doesn't work.
>
> Any idea of what works. Please help.
>
> $<form>before_show_event:
>
> global $employees1;
> $p=CCGetParam("emp_id",0);
> if ($p > 0)
> {
> $employees1->Visible = True;
> }
> else
> {
> $employees1->Visible = False;
> }
>
> Thanks,
> Ahaa
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Ahaa
Posted: 10/25/2004, 1:55 PM

Hi Donb,

Thanks for your response. There's no custom function involved, its all inthe IDE. I have tried the code in the page before_show_event and the grid form got hidden when there's no record. But after a search is done and there's data in the recordset, the grid did not show again.

Can you please show me how I can show the grid when there's record for the grid after a search is done.

Thank,
Ahaa



Quote DonB:
Do that in the PAGE's Before Show event and it will prevent the data from
being fetched (the grid's beforeshow event is too late, it's already been
fetched in the grid's class initialization ). I don't know how to
interprete " $<form>before_show_event:, because your code should be in a
function that says "function Show()". Are you actually declaring the event
handler through the properties panel of the IDE, or just trying to write the
code yourself?

--
DonB

http://www.gotodon.com/ccbth


"Ahaa" <Ahaa@forum.codecharge> wrote in message
news:5417c8f54befc5@news.codecharge.com...
> I have multiple grid forms on a page and I want to hide them when the page
is
> loaded and before a search is done.
>
> If no records were found, don't show the gird. I have tried few codes like
the
> one below but it doesn't work.
>
> Any idea of what works. Please help.
>
> $<form>before_show_event:
>
> global $employees1;
> $p=CCGetParam("emp_id",0);
> if ($p > 0)
> {
> $employees1->Visible = True;
> }
> else
> {
> $employees1->Visible = False;
> }
>
> Thanks,
> Ahaa
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


DonB
Posted: 10/25/2004, 4:20 PM

if (CCGetParam("parameter1","?") != "?") {
$mygrid->Visible = false
}
else {
$mygrid->Visible = true;
}

Note: You will probably have several parameters that should be checked, like
"parameter1" is checked in my example. Just "or" them into the "if"
expression. I use the "?" so that the test distinguishes between the case
where the parameter is declared but empty from the case where the parameter
is not declared at all (in the URL string). This may or may not matter to
you.

Put this in the page Before Show event and it will do what you want.

--
DonB

http://www.gotodon.com/ccbth


"Ahaa" <Ahaa@forum.codecharge> wrote in message
news:5417d68404286b@news.codecharge.com...
> Hi Donb,
>
> Thanks for your response. There's no custom function involved, its all
inthe
> IDE. I have tried the code in the page before_show_event and the grid form
got
> hidden when there's no record. But after a search is done and there's data
in
> the recordset, the grid did not show again.
>
> Can you please show me how I can show the grid when there's record for
the
> grid after a search is done.
>
> Thank,
> Ahaa
>
>
>
>
Quote DonB:
> Do that in the PAGE's Before Show event and it will prevent the data from
> being fetched (the grid's beforeshow event is too late, it's already been
> fetched in the grid's class initialization ). I don't know how to
> interprete " $<form>before_show_event:, because your code should be in a
> function that says "function Show()". Are you actually declaring the
event
> handler through the properties panel of the IDE, or just trying to write
the
> code yourself?
>
> --
> DonB
>
> http://www.gotodon.com/ccbth
>
>
> "Ahaa" <Ahaa@forum.codecharge> wrote in message
>news:5417c8f54befc5@news.codecharge.com...
> > I have multiple grid forms on a page and I want to hide them when the
page
> is
> > loaded and before a search is done.
> >
> > If no records were found, don't show the gird. I have tried few codes
like
> the
> > one below but it doesn't work.
> >
> > Any idea of what works. Please help.
> >
> > $<form>before_show_event:
> >
> > global $employees1;
> > $p=CCGetParam("emp_id",0);
> > if ($p > 0)
> > {
> > $employees1->Visible = True;
> > }
> > else
> > {
> > $employees1->Visible = False;
> > }
> >
> > Thanks,
> > Ahaa
> > ---------------------------------------
> > Sent from YesSoftware forum
> > http://forums.codecharge.com/
> >
>
>
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Ahaa
Posted: 10/28/2004, 3:15 AM

Thanks DonB. All sorted.
greg
Posted: 10/28/2004, 3:48 AM

Ahaa wrote:

> If no records were found, don't show the gird. I have tried few codes like the
> one below but it doesn't work.


> $p=CCGetParam("emp_id",0);

Your code relies on a URL variable (like
http://www.toto.com/mypage.php?emp_id=0), not on the actual content of
the form. Is it on purpose?

Greg

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.

MS Access to Web

Convert MS Access to Web.
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.