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 -> ASP

 editable Grid and default value for text box

Print topic Send  topic

Author Message
lirving

Posts: 26
Posted: 11/01/2013, 7:20 AM

I have an editable grid with two hidden fields Added_by and Date_added

I use the method from the help and set the default value in the properties box to ccgetuserID and currentdatetime respectively. It does not update the database.

If I change the field to visible and add the values manually it does update the database.


Is this expected behaviour for the editable grid and if it is what should I do to make it work.


The help is very confusing There is an animated gif but it stops just before they actually set the default value. This seems to be a shortcoming of the help it seems to be a little light on examples.





I found three different helparticles that say
Add a Hidden "Assigned By" Field to Auto-Update New Tasks

I tried CCGetSession("UserID") - that gives and internal server error
and Session.UserID - that gives and internal server error
and ccgetuserID - No server error but no update
They are all different and none seem to work for me


Finally I have a record called articles with a grid called attachements under it on the page.
I want to hide it if I am adding a new record.

so I want to say something like the code below

' -------------------------
If KBarticles.KBArticles_ID.value < "1" Then
attachments.Visible = false
End if

' -------------------------
'End Custom Code

Or like
if isnull kbarticles_ID then attachments.Visible = false

Any help appreciated
_________________
LW Irving

lirving@coffs.com.au
View profile  Send private message
eratech


Posts: 513
Posted: 11/03/2013, 5:21 PM

Hi - I ran into a similar situation, and I think it's because the 'Default Value' is only there for Inserts not Updates.

I usually put the Default value (CCGetUserID or similar) to cover Inserts, and into the Record's 'Before Update' (or Editable Grid's 'Before Execute Update') a 'Retrieve Value for Control' and make it the 'Expression' and CCGetUserID etc. That way it forces the change before the update.

When you display the textbox and type it in, you are doing a normal Update, so it's not really testing the function.

As for hiding the grid - I usually hide things by checking for the ID of the record - that is, if the Record ID is passed in the querystring as parameter "rid" then I put the 'Hide-Show Component' action on the Grid, and have it Hide/Compare as Text/Equals
and Parameter1 "rid"/URL and Parameter2 ""/Expression.

The KBArticles.value will actually not be anything if it's a new record, so that's why the above doesn't work.

Alternatively you could also put a custom code check in the Before Show of the attachments Grid to check the KBArticles.IsEdit (or EditMode? can't quite rememeber) and change attachments.visible accordingly.

Something to check too when doing hiding of controls - make sure that the 'Visible' of the control is set to No (and you turn it on) or Dynamic. I've had code that's been running, but it's been over-ridden by the control settings, so it would always be Visible (or Not)

cheers

Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
lirving

Posts: 26
Posted: 11/04/2013, 10:24 PM

That is all I really want to do
I want to store a default value for empty user_assinged_by text field on insert

I go to the text field properties and paste CCGetSession("UserID" ) into the default value property publish and get an internal server error.

The help says this

Text "Bob",
GetString()
integer 5,
GetInteger(Param)
Date "10/01/2002",
Now()
Boolean True


There is no mention of how to use a variable from a form or a session variable

should it be GetInteger(CCGetSession("UserID" )) ?
_________________
LW Irving

lirving@coffs.com.au
View profile  Send private message
lirving

Posts: 26
Posted: 11/04/2013, 11:38 PM

I found the answer
The default value needs to be Session("UserID" ) not CCGetSession("UserID" )) as the help suggests.

_________________
LW Irving

lirving@coffs.com.au
View profile  Send private message
eratech


Posts: 513
Posted: 11/05/2013, 6:47 PM

Glad you sorted it.

Just checking for my own benefit - as you using ASP.NET or 'classic' ASP for your project?

Ta

Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
lirving

Posts: 26
Posted: 11/05/2013, 9:30 PM

Just Classic .asp

I fear I'll have to invest some time in either php or .NET soon.

Regards
_________________
LW Irving

lirving@coffs.com.au
View profile  Send private message
eratech


Posts: 513
Posted: 11/06/2013, 12:02 AM

Fortunately Codecharge is the only tool that I've found that allows you to switch so easily.

ASP.NET is the most 'unusual' change from the way ASP/JSP/perl/PHP/CF work, but it works mostly the same.

Main tip for .NET is to still work in the Design/HTML and use the Events, and stay away from changing the .aspx page, as it will stop updating and you will regret it (spent many hours searching why updates weren't working and it was a few mis-types in the ASPX instead of code behind.

Cheers

E
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
anthonyzz

Posts: 19
Posted: 03/05/2014, 7:17 PM

I am recently also dealing with some C# grid:

http://www.kettic.com/winforms_ui/gridview.shtml

And I found some information about the the textbox in grid:

http://www.kettic.com/winforms_ui/csharp_guide/gridview...ox_column.shtml

hope this can offer you some kind of hlep
_________________
no more
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.

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.