locked
Cannot find table 0 -- Error RRS feed

  • Question

  • User-470894283 posted

    Hi,

    I have the following code but when i run I got this error "Cannot find table 0"

    I tried to search in google search but cant match with my case.

    Please can anyone give me any idea or advice. Thanks in advanced.

     protected void Submitbtn_Click(object sender, EventArgs e)
        {
            try
            {
                string sThirdPartyEventInvID = "";
                Boolean bSendEmail = false;
                Boolean bSuccess = false;
                DataTable dt = new DataTable();

                if (TSalutationddl.SelectedValue != "" && TOrgtxt.Text != "" && TOfficeTeltxt.Text != "" && TEmailtxt.Text != "" && TNametxt.Text != "" && TDesignationtxt.Text != "" && TMobNotxt.Text != "")
                {
                    bSuccess = true;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "changeValue", "g_isOkToUnload = false;", true);
                    RegisterOnSubmitStatement("OnSubmitScript", "g_isOkToUnload = true;");
                    string sMessage = "Please fill up all the required fields.";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                    return;
                }

                bSuccess = false;

                if (MediaContactNameddl.SelectedValue == "")
                {
                    if (MediaContactSalutationddl.SelectedValue != "" && MCNametxt.Text != "" && MCDesignationtxt.Text != "" && MCOfficeTel.Text != "" && MCMobileNotxt.Text != "" && MCEmailtxt.Text != "")
                    {
                        bSuccess = true;
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "changeValue", "g_isOkToUnload = false;", true);
                        RegisterOnSubmitStatement("OnSubmitScript", "g_isOkToUnload = true;");
                        string sMessage = "Please fill up all the required fields.";
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                        return;
                    }
                }
                else
                    bSuccess = true;

                if (bSuccess)
                {
                    
                    if (MediaContactNameddl.SelectedValue != "")
                    {
                        dt = (DataTable)Session["POAMCPDT"];
                        int s = MediaContactNameddl.SelectedIndex;
                        DataRow dr = dt.Rows[MediaContactNameddl.SelectedIndex - 1];

                        if (dr["maintype"].ToString() == "MCP")
                        {
                            _MC.MediaContactPerson_UpdateSendInvitationalWithMCPID(dr["nomid"].ToString(), "No", Request.QueryString["sid"].ToString());
                        }
                        else
                        {
                            _MC.MediaContactPerson_SavePersonData(dr["nomname"].ToString(), dr["nomsal"].ToString(), dr["nomdes"].ToString(),
                            dr["nomorg"].ToString(), dr["OfficeTel"].ToString(), dr["MobileTel"].ToString(), dr["nomemail"].ToString(),
                            "No", Request.QueryString["sid"].ToString());
                        }
                    }
                    else
                    {
                        _MC.MediaContactPerson_SubmitMedia(MediaContactSalutationddl.SelectedValue, MCNametxt.Text, MCDesignationtxt.Text, MCOfficeTel.Text, MCMobileNotxt.Text, MCEmailtxt.Text, "", TOrgtxt.Text, "No", Request.QueryString["sid"].ToString());
                    }
                    string sMessage = "All details are saved successfully.";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);

                    //SendEmail Testing
                    if (TEmailtxt.Text != null)
                    {
                        string sEmailTemplate = _MC.EmailTemplate_GetTemplateForEmail("Email to third party user for invitation of event", "").Rows[0][""].ToString();
                        sThirdPartyEventInvID = _MC.SendInvitational_TPSaveData(TSalutationddl.SelectedValue, TOrgtxt.Text, TNametxt.Text, TDesignationtxt.Text, TOfficeTeltxt.Text, TEmailtxt.Text, TMobNotxt.Text, Request.QueryString["eid"].ToString(), Request.QueryString["sid"].ToString(), "No").Rows[0][""].ToString();   
                        bSendEmail = SendEmail("", TEmailtxt.Text, "", TNametxt.Text, "", "", "", "", "", sThirdPartyEventInvID, Request.QueryString["sid"].ToString());
                    }
                    if (!bSendEmail)
                    {   
                        sMessage = "ThirdPartyName: Error in data. Please contact Administrator";
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                        return;
                    }
                    sMessage += "ThirdPartyName: Sent emails successfully.\\n\\n";

                }
            }
            catch
            {
                throw;
            }
        }

    Tuesday, June 5, 2012 3:13 AM

