473,398 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

RegisterClientScriptBlock - URGENT please



Hi,

I have a form with some dynamic controls. I then open a popup calendar and set the selected date back to the "parent" form using this statement:

string script = "<script>window.opener.document.getElementById ('" + control.Value + "').innerText = '";
script += myCalendar.SelectedDate.ToString("dd/MM/yyyy") + "'";
script += ";self.close()" ;
script += "</script>";
RegisterClientScriptBlock("test", script);

The problem I am having is that when later accessing the control, the value of that control is still empty. But on the page, the new value is shown.

Does anyone have any idea on what could be wrong?

Thanks
Mike

--
Michael
Nov 18 '05 #1
5 1217
PJ
It would be helpful if you told us what type "control" is.

"Mike" <no****@nospam.com> wrote in message news:%2***************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a form with some dynamic controls. I then open a popup calendar and set the selected date back to the "parent" form using this statement:

string script = "<script>window.opener.document.getElementById ('" + control.Value + "').innerText = '";
script += myCalendar.SelectedDate.ToString("dd/MM/yyyy") + "'";
script += ";self.close()" ;
script += "</script>";
RegisterClientScriptBlock("test", script);

The problem I am having is that when later accessing the control, the value of that control is still empty. But on the page, the new value is shown.

Does anyone have any idea on what could be wrong?

Thanks
Mike

--
Michael
Nov 18 '05 #2

It is a label.
"PJ" <pj***@hotmail.com> wrote in message news:#f**************@tk2msftngp13.phx.gbl...
It would be helpful if you told us what type "control" is.

"Mike" <no****@nospam.com> wrote in message news:%2***************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a form with some dynamic controls. I then open a popup calendar and set the selected date back to the "parent" form using this statement:

string script = "<script>window.opener.document.getElementById ('" + control.Value + "').innerText = '";
script += myCalendar.SelectedDate.ToString("dd/MM/yyyy") + "'";
script += ";self.close()" ;
script += "</script>";
RegisterClientScriptBlock("test", script);

The problem I am having is that when later accessing the control, the value of that control is still empty. But on the page, the new value is shown.

Does anyone have any idea on what could be wrong?

Thanks
Mike

--
Michael
Nov 18 '05 #3
Typically, that is caused by assigning the value in your page init or page
load without regard to IsPostBack. So you're re-initializing the label
before you read the value on postback. Try stepping through your code and
see if you find that happening.

Dale

"Mike" <no****@nospam.com> wrote in message
news:#R**************@TK2MSFTNGP11.phx.gbl...

It is a label.
"PJ" <pj***@hotmail.com> wrote in message
news:#f**************@tk2msftngp13.phx.gbl...
It would be helpful if you told us what type "control" is.

"Mike" <no****@nospam.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a form with some dynamic controls. I then open a popup calendar
and set the selected date back to the "parent" form using this statement:

string script = "<script>window.opener.document.getElementById ('" +
control.Value + "').innerText = '";
script += myCalendar.SelectedDate.ToString("dd/MM/yyyy") + "'";
script += ";self.close()" ;
script += "</script>";
RegisterClientScriptBlock("test", script);

The problem I am having is that when later accessing the control, the
value of that control is still empty. But on the page, the new value is
shown.

Does anyone have any idea on what could be wrong?

Thanks
Mike

--
Michael
Nov 18 '05 #4

I debugged, but the Page_Load event is not fired.

Does the script below change the element of the document, but not the one of the form? Or are these two elements the same? Sorry, I am new to all these web stuff...

Mike

"Dale" <da************@msndotcomNot.Net> wrote in message news:uy**************@TK2MSFTNGP10.phx.gbl...
Typically, that is caused by assigning the value in your page init or page
load without regard to IsPostBack. So you're re-initializing the label
before you read the value on postback. Try stepping through your code and
see if you find that happening.

Dale

"Mike" <no****@nospam.com> wrote in message
news:#R**************@TK2MSFTNGP11.phx.gbl...

It is a label.
"PJ" <pj***@hotmail.com> wrote in message
news:#f**************@tk2msftngp13.phx.gbl...
It would be helpful if you told us what type "control" is.

