C# Change Event Code

C# Change Event Code
0

#1

I am using ASPRunner.NET Version 9.8 and I am trying to create C# code that will update a field based on a change of another field. I have very basic coding knowledge and the vendor has not been helpful. I will provide an example of what I am trying to do which will hopefully help.

Field 1 - Is a dropdown value for Priority of a project (Dropdown values are - High, Medium, Low)
Field 2 - Is a dropdown value for Category of a project (Dropdown values are New, Approved, Closed)

I want Field 2 to change to Approved if Field 1 is Low since it doesn’t need approval.

I also want this change to happen on the page before the record is saved.

How do I do that in ASP using C# code?


#2

Short answer: you can’t.

Longer answer: C# is used on the server when a page request and response are being processed, so the browser doesn’t know about any part of that. For the behavior that you want in the browser before a request is sent to the server, you would need to used JavaScript (or a library such as jQuery to make it easier, though you’re better off learning “vanilla” JavaScript first) to handle the change event.


#3

Thanks for responding!! I was actually able to get it to work using JavaScript like you suggested. I am going to post another question though that I believe is more C# than JavaScript.


#4

You are welcome. :slight_smile: