Calling a Server function from an HtmlInputHidden Control

Hey experts,

I want to have a functionality like the following:

<input id="hdnValue" type="hidden" runat="server" onpropertychange="fun1()">

If fun1 is a client javascript function, the syntax above would be true, but I want fun1 as a server function to be called according to the above case.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

In order to do that you will need to create a custom control. That overrides the PostBack event. As custom controls are fairly involved I cannot post an entire section of code here. If you would like an explanation then please let me know.
mte01Author Commented:
Yes please provide some explanation....


you could use the ServerChange event on server side
and on the client catch the onpropertychange - event with javascript and submit the form


this.hdnValue.ServerChange += new EventHandler(hdnValue_ServerChange);


function fun1() {


this will postback the page and if the value of hdnValue has changed since the last postback
hdnValue_ServerChange() will be called.

Hope that helps,


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hi mte01,

you can do that by using ServerChange event of the HtmlInputHidden control
when the page is submitted this event will fires if the value within the hidden filed has changed
this event will be rezied after the Page_Load event

mte01Author Commented:
It worked!!!!!....Amazing!!!!!!!!.........Thank you all...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.