Mac,
 
Thanks.  I'll give it a try.
 
Mark

"Kloberg Mac (LAM)" <[EMAIL PROTECTED]> wrote:
Try using RegisterStartupScript instead of RegisterClientScriptBlock.

RegisterClientScriptBlock inserts your script at the beginning of the page, right 
after the opening form element. The problem with that is that the rest of the page 
(including your control) hasn't been processed and the control you are trying to 
manipulate doesn't really exist yet.

RegisterStartupScript inserts the script at the end of the page, just before the 
closing form element. At this point the page is almost fully processed and all 
controls on the page are present/accessible by your script.

hth
--
Sincerely,
Mac Kloberg
LIEBHERR AMERICA INC.

-----Original Message-----
From: Peter Brunone [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 07, 2004 10:05 AM
To: [EMAIL PROTECTED]
Subject: re: [AspNetAnyQuestionIsOk] Trying to use Page.RegisterClientScriptBlock()


Hi Mark,

   Does "it's not working" mean that the script is outputting the wrong variable, or 
that you're getting a JS error, or that the script isn't being rendered at all, or 
something else...?

Cheers,

Peter

From: Mark E [EMAIL PROTECTED]

All,

I am trying to use Page.RegisterClientScriptBlock() to fire some javascript that wil 
set a value to a control so that I can access it again another javascript function. 
However, it's not working.

Here is the VB.NET code in my code-behind page that is fired on Page_Load:

Session("Current_Special_Amount_Total") = "125"
Dim scriptString As String = " "
scriptString += "document.Form1.HiddenPrizeAmountLeft.value=" & 
Session("Current_Special_Amount_Total") & ""

If (Not IsClientScriptBlockRegistered("clientScript")) Then
RegisterClientScriptBlock("clientScript", scriptString)
End If

And here is the control on my form:

I set the session value to a server control and it's fine. Also changed the 
If statement by adding an else to make sure it was evaluating to true. And
it seems to be.

Since this didn't work, I tried the old classic ASP trick:

var dblAmount = '';

But this yielded the following result in the variable dblAmount:

What I need to do is set a value to the control on the form so that I can
access it via Javascript and do some calculations. I originally coded it
server-side, but the client does not want to post back.

Any help is appreciated.

Thanks,
Mark

[Non-text portions of this message have been removed]


Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/


[Non-text portions of this message have been removed]





Yahoo! Groups Links












Yahoo! Groups SponsorADVERTISEMENT


---------------------------------
Yahoo! Groups Links

   To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
  
   To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
  
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to