This topic is locked
[SOLVED]

 Hide, show fields depend on the other field value

5/10/2020 6:20:54 PM
ASPRunner.NET General questions
M
Mansour author

Hello,
i try to hide field from pages like (list, add, view, Edit) this will depend on the other field values, i have to field with name (exit, Enter)
i want to do it like this if exit = 0 the Enter will be hidden and if exit = 1 the enter will show in the pages
i try to use this example in before display event
if values("exit")="" or values("exit")=0 then

pageObject.hideField("enter")

end if
but does not working i have the following error
\\ testproject.csproj

Microsoft (R) Build Engine version 4.7.3062.0

[Microsoft .NET Framework, version 4.0.30319.42000]

Copyright (C) Microsoft Corporation. All rights reserved.
\\ testprojectEventsCS.csproj

Microsoft (R) Build Engine version 4.7.3062.0

[Microsoft .NET Framework, version 4.0.30319.42000]

Copyright (C) Microsoft Corporation. All rights reserved.
include\hideshow_TableEvents.cs(27,4): error CS1003: Syntax error, '(' expected [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(27,22): error CS1026: ) expected [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(27,22): error CS1023: Embedded statement cannot be a declaration or labeled statement [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(27,31): error CS1528: Expected ; or = (cannot specify constructor arguments in declaration) [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(27,39): error CS1002: ; expected [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(27,39): error CS1525: Invalid expression term '=' [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(27,40): error CS1002: ; expected [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(27,42): error CS1002: ; expected [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(28,12): error CS1002: ; expected [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(28,12): error CS1525: Invalid expression term '.' [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(28,13): error CS1002: ; expected [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(28,31): error CS1002: ; expected [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(29,5): error CS1002: ; expected [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(29,7): error CS1003: Syntax error, '(' expected [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

include\hideshow_TableEvents.cs(32,1): error CS1525: Invalid expression term 'return' [C:\Users\mm\Documents\ASPRunnerNETProjects\testproject\output\testprojectEventsCS.csproj]

Admin 5/15/2020

You are using VB.NET in C# event. Switch to VB.NET in that event.

FrankR_ENTA 5/19/2020



You are using VB.NET in C# event. Switch to VB.NET in that event.


And, consider just switching your app over to C#. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=91367&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

Pete K 5/20/2020



And, consider just switching your app over to C#. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=91389&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />


This is good advice. I had been coding in VB.Net and before that, VB Script, for many years when I started using ASPRunner.NET. Even though ASPR makes it possible to use either C# or VB, I quickly noticed that all the example code is in C# and most forum users seem to use it. It seemed like a good time to make the switch, and I have not regretted it. C# offers many advantages and is by far the most commonly used among .NET devs today. One of the great things is it makes it so much easier to move back and forth between server and client code as it is very similar to Javascript.

M
Mansour author 5/23/2020



This is good advice. I had been coding in VB.Net and before that, VB Script, for many years when I started using ASPRunner.NET. Even though ASPR makes it possible to use either C# or VB, I quickly noticed that all the example code is in C# and most forum users seem to use it. It seemed like a good time to make the switch, and I have not regretted it. C# offers many advantages and is by far the most commonly used among .NET devs today. One of the great things is it makes it so much easier to move back and forth between server and client code as it is very similar to Javascript.


Thank you All for your help it is worked now

but i want to ask if there is method Show to show fild like this pageObject.ShowField("Test")
when i used this pageObject.ShowField("Test") i found this Error means this is no function like this, is that mean there is no ShowField() method?
Thanks again for all

Admin 5/25/2020

Everything is case sensitive. showField (correct) and ShowField (incorrect) are two different function names.
https://xlinesoft.com/asprunnernet/docs/showfield.htm