Search:
Namespaces
Discussions
.NET v1.1
Feedback
Populating parent form question...
Messages
Related Types
This message was discovered on
microsoft.public.dotnet.languages.jscript
.
Post a new message to this list...
Rob Meade
Hi all,
I have datagrid on a popup window which for each row spat out has a
"Select" option - its a hyperlink - when clicked it runs the calls a
javascript function - this function should populate the parent form, my
problem is that I need to update the fields dynamically - ie, I wont know
what the field name actually is...
The code I have thus far:
Calling the function:
<a class="normalText" href="javascript:void(0);"
onclick="populateForm('<%=Request.QueryString("controlid") %>', '<%#
DataBinder
.Eval(
Container
.DataItem, "CrfExpansion") %> ','<%#
DataBinder
.Eval(
Container
.DataItem, "CrfDHANationalCode") %>');">Select</a>
The function:
function populateForm(controlID, displayValue, hiddenValue)
{
opener.document.form1.controlid.value = displayValue;
}
The reason that there are more values coming into the function is because
there are some further plans with this, it will infact update 2 fields on
the parent form - but I wanted to get one working first!
As you can see I have controlID in this line:
opener.document.form1.controlid.value = displayValue
but I believe its actually using that as text, rather than the value it
holds and thus returns an error about the object being null etc..
Any help would be appreciated,
Regards
Rob
Reply to this message...
bruce barker
try:
opener.document.form1[controlid].value = displayValue; // controlid must
evaluate to the name of the control
or
opener.document.getElementById(controlid).value = displayValue; //
controlid must evaluate to the if of the control
-- bruce (sqlwork.com)
"Rob Meade" <
Click here to reveal e-mail address
> wrote in message
news:
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
Rob Meade
"bruce barker" wrote...
[Original message clipped]
Hi Bruce,
Someone in the asp.net group was kind enough to post a reply (after this
group was suggested to me) - which seems to work - many thanks for your
reply.
// populate the display control
var displayControl = eval("opener.document.Form1."+displayControlID);
displayControl.value = displayValue;
Thanks again,
Regards
Rob
Reply to this message...
System.ComponentModel.Container
System.Web.UI.DataBinder
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com