Showing posts with label call. Show all posts
Showing posts with label call. Show all posts

Monday, March 26, 2012

passing values to showmodal dialog

I have parent.aspx web page from which I call a modal dialog (child.aspx via
showmodaldialog). I'd like to populate two text boxes, <asp:TextBox id=txt
_HN> on the child form with data from the caller.
for parent.aspx....
<script> block
function UpdH(title,horse)
{
var iParms=new Object();
iParms.Name=horse;
...}
for child.aspx...
<script> block
I've tried "document.getElementById('txt_HN').value=iParms.Horse;" within ch
ild.aspx form - but get error "document.getElementbyId(...) is null or not a
n object". How do I do this?David,
Try dialogArguments.window.document.getElementById....
using the following to open your window in java script:
var TestWindow = new Object();
TestWindow.caller = window.showModalDialog(URLstr, window, sFeatures);
replacing the parameters there with whatever you use as appropriate.
Raymond Lewallen
"DavidS" <DavidS@.discussions.microsoft.com> wrote in message
news:564EE97A-8C7D-4E35-B034-99BB78A95904@.microsoft.com...
> I have parent.aspx web page from which I call a modal dialog (child.aspx
via showmodaldialog). I'd like to populate two text boxes, <asp:TextBox
id=txt_HN> on the child form with data from the caller.
> for parent.aspx....
> <script> block
> function UpdH(title,horse)
> {
> var iParms=new Object();
> iParms.Name=horse;
> ...}
> for child.aspx...
> <script> block
> I've tried "document.getElementById('txt_HN').value=iParms.Horse;" within
child.aspx form - but get error "document.getElementbyId(...) is null or not
an object". How do I do this?

passing values to showmodal dialog

I have parent.aspx web page from which I call a modal dialog (child.aspx via showmodaldialog). I'd like to populate two text boxes, <asp:TextBox id=txt_HN> on the child form with data from the caller.
for parent.aspx....
<script> block
function UpdH(title,horse)
{
var iParms=new Object();
iParms.Name=horse;
...}
for child.aspx...
<script> block
I've tried "document.getElementById('txt_HN').value=iParms.Hor se;" within child.aspx form - but get error "document.getElementbyId(...) is null or not an object". How do I do this?David,

Try dialogArguments.window.document.getElementById... .

using the following to open your window in javascript:

var TestWindow = new Object();
TestWindow.caller = window.showModalDialog(URLstr, window, sFeatures);

replacing the parameters there with whatever you use as appropriate.

Raymond Lewallen

"DavidS" <DavidS@.discussions.microsoft.com> wrote in message
news:564EE97A-8C7D-4E35-B034-99BB78A95904@.microsoft.com...
> I have parent.aspx web page from which I call a modal dialog (child.aspx
via showmodaldialog). I'd like to populate two text boxes, <asp:TextBox
id=txt_HN> on the child form with data from the caller.
> for parent.aspx....
> <script> block
> function UpdH(title,horse)
> {
> var iParms=new Object();
> iParms.Name=horse;
> ...}
> for child.aspx...
> <script> block
> I've tried "document.getElementById('txt_HN').value=iParms.Hor se;" within
child.aspx form - but get error "document.getElementbyId(...) is null or not
an object". How do I do this?

passing variable from child to parent - possible ?

I have a main form, and i have another form i need to call on a button
press,
then id like the result of the child form to pass data back to the parent -
without losing any data previously entered
on the parent - is this possible ? ( my main parent window is starting to
get quite cluttered)

cheers

markmark wrote:
> I have a main form, and i have another form i need to call on a button
> press,
> then id like the result of the child form to pass data back to the parent -
> without losing any data previously entered
> on the parent - is this possible ? ( my main parent window is starting to
> get quite cluttered)
> cheers
> mark

The problem is in not losing the "parent" data... Are these windows open
in the same browser window or are you opening the "child" in a new
window? If its the same just save their existing data, in a
db/viewstate/session/etc, and then when you reload it retrieve it.
If not you will have to force the "parent" to postback to get it to
refresh, and with the viewstate enabled you should get the pre-entered
data to remain

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Mark,