"Mike" <no****@nospam.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a form with some dynamic controls. I then open a popup calendar
and set the selected date back to the "parent" form using this statement:

string script = "<script>window.opener.document.getElementById ('" +
control.Value + "').innerText = '";
script += myCalendar.SelectedDate.ToString("dd/MM/yyyy") + "'";
script += ";self.close()" ;
script += "</script>";
RegisterClientScriptBlock("test", script);

The problem I am having is that when later accessing the control, the
value of that control is still empty. But on the page, the new value is
shown.

Does anyone have any idea on what could be wrong?

Thanks
Mike

--
Michael
Nov 18 '05 #5
Check out this article,
http://www.microsoft.com/india/msdn/...ndarinASP.aspx

--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com

"Mike" <no****@nospam.com> wrote in message news:Ob**************@tk2msftngp13.phx.gbl...

I debugged, but the Page_Load event is not fired.

Does the script below change the element of the document, but not the one of the form? Or are these two elements the same? Sorry, I am new to all these web stuff...

Mike

"Dale" <da************@msndotcomNot.Net> wrote in message news:uy**************@TK2MSFTNGP10.phx.gbl...
Typically, that is caused by assigning the value in your page init or page
load without regard to IsPostBack. So you're re-initializing the label
before you read the value on postback. Try stepping through your code and
see if you find that happening.

Dale

"Mike" <no****@nospam.com> wrote in message
news:#R**************@TK2MSFTNGP11.phx.gbl...

It is a label.
"PJ" <pj***@hotmail.com> wrote in message
news:#f**************@tk2msftngp13.phx.gbl...
It would be helpful if you told us what type "control" is.

"Mike" <no****@nospam.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a form with some dynamic controls. I then open a popup calendar
and set the selected date back to the "parent" form using this statement:

string script = "<script>window.opener.document.getElementById ('" +
control.Value + "').innerText = '";
script += myCalendar.SelectedDate.ToString("dd/MM/yyyy") + "'";
script += ";self.close()" ;
script += "</script>";
RegisterClientScriptBlock("test", script);

The problem I am having is that when later accessing the control, the
value of that control is still empty. But on the page, the new value is
shown.

Does anyone have any idea on what could be wrong?

Thanks
Mike

--
Michael
Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Scott | last post by:
I have a custom base page class for my app. In the OnInit, I add a ref to a CSS using RegisterClientScriptBlock. When the page is loaded, the styles that apply to BODY are not being applied....
2
by: Earl Teigrob | last post by:
I have a Web Custom Control that builds javascript to write to the page. The DatePickerJs() function builds over 500 lines of javacript code. Even thought my Custom Web Control does not write it to...
2
by: Steven K | last post by:
Hello, I am trying to create a JavaScript function and am getting the following error: 'jsFormValidation' is not a member of 'ASP.ciJava_aspx'. Sub Page_Load(Sender As Object, E As EventArgs)...
2
by: sam | last post by:
I am trying to emit script to the response stream within the Application_Error handler in global.asax. I want to emit using Page.RegisterClientScriptBlock. This doesn't work, and I have been...
1
by: Simon Harris | last post by:
Hi All, I'm trying to write a composite web control which will render a rich text editor. I am having problems with RegisterClientScriptBlock - The script simply doesnt get written. There are...
2
by: kewl | last post by:
Hi All, We have an ASP.NET 2.0 (C#) intranet application that needs to spawn multiple browsers using RegisterClientScriptBlock. Here's what we got so far: // Go thru each datarow in the...
9
by: Nathan Sokalski | last post by:
I have used the RegisterClientScriptBlock method in external functions of mine (ones that are saved in a separate *.vb file), where I use them as follows: Public Shared Sub MyFunction(ByVal...
2
by: Alex Maghen | last post by:
Hi. Two questions about "RegisterClientScriptBlock": 1. I want to be able to insert a script block without having to worry about whether the "key" is unique. As it turns out, if a script block...
3
by: | last post by:
Hello, I try to open a new Window in code behind with : ClientScript.RegisterClientScriptBlock(this.GetType(), "MyOpenScript", "window.open('toto.doc');", true); My problem is that the new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.