ASP.NET

Moderators: None (Apply to moderate this forum)
Number of threads: 1727
Number of posts: 3292

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
invoking javascript function from datagrid Posted by akashdeep_jain on 17 Aug 2005 at 2:40 AM
Here is the code snippet :

<SCRIPT language="javascript">
function _TrapValues(CustomerKey,SetBoxName)
{
if (SetBoxName =="CustKey")
{
window.opener.document.SOEntry.Txt_Customer.value=CustomerKey;
}
else if (SetBoxName=="SalesPerson")
{
window.opener.document.SOEntry.Txt_SalesPersonKey.value=CustomerKey;
}
else if (SetBoxName=="ShipTOKey")
{
window.opener.document.SOEntry.Txt_ShipToKey.value=CustomerKey;
}
else if (SetBoxName=="FOBKey")
{
window.opener.document.SOEntry.Txt_FOBKey.value=CustomerKey;
}
else if (SetBoxName=="TermsKey")
{
window.opener.document.SOEntry.Txt_TermsKey.value=CustomerKey;
}
else if (SetBoxName=="Calendar1")
{
window.opener.document.SOEntry.Txt_OrderDate.value=CustomerKey;
}
else if (SetBoxName=="Calendar2")
{
window.opener.document.SOEntry.Txt_CancelDate.value=CustomerKey;
}
else if (SetBoxName=="Calendar3")
{
window.opener.document.SOEntry.Txt_RDD.value=CustomerKey;
}
window.close();
}

</SCRIPT>

I want to Invoke this function when the selectedindexchanged event is fired from a datagrid.
can some body help me in achieving this functionality




Report
Re: invoking javascript function from datagrid Posted by raylouw on 19 Aug 2005 at 1:20 AM
: Here is the code snippet :
:
: <SCRIPT language="javascript">
: function _TrapValues(CustomerKey,SetBoxName)
: {
: if (SetBoxName =="CustKey")
: {
: window.opener.document.SOEntry.Txt_Customer.value=CustomerKey;
: }
: else if (SetBoxName=="SalesPerson")
: {
: window.opener.document.SOEntry.Txt_SalesPersonKey.value=CustomerKey;
: }
: else if (SetBoxName=="ShipTOKey")
: {
: window.opener.document.SOEntry.Txt_ShipToKey.value=CustomerKey;
: }
: else if (SetBoxName=="FOBKey")
: {
: window.opener.document.SOEntry.Txt_FOBKey.value=CustomerKey;
: }
: else if (SetBoxName=="TermsKey")
: {
: window.opener.document.SOEntry.Txt_TermsKey.value=CustomerKey;
: }
: else if (SetBoxName=="Calendar1")
: {
: window.opener.document.SOEntry.Txt_OrderDate.value=CustomerKey;
: }
: else if (SetBoxName=="Calendar2")
: {
: window.opener.document.SOEntry.Txt_CancelDate.value=CustomerKey;
: }
: else if (SetBoxName=="Calendar3")
: {
: window.opener.document.SOEntry.Txt_RDD.value=CustomerKey;
: }
: window.close();
: }
:
: </SCRIPT>
:
: I want to Invoke this function when the selectedindexchanged event is fired from a datagrid.
: can some body help me in achieving this functionality
:
:
:
:
:


Try this:

In the selectedindexchanged event do the following (example in c#):

StringBuilder script = new StringBuilder("");

script.Append("<script language=\"javascript\">");
script.AppendFormat("_TrapValues(\"{0}\",\"{1}\"", CustomerKey, SetBoxName);
script.Append("</script>");

Page.RegisterStartupScript("RunnerScript", script.ToString());




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.