invoking javascript function from datagrid - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

invoking javascript function from datagrid

akashdeep_jainakashdeep_jain Posts: 1Member
Here is the code snippet :


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();
}



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




Comments

  • raylouwraylouw Posts: 30Member
    : Here is the code snippet :
    :
    :
    : 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();
    : }
    :
    :
    :
    : 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.AppendFormat("_TrapValues("{0}","{1}"", CustomerKey, SetBoxName);
    script.Append("");

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

Sign In or Register to comment.