Discussion:
Passing values from C# in iframe to parent crmForm
(too old to reply)
DubSport
2006-10-25 22:23:54 UTC
Permalink
I have an iframe in one of my forms, and in this iframe is some C# code
which queries the CRM database and pulls back some values. Now that
these values are visible in the iframe, I want to be able to pass some
of them into some of the CRM fields in the parent window.

Now I know It is simple enough to pass data from any iframe to its
parent window using javascript, but I cannot get the javascript code in
the iframe to even see the C# values (even though they are both in the
same iframe), so I can't seem to pass values to the parent window via
javascript...

Is there a way to do this?
Gunady
2006-10-26 04:12:17 UTC
Permalink
Have you tried to use Page.ClientScript.RegisterClientScriptBlock() or
RegisterStartupScript() method in ASP.NET?
Basically you can use that method to put some Javascript code so that
the code is rendered along with the HTML code. But you must construct
the javascript string using any string or StringBuilder.

E.g. Page.RegisterStartupScript("tes", "<script
language='javascript'>alert('tes');</script>");

So if you know what the Javascript to call to parent frame, just
construct it and pass using those methods.

Gunady
Post by DubSport
I have an iframe in one of my forms, and in this iframe is some C# code
which queries the CRM database and pulls back some values. Now that
these values are visible in the iframe, I want to be able to pass some
of them into some of the CRM fields in the parent window.
Now I know It is simple enough to pass data from any iframe to its
parent window using javascript, but I cannot get the javascript code in
the iframe to even see the C# values (even though they are both in the
same iframe), so I can't seem to pass values to the parent window via
javascript...
Is there a way to do this?
DubSport
2006-10-26 20:50:28 UTC
Permalink
Gunady, I am not sure that JavaScript will be able to see my values
from the C# SQL query... I may have to look into using the CRMService???
DubSport
2006-10-26 21:22:50 UTC
Permalink
Whenever the C# code sees my </script> tag in my javascript snippet, it
improperly recognizes that tag as the end of the C# code, thus ending
my program prematurely. Is there any way around that?
Post by DubSport
Gunady, I am not sure that JavaScript will be able to see my values
from the C# SQL query... I may have to look into using the CRMService???
Loading...