The standard way is to call javascript method showModalDialog for the child
form. The child form can pass back data in javascript window.returnValue
property which the parent form will get as a return value of the
showModalDialog call.

Eliyahu

"mark" <mark@.remove.com> wrote in message
news:1122386021.4716.0@.spandrell.news.uk.clara.net ...
> I have a main form, and i have another form i need to call on a button
> press,
> then id like the result of the child form to pass data back to the
parent -
> without losing any data previously entered
> on the parent - is this possible ? ( my main parent window is starting to
> get quite cluttered)
> cheers
> mark
Mark,

The standard way is to call javascript method showModalDialog for the child
form. The child form can pass back data in javascript window.returnValue
property which the parent form will get as a return value of the
showModalDialog call.

Eliyahu

"mark" <mark@.remove.com> wrote in message
news:1122386021.4716.0@.spandrell.news.uk.clara.net ...
> I have a main form, and i have another form i need to call on a button
> press,
> then id like the result of the child form to pass data back to the
parent -
> without losing any data previously entered
> on the parent - is this possible ? ( my main parent window is starting to
> get quite cluttered)
> cheers
> mark
> The problem is in not losing the "parent" data... Are these windows open
> in the same browser window or are you opening the "child" in a new
> window? If its the same just save their existing data, in a
> db/viewstate/session/etc, and then when you reload it retrieve it.
> If not you will have to force the "parent" to postback to get it to
> refresh, and with the viewstate enabled you should get the pre-entered
> data to remain
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com

looks like ill be forced to save on opening the child, either that i
redesign the whole form to be more modular
problem is - i have to pass an ID to the child that doesnt exist until the
parent is saved - so things are getting more complicated
than in reality they should be

cheers

mark
"Eliyahu Goldin" <removemeegoldin@.monarchmed.com> wrote in message
news:OvYQHtekFHA.1464@.TK2MSFTNGP14.phx.gbl...
> Mark,
> The standard way is to call javascript method showModalDialog for the
child
> form. The child form can pass back data in javascript window.returnValue
> property which the parent form will get as a return value of the
> showModalDialog call.
> Eliyahu
got any examples ?

thanks

mark
> The problem is in not losing the "parent" data... Are these windows open
> in the same browser window or are you opening the "child" in a new
> window? If its the same just save their existing data, in a
> db/viewstate/session/etc, and then when you reload it retrieve it.
> If not you will have to force the "parent" to postback to get it to
> refresh, and with the viewstate enabled you should get the pre-entered
> data to remain
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com

looks like ill be forced to save on opening the child, either that i
redesign the whole form to be more modular
problem is - i have to pass an ID to the child that doesnt exist until the
parent is saved - so things are getting more complicated
than in reality they should be

cheers

mark
"Eliyahu Goldin" <removemeegoldin@.monarchmed.com> wrote in message
news:OvYQHtekFHA.1464@.TK2MSFTNGP14.phx.gbl...
> Mark,
> The standard way is to call javascript method showModalDialog for the
child
> form. The child form can pass back data in javascript window.returnValue
> property which the parent form will get as a return value of the
> showModalDialog call.
> Eliyahu
got any examples ?

thanks

mark

passing variable from child to parent - possible ?

I have a main form, and i have another form i need to call on a button
press,
then id like the result of the child form to pass data back to the parent -
without losing any data previously entered
on the parent - is this possible ? ( my main parent window is starting to
get quite cluttered)

cheers

markmark wrote:
> I have a main form, and i have another form i need to call on a button
> press,
> then id like the result of the child form to pass data back to the parent -
> without losing any data previously entered
> on the parent - is this possible ? ( my main parent window is starting to
> get quite cluttered)
> cheers
> mark

The problem is in not losing the "parent" data... Are these windows open
in the same browser window or are you opening the "child" in a new
window? If its the same just save their existing data, in a
db/viewstate/session/etc, and then when you reload it retrieve it.
If not you will have to force the "parent" to postback to get it to
refresh, and with the viewstate enabled you should get the pre-entered
data to remain

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

