views:

24

answers:

1

I have a form with several text fields, a couple of drop down lists, and a custom asp.net control.

The requirement I have is that when the values of certain fields ( some are in the main form, some are inside the control ) the user will be alerted that the settings will not take place unless they also restart the processing and will have the option to reset it. If they exercise this option by pressing on the restart button, we execute an additional restart() method call on the server side on top of everything else.

In order to create this alert system I need to know when these required fields have changed. For the fields in the main form/page I store the original values in hidden fields when the page gets created (possible because the page is static). Then when the submit button is pressed I check the current values against the original values stored. If any of them differ I will alert the user.

For the fields in the custom control, I created a boolean property that indicates whether changes in the fields of interest took place. This control is highly dynamic contains a variable number of lists, some of them with over 100 items that can be selected or deselected. So this boolean property is able to identify if the changes I am looking for took place.

The problem is I need to get the value of this property when the user clicks on Submit, otherwise it will not contain the right value. But at the same time I want to avoid a postback. I do not want the whole page to reload. I want to get that value asynchronously somehow.

Since the whole page is stateless the question is how do I accomplish this? How do I accomplish the call to the property? And after I make the call and I get the result where do I store it so it's accessible from javascript code on the client side.

A: 

You can try putting a timer control in your ajax panel. Then on a set interval, you will evaluate the boolean property in your code behind.

Alternatively you can check the hidden field "changed" event using JavaScript or jQuery
http://api.jquery.com/change/

rockinthesixstring
I verified whether any ajax libraries were used in the control and there were no ajax namespaces. The control template has an asp:updatepanel control in which the updates happen. So what I want to do is that when the user hits the submit button on the page, it is then when i check the value of that property. Only then it will take the account the changes made by the user.
Rire1979
If you don't need to do a postback for anything, I would recommend using the jQuery method to evaluate the `.change()` event of the hidden field.
rockinthesixstring
I just read your edited comment. Lemme think about this a sec.
rockinthesixstring
I asked for some clarification in your original question. Maybe some code examples will help too.
rockinthesixstring
I attempted to clarify the question by adding a more detailed description. To sumarize the problem is in transporting data between server and client. How to call, how to transport.
Rire1979