Static Variable problem
Hi All,

I am facing an issue with static variable. I have used static variable in the application page to send the mail to the approver when ever requester create a request, After sending the mail(at the end) I am assigning sting.empty to this variable, But when I create an another immediate request the mail sending to the previous approver instead of current selected approver. I am getting confused how it is not working.

Please help me on this issue & let me know if you need any information.

Regards,
Kumar.
August 16th, 2015 8:37am

value of Static variable is shared in all the instances of classes declared. So you are working on a copy of a variable.

A static method, field, property, or event is callable on a class even when no instance of the class has been created.

If any instances of the class are created, they cannot be used to access the static member. Only one copy of static fields and events exists, and static methods and properties can only access static fields and static events.

I would recommend to use a function to pass the variable value instead of Static.

Or go ahead with Session.

Free Windows Admin Tool Kit Click here and download it now
August 16th, 2015 11:36am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics