CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> ASP

 Link control question

Print topic Send  topic

Author Message
JerryVT
Posted: 02/24/2004, 4:58 PM

Just sarting with CCS (had CC for 2 years and decided to uprade for CCS ASP)
Project is simple:
on the first page Editable grid (ASP) with customers info - mostly textboxes and 1 link field for notes.
I want to have a link "See Notes" if the Notes field is not empty and "No Notes" if it is.
There are several posts on how to do it but I was not able even to refer to his link control -
Live Page shows an error "variable is udefined:'Notes'
On Before Show event in Custom Code area I whote:
Notes.Value="See Notes"
What do I do wrong?

Info in properties on this control:
Name: notes
Conrol Source Type: DB Column
Control Source: Notes

Also, how do I catch ID parameter on NotesDetail page when See Notes link is clicked?

Thank you.
DonB
Posted: 02/25/2004, 6:49 PM

You've confused me somewhat, but let's see if I understand what you are
trying to do:

You need a Link on one page that take you to another page with there is some
data in a Notes field.
----------
The Link on the first page has to be within the Grid or Record control and
have the Customers table as it's Data Source.
Set the Link to reference the "has notes" field.
Add a Before Show event to the Link control.
In the Before Show event add a bit of code to inspect the value and alter
the link:

With Eventcaller
If .Value = "" Then
.Value = "No Notes"
End With

This will do what you asked (if I understood you correctly).

To make the link not be "clickable", I use this technique: Put a Label
control on the page instead of a Link and
call this function in the Before Show event:

Function LinkOrLabel(ctl, strURL, intPage, bEnable, strText)

If bEnable Then
ctl.Value = "<a class='ButtonLink' href='" & CCAddParam(strURL,
"TopicPage",intPage) & "'>" & strText & "</a>" ' Link
Else
ctl.Value = "<font class="LabelLikeLink>" & strText & "</font>" ' Label
End If

End Function

NOTES: ctl is the Label control, strURL is the link for when it's
clickable, intPage is just a query parameter I needed for my application,
bEnable is the toggle between Link and Label, strText is the text displayed
in either mode.

The Label must be set to "html" data - as you can see, I load it with a <a>
html tag for the Link and some <font> formatting to make it look like the
Link when it's really a button.

--
DonB

http://www.gotodon.com/ccbth


"JerryVT" <JerryVT@forum.codecharge> wrote in message
news:6403bf342e06dd@news.codecharge.com...
> Just sarting with CCS (had CC for 2 years and decided to uprade for CCS
ASP)
> Project is simple:
> on the first page Editable grid (ASP) with customers info - mostly
textboxes and 1 link field for notes.
> I want to have a link "See Notes" if the Notes field is not empty and "No
Notes" if it is.
> There are several posts on how to do it but I was not able even to refer
to his link control -
> Live Page shows an error "variable is udefined:'Notes'
> On Before Show event in Custom Code area I whote:
> Notes.Value="See Notes"
> What do I do wrong?
>
> Info in properties on this control:
> Name: notes
> Conrol Source Type: DB Column
> Control Source: Notes
>
> Also, how do I catch ID parameter on NotesDetail page when See Notes link
is clicked?
>
> Thank you.
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

JerryVT
Posted: 02/25/2004, 10:44 PM

DonB,
Thank you.
Your code worked.

I changed it to:

With Eventcaller
If .Value <>"" Then
.Value = "Notes"
Else
.Value = "____"
End With

This is needed if user will decide to add notes.
Editable grid control has 3 empty rows on the bottom for inputting new records.
For some reason two empty rows on the very bottom display link "Notes"
How can it be?
Is it a bug?

If I'm changing the code to:

With Eventcaller
If .Value <>"" Then
.Value = "Notes"
Else
.Value = ""
End With

these 2 rows don't have link "Notes" anymore so as other rows without ddata in the Notes field.

What else I can do?
DonB
Posted: 02/26/2004, 5:03 AM

You did say Ed Grid - I glossed over that. It's not a good idea to put
defaults or to load values via code (like you are doing) into controls that
are data-bound because the Ed Grid will treat them as data to be written to
the database. My guess is no matter how many blank rows you asked for,
you'd see the last one empty but the others filled. Let's change the Notes
control to be "unbound" (remove it's reference to the Notes column under
Properties). For clarity, also rename it to "NotesLink".

You can access the Notes column through the recordset that the datasource
contains:

Try this instead (assuming your grid control is named "EdGrid" - change that
to whatever yours is, and I'm calling the unbound field "NotesLink" just to
show the distinction between it and the database column named "Notes")

With EdGrid
If .DataSource.Recordset.Fields("Notes") <> "" Then
.NotesLink.Value = "Notes"
Else
.NotesLink.Value = "____"
End With

Since NotesLink is not "connected" with the database anymore, all the
"blank" rows should really be empty. The reason you need to reference the
recordset field because the Notes column is no longer directly available in
the Grid due to unbinding it.

I have assumed you don't want to see the actual notes in the grid, only in
the other control when the Link is clicked. If you DO want to see them,
just add a new control and bind it to the Notes column.

--
DonB

http://www.gotodon.com/ccbth


"JerryVT" <JerryVT@forum.codecharge> wrote in message
news:6403d95c35981a@news.codecharge.com...
> DonB,
> Thank you.
> Your code worked.
>
> I changed it to:
>
> With Eventcaller
> If .Value <>"" Then
> Value = "Notes"
> Else
> Value = "____"
> End With
>
> This is needed if user will decide to add notes.
> Editable grid control has 3 empty rows on the bottom for inputting new
records.
> For some reason two empty rows on the very bottom display link "Notes"
> How can it be?
> Is it a bug?
>
> If I'm changing the code to:
>
> With Eventcaller
> If .Value <>"" Then
> Value = "Notes"
> Else
> Value = ""
> End With
>
> these 2 rows don't have link "Notes" anymore so as other rows without
ddata in the Notes field.
>
> What else I can do?
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

JerryVT
Posted: 02/27/2004, 4:13 PM

Thanks Don!
It worked fine.

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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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