passing variable from child to parent - possible ?

I have a main form, and i have another form i need to call on a button
press,
then id like the result of the child form to pass data back to the parent -
without losing any data previously entered
on the parent - is this possible ? ( my main parent window is starting to
get quite cluttered)
cheers
markmark wrote:
> I have a main form, and i have another form i need to call on a button
> press,
> then id like the result of the child form to pass data back to the parent
-
> without losing any data previously entered
> on the parent - is this possible ? ( my main parent window is starting to
> get quite cluttered)
> cheers
> mark
>
The problem is in not losing the "parent" data... Are these windows open
in the same browser window or are you opening the "child" in a new
window? If its the same just save their existing data, in a
db/viewstate/session/etc, and then when you reload it retrieve it.
If not you will have to force the "parent" to postback to get it to
refresh, and with the viewstate enabled you should get the pre-entered
data to remain
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Mark,
The standard way is to call javascript method showModalDialog for the child
form. The child form can pass back data in javascript window.returnValue
property which the parent form will get as a return value of the
showModalDialog call.
Eliyahu
"mark" <mark@.remove.com> wrote in message
news:1122386021.4716.0@.spandrell.news.uk.clara.net...
> I have a main form, and i have another form i need to call on a button
> press,
> then id like the result of the child form to pass data back to the
parent -
> without losing any data previously entered
> on the parent - is this possible ? ( my main parent window is starting to
> get quite cluttered)
> cheers
> mark
>
> >
> The problem is in not losing the "parent" data... Are these windows open
> in the same browser window or are you opening the "child" in a new
> window? If its the same just save their existing data, in a
> db/viewstate/session/etc, and then when you reload it retrieve it.
> If not you will have to force the "parent" to postback to get it to
> refresh, and with the viewstate enabled you should get the pre-entered
> data to remain
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
looks like ill be forced to save on opening the child, either that i
redesign the whole form to be more modular
problem is - i have to pass an ID to the child that doesnt exist until the
parent is saved - so things are getting more complicated
than in reality they should be
cheers
mark
"Eliyahu Goldin" <removemeegoldin@.monarchmed.com> wrote in message
news:OvYQHtekFHA.1464@.TK2MSFTNGP14.phx.gbl...
> Mark,
> The standard way is to call javascript method showModalDialog for the
child
> form. The child form can pass back data in javascript window.returnValue
> property which the parent form will get as a return value of the
> showModalDialog call.
> Eliyahu
>
got any examples ?
thanks
mark

Wednesday, March 21, 2012

Passing Variables to Nested User Controls

Question: How do I pass variables to a nested user control ?

Description: I want to call a user control that calls another user control for encapsulation as shown below. I have a very hard time making the child control see the grandparent variable passed to it In the example shown below, Default.aspx calls the uc:Control, which in turn calls the uc:SubControl. I can get uc:Control to see Variable1="Value1", but I cannot get the uc:SubControl to see that value. What am I doing wrong. I use VB for the code behind and I have a public variable called Variable1 in both user controls.

Default.aspx:
<uc:Control id="Parent" Variable1="Value1" runat="server"></uc:ParentControl
ParentControl.ascx:
<uc:SubControl id="Child" Variable1="<%=Value1%>" runat="server"></uc:ChildControlYou can't use the <%= %> syntax to set an attribute of a server control.
Use <%# %> instead, and DataBind().

Passsing a connection object

I have a class that creates a connection to the database. When I call this object from my aspx code behind to get a connection to the database I get an error.
Object reference not set to an instance of an object.
How can I pass a connction object back from a class to a aspx code behind.pls post some code so that we might see the problem ...
if an object is not marked as Shared, you need to instantiate it before calling any of its methods.

based on your error you may have something like this:

dim oConn as MyConnectionObject
dim something as string
something = oConn.GetConnString

this will fail

you need

dim oConn asNew MyConnectionObject
dim something as string
something = oConn.GetConnString