?
Solved

Calling a Server function from an HtmlInputHidden Control

Posted on 2004-11-09
5
Medium Priority
?
266 Views
Last Modified: 2008-02-07
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.
0
Comment
Question by:mte01
5 Comments
 
LVL 2

Expert Comment

by:dnoxs
ID: 12541848
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.
0
 
LVL 3

Author Comment

by:mte01
ID: 12541855
Yes please provide some explanation....
0
 
LVL 9

Accepted Solution

by:
Thalox earned 1600 total points
ID: 12541881

Hi,

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

server

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


client

function fun1() {

    window.Form1.submit();
}

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,

Thalox
0
 
LVL 28

Assisted Solution

by:mmarinov
mmarinov earned 400 total points
ID: 12541885
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

Regards!
B..M
mmarinov
0
 
LVL 3

Author Comment

by:mte01
ID: 12541910
It worked!!!!!....Amazing!!!!!!!!.........Thank you all...
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question