Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.