Answers

  • User-470894283 posted

    Hi,

    I am sorry, I got it I need to add new emailtemplate and get thirdpartyID latest one to get email through.

    I have changed stored procedure and add new emailtemplate.

    Thanks for replying me.

    It was like that

     protected void Submitbtn_Click(object sender, EventArgs e)
        {
            //try
            //{
                string sThirdPartyEventInvID = "";
                Boolean bSendEmail = false;
                Boolean bSuccess = false;
                DataTable dt = new DataTable();

                if (TSalutationddl.SelectedValue != "" && TOrgtxt.Text != "" && TOfficeTeltxt.Text != "" && TEmailtxt.Text != "" && TNametxt.Text != "" && TDesignationtxt.Text != "" && TMobNotxt.Text != "")
                {
                    bSuccess = true;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "changeValue", "g_isOkToUnload = false;", true);
                    RegisterOnSubmitStatement("OnSubmitScript", "g_isOkToUnload = true;");
                    string sMessage = "Please fill up all the required fields.";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                    return;
                }

                bSuccess = false;

                if (MediaContactNameddl.SelectedValue == "")
                {
                    if (MediaContactSalutationddl.SelectedValue != "" && MCNametxt.Text != "" && MCDesignationtxt.Text != "" && MCOfficeTel.Text != "" && MCMobileNotxt.Text != "" && MCEmailtxt.Text != "")
                    {
                        bSuccess = true;
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "changeValue", "g_isOkToUnload = false;", true);
                        RegisterOnSubmitStatement("OnSubmitScript", "g_isOkToUnload = true;");
                        string sMessage = "Please fill up all the required fields.";
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                        return;
                    }
                }
                else
                    bSuccess = true;

                if (bSuccess)
                {
                    
                    if (MediaContactNameddl.SelectedValue != "")
                    {
                        dt = (DataTable)Session["POAMCPDT"];
                        int s = MediaContactNameddl.SelectedIndex;
                        DataRow dr = dt.Rows[MediaContactNameddl.SelectedIndex - 1];

                        if (dr["maintype"].ToString() == "MCP")
                        {
                            _MC.MediaContactPerson_UpdateSendInvitationalWithMCPID(dr["nomid"].ToString(), "No", Request.QueryString["sid"].ToString());
                        }
                        else
                        {
                            _MC.MediaContactPerson_SavePersonData(dr["nomname"].ToString(), dr["nomsal"].ToString(), dr["nomdes"].ToString(),
                            dr["nomorg"].ToString(), dr["OfficeTel"].ToString(), dr["MobileTel"].ToString(), dr["nomemail"].ToString(),
                            "No", Request.QueryString["sid"].ToString());
                        }
                    }
                    else
                    {
                        _MC.MediaContactPerson_SubmitMedia(MediaContactSalutationddl.SelectedValue, MCNametxt.Text, MCDesignationtxt.Text, MCOfficeTel.Text, MCMobileNotxt.Text, MCEmailtxt.Text, "", TOrgtxt.Text, "No", Request.QueryString["sid"].ToString());
                    }
                    string sMessage = "All details are saved successfully.";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);

                    //SendEmail Testing
                    if (TEmailtxt.Text != null)
                    {
                        DataTable dtss = _MC.EmailTemplate_GetTemplateForEmail("Email to third party user for invitation of event", "sponsor");
                        string sEmailTemplate = _MC.EmailTemplate_GetTemplateForEmail("Email to third party user for invitation of event", "sponsor").Rows[0]["EmailTemplateID"].ToString();
                        sThirdPartyEventInvID = _MC.SendInvitational_TPSaveData(TSalutationddl.SelectedValue, TOrgtxt.Text, TNametxt.Text, TDesignationtxt.Text, TOfficeTeltxt.Text, TEmailtxt.Text, TMobNotxt.Text, Request.QueryString["eid"].ToString(), Request.QueryString["sid"].ToString(), "No").Rows[0]["ThirdPartyEventInvID"].ToString();
                        bSendEmail = SendEmail("", TEmailtxt.Text, sEmailTemplate, TNametxt.Text, "", "", "", "", "", sThirdPartyEventInvID, Request.QueryString["sid"].ToString());
                    }
                    if (!bSendEmail)
                    {   
                        sMessage = "ThirdPartyName: Error in data. Please contact Administrator";
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                        return;
                    }
                    sMessage += "ThirdPartyName: Sent emails successfully.\\n\\n";

                }
            //}
            //catch
            //{
            //    throw;
            //}
        }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 5, 2012 6:08 AM

All replies

  • User197322208 posted

    remove the try/catch and say the line.

    Tuesday, June 5, 2012 3:31 AM
  • User-470894283 posted

     protected void Submitbtn_Click(object sender, EventArgs e)
        {
          
                string sThirdPartyEventInvID = "";
                Boolean bSendEmail = false;
                Boolean bSuccess = false;
                DataTable dt = new DataTable();

                if (TSalutationddl.SelectedValue != "" && TOrgtxt.Text != "" && TOfficeTeltxt.Text != "" && TEmailtxt.Text != "" && TNametxt.Text != "" && TDesignationtxt.Text != "" && TMobNotxt.Text != "")
                {
                    bSuccess = true;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "changeValue", "g_isOkToUnload = false;", true);
                    RegisterOnSubmitStatement("OnSubmitScript", "g_isOkToUnload = true;");
                    string sMessage = "Please fill up all the required fields.";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                    return;
                }

                bSuccess = false;

                if (MediaContactNameddl.SelectedValue == "")
                {
                    if (MediaContactSalutationddl.SelectedValue != "" && MCNametxt.Text != "" && MCDesignationtxt.Text != "" && MCOfficeTel.Text != "" && MCMobileNotxt.Text != "" && MCEmailtxt.Text != "")
                    {
                        bSuccess = true;
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "changeValue", "g_isOkToUnload = false;", true);
                        RegisterOnSubmitStatement("OnSubmitScript", "g_isOkToUnload = true;");
                        string sMessage = "Please fill up all the required fields.";
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                        return;
                    }
                }
                else
                    bSuccess = true;

                if (bSuccess)
                {"This is the line that i got start getting error"
                    
                    if (MediaContactNameddl.SelectedValue != "")
                    {
                        dt = (DataTable)Session["POAMCPDT"];
                        int s = MediaContactNameddl.SelectedIndex;
                        DataRow dr = dt.Rows[MediaContactNameddl.SelectedIndex - 1];

                        if (dr["maintype"].ToString() == "MCP")
                        {
                            _MC.MediaContactPerson_UpdateSendInvitationalWithMCPID(dr["nomid"].ToString(), "No", Request.QueryString["sid"].ToString());
                        }
                        else
                        {
                            _MC.MediaContactPerson_SavePersonData(dr["nomname"].ToString(), dr["nomsal"].ToString(), dr["nomdes"].ToString(),
                            dr["nomorg"].ToString(), dr["OfficeTel"].ToString(), dr["MobileTel"].ToString(), dr["nomemail"].ToString(),
                            "No", Request.QueryString["sid"].ToString());
                        }
                    }
                    else
                    {
                        _MC.MediaContactPerson_SubmitMedia(MediaContactSalutationddl.SelectedValue, MCNametxt.Text, MCDesignationtxt.Text, MCOfficeTel.Text, MCMobileNotxt.Text, MCEmailtxt.Text, "", TOrgtxt.Text, "No", Request.QueryString["sid"].ToString());
                    }
                    string sMessage = "All details are saved successfully.";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);

                    //SendEmail Testing
                    if (TEmailtxt.Text != null)
                    {
                        string sEmailTemplate = _MC.EmailTemplate_GetTemplateForEmail("Email to third party user for invitation of event", "").Rows[0][""].ToString();
                        sThirdPartyEventInvID = _MC.SendInvitational_TPSaveData(TSalutationddl.SelectedValue, TOrgtxt.Text, TNametxt.Text, TDesignationtxt.Text, TOfficeTeltxt.Text, TEmailtxt.Text, TMobNotxt.Text, Request.QueryString["eid"].ToString(), Request.QueryString["sid"].ToString(), "No").Rows[0][""].ToString();   
                        bSendEmail = SendEmail("", TEmailtxt.Text, "", TNametxt.Text, "", "", "", "", "", sThirdPartyEventInvID, Request.QueryString["sid"].ToString());
                    }
                    if (!bSendEmail)
                    {   
                        sMessage = "ThirdPartyName: Error in data. Please contact Administrator";
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                        return;
                    }
                    sMessage += "ThirdPartyName: Sent emails successfully.\\n\\n";

                }
            }
          
        }

    Tuesday, June 5, 2012 3:42 AM
  • User960609757 posted

    Hi,

    I think the DataSet doesn't have any tables yet, and cannot find the table in position 0 (the first table). Maybe you have forgotten to do the filling tables from database to dataset

    and also check the connection string whether it is correctly pointing to the right data source

    Tuesday, June 5, 2012 3:44 AM
  • User-470894283 posted

    Hi,

    When i remove try & catch and try to run there is another error.

    "There is no row at position 0".

    Please, can you give me any advice. Thanks in advanced.

     protected void Submitbtn_Click(object sender, EventArgs e)
        {
          
                string sThirdPartyEventInvID = "";
                Boolean bSendEmail = false;
                Boolean bSuccess = false;
                DataTable dt = new DataTable();

                if (TSalutationddl.SelectedValue != "" && TOrgtxt.Text != "" && TOfficeTeltxt.Text != "" && TEmailtxt.Text != "" && TNametxt.Text != "" && TDesignationtxt.Text != "" && TMobNotxt.Text != "")
                {
                    bSuccess = true;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "changeValue", "g_isOkToUnload = false;", true);
                    RegisterOnSubmitStatement("OnSubmitScript", "g_isOkToUnload = true;");
                    string sMessage = "Please fill up all the required fields.";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                    return;
                }

                bSuccess = false;

                if (MediaContactNameddl.SelectedValue == "")
                {
                    if (MediaContactSalutationddl.SelectedValue != "" && MCNametxt.Text != "" && MCDesignationtxt.Text != "" && MCOfficeTel.Text != "" && MCMobileNotxt.Text != "" && MCEmailtxt.Text != "")
                    {
                        bSuccess = true;
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "changeValue", "g_isOkToUnload = false;", true);
                        RegisterOnSubmitStatement("OnSubmitScript", "g_isOkToUnload = true;");
                        string sMessage = "Please fill up all the required fields.";
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                        return;
                    }
                }
                else
                    bSuccess = true;

                if (bSuccess)
                {
                    
                    if (MediaContactNameddl.SelectedValue != "")
                    {
                        dt = (DataTable)Session["POAMCPDT"];
                        int s = MediaContactNameddl.SelectedIndex;
                        DataRow dr = dt.Rows[MediaContactNameddl.SelectedIndex - 1];

                        if (dr["maintype"].ToString() == "MCP")
                        {
                            _MC.MediaContactPerson_UpdateSendInvitationalWithMCPID(dr["nomid"].ToString(), "No", Request.QueryString["sid"].ToString());
                        }
                        else
                        {
                            _MC.MediaContactPerson_SavePersonData(dr["nomname"].ToString(), dr["nomsal"].ToString(), dr["nomdes"].ToString(),
                            dr["nomorg"].ToString(), dr["OfficeTel"].ToString(), dr["MobileTel"].ToString(), dr["nomemail"].ToString(),
                            "No", Request.QueryString["sid"].ToString());
                        }
                    }
                    else
                    {
                        _MC.MediaContactPerson_SubmitMedia(MediaContactSalutationddl.SelectedValue, MCNametxt.Text, MCDesignationtxt.Text, MCOfficeTel.Text, MCMobileNotxt.Text, MCEmailtxt.Text, "", TOrgtxt.Text, "No", Request.QueryString["sid"].ToString());
                    }
                    string sMessage = "All details are saved successfully.";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);

                    //SendEmail Testing
                    if (TEmailtxt.Text != null)
                    {

    "The following line having error."
                        string sEmailTemplate = _MC.EmailTemplate_GetTemplateForEmail("Email to third party user for invitation of event", "").Rows[0][""].ToString();
                        sThirdPartyEventInvID = _MC.SendInvitational_TPSaveData(TSalutationddl.SelectedValue, TOrgtxt.Text, TNametxt.Text, TDesignationtxt.Text, TOfficeTeltxt.Text, TEmailtxt.Text, TMobNotxt.Text, Request.QueryString["eid"].ToString(), Request.QueryString["sid"].ToString(), "No").Rows[0][""].ToString();   
                        bSendEmail = SendEmail("", TEmailtxt.Text, "", TNametxt.Text, "", "", "", "", "", sThirdPartyEventInvID, Request.QueryString["sid"].ToString());
                    }
                    if (!bSendEmail)
                    {   
                        sMessage = "ThirdPartyName: Error in data. Please contact Administrator";
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                        return;
                    }
                    sMessage += "ThirdPartyName: Sent emails successfully.\\n\\n";

                }
        
        }

    Tuesday, June 5, 2012 3:49 AM
  • User197322208 posted

       string sEmailTemplate = _MC.EmailTemplate_GetTemplateForEmail("Email to third party user for invitation of event", "").Rows[0][""].ToString();

    what is

    GetTemplateForEmail

    definition and body?

    Tuesday, June 5, 2012 3:54 AM
  • User-470894283 posted

    Hi,

    GetTemplateForEmail is store procedure that i use to get emailtemplate.

    The following code are definition which is represent for GetTemplateForEmail

    public DataTable EmailTemplate_GetTemplateForEmail(string sType, string sUserType)
            {
                return _oEmailTemplate.GetTemplateForEmail(sType, sUserType);
            }

    public DataTable GetTemplateForEmail(string sType, string sUserType)
            {
                ArrayList alList = new ArrayList();
                POAStoredP SP;

                SP = new POAStoredP();
                SP.Name = "@Type";
                SP.Type = "String";
                SP.Value = sType;
                alList.Add(SP);


                SP = new POAStoredP();
                SP.Name = "@UserType";
                SP.Type = "String";
                SP.Value = sUserType;
                alList.Add(SP);
                return _POA.SelectSPQuery("EmailTemplate_GetTemplateForEmail", alList);
            }

    Store Procedure is

    ALTER PROC [dbo].[EmailTemplate_GetTemplateForEmail]
        @Type Varchar(50),
        @UserType Varchar(50)
    AS
    BEGIN
        SELECT * from EmailTemplate where DeleteStatus = 'N'  
        And EmailTemplateEmailType = @Type And EmailTemplateUserType = @UserType order by createddate desc
    END

    Tuesday, June 5, 2012 4:01 AM
  • User197322208 posted

    and

    _POA.SelectSPQuery

    ?

    Tuesday, June 5, 2012 4:08 AM
  • User-470894283 posted

    Hi,

    I am sorry, I got it I need to add new emailtemplate and get thirdpartyID latest one to get email through.

    I have changed stored procedure and add new emailtemplate.

    Thanks for replying me.

    It was like that

     protected void Submitbtn_Click(object sender, EventArgs e)
        {
            //try
            //{
                string sThirdPartyEventInvID = "";
                Boolean bSendEmail = false;
                Boolean bSuccess = false;
                DataTable dt = new DataTable();

                if (TSalutationddl.SelectedValue != "" && TOrgtxt.Text != "" && TOfficeTeltxt.Text != "" && TEmailtxt.Text != "" && TNametxt.Text != "" && TDesignationtxt.Text != "" && TMobNotxt.Text != "")
                {
                    bSuccess = true;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "changeValue", "g_isOkToUnload = false;", true);
                    RegisterOnSubmitStatement("OnSubmitScript", "g_isOkToUnload = true;");
                    string sMessage = "Please fill up all the required fields.";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                    return;
                }

                bSuccess = false;

                if (MediaContactNameddl.SelectedValue == "")
                {
                    if (MediaContactSalutationddl.SelectedValue != "" && MCNametxt.Text != "" && MCDesignationtxt.Text != "" && MCOfficeTel.Text != "" && MCMobileNotxt.Text != "" && MCEmailtxt.Text != "")
                    {
                        bSuccess = true;
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "changeValue", "g_isOkToUnload = false;", true);
                        RegisterOnSubmitStatement("OnSubmitScript", "g_isOkToUnload = true;");
                        string sMessage = "Please fill up all the required fields.";
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                        return;
                    }
                }
                else
                    bSuccess = true;

                if (bSuccess)
                {
                    
                    if (MediaContactNameddl.SelectedValue != "")
                    {
                        dt = (DataTable)Session["POAMCPDT"];
                        int s = MediaContactNameddl.SelectedIndex;
                        DataRow dr = dt.Rows[MediaContactNameddl.SelectedIndex - 1];

                        if (dr["maintype"].ToString() == "MCP")
                        {
                            _MC.MediaContactPerson_UpdateSendInvitationalWithMCPID(dr["nomid"].ToString(), "No", Request.QueryString["sid"].ToString());
                        }
                        else
                        {
                            _MC.MediaContactPerson_SavePersonData(dr["nomname"].ToString(), dr["nomsal"].ToString(), dr["nomdes"].ToString(),
                            dr["nomorg"].ToString(), dr["OfficeTel"].ToString(), dr["MobileTel"].ToString(), dr["nomemail"].ToString(),
                            "No", Request.QueryString["sid"].ToString());
                        }
                    }
                    else
                    {
                        _MC.MediaContactPerson_SubmitMedia(MediaContactSalutationddl.SelectedValue, MCNametxt.Text, MCDesignationtxt.Text, MCOfficeTel.Text, MCMobileNotxt.Text, MCEmailtxt.Text, "", TOrgtxt.Text, "No", Request.QueryString["sid"].ToString());
                    }
                    string sMessage = "All details are saved successfully.";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);

                    //SendEmail Testing
                    if (TEmailtxt.Text != null)
                    {
                        DataTable dtss = _MC.EmailTemplate_GetTemplateForEmail("Email to third party user for invitation of event", "sponsor");
                        string sEmailTemplate = _MC.EmailTemplate_GetTemplateForEmail("Email to third party user for invitation of event", "sponsor").Rows[0]["EmailTemplateID"].ToString();
                        sThirdPartyEventInvID = _MC.SendInvitational_TPSaveData(TSalutationddl.SelectedValue, TOrgtxt.Text, TNametxt.Text, TDesignationtxt.Text, TOfficeTeltxt.Text, TEmailtxt.Text, TMobNotxt.Text, Request.QueryString["eid"].ToString(), Request.QueryString["sid"].ToString(), "No").Rows[0]["ThirdPartyEventInvID"].ToString();
                        bSendEmail = SendEmail("", TEmailtxt.Text, sEmailTemplate, TNametxt.Text, "", "", "", "", "", sThirdPartyEventInvID, Request.QueryString["sid"].ToString());
                    }
                    if (!bSendEmail)
                    {   
                        sMessage = "ThirdPartyName: Error in data. Please contact Administrator";
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myalert", "alert('" + sMessage + "');", true);
                        return;
                    }
                    sMessage += "ThirdPartyName: Sent emails successfully.\\n\\n";

                }
            //}
            //catch
            //{
            //    throw;
            //}
        }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 5, 2012 6:08 AM