.NETGURU
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




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification