WebControls.calendar and java script

J

Junior

I have a calendar object that is connected to a database. When the
user clicks on a date that has no entry in the database I issue a java
script popup message that asks the user if he wants to add an entry. I
need to get the true or false from the message box back to the server
but I dont know how. I've tried various solutions found on these
forums but I haven't gotten them to work. Any suggestions are welcome!
 
N

Natty Gur

Hi,

Did you rty to insert the result into hidden field ?


<form id="Form1" method="post" runat="server">
<input runat="server" type="hidden" id="rv" name="rv">

function ask_onclick() {
document.body.all["rv"].value = confirm("Yada Yada");
}

private void Page_Load(object sender, System.EventArgs e)
{
if (this.rv.Value == "true")
{

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 
J

Junior

I can't get it to work properly... What I want to do is to make a kind
of rendezvous between the java script pop-up and the server code:
if(!hasData){
RegisterClientDataScript("confirm","<script
language=Javascript>confirm('Do you want to add data?');</script>";
// if confirm returns true do something else just continue...
is this even possible? the code above happens in the
Calendar_SelectionChanged mehtod.
 
N

Natty Gur

Hi,

You can't return directly values from java client script into server
side script. the only way to transfer data between server and client
sides is through input HTML elements embedded in Form.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,266
Messages
2,571,075
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top