Click here to Skip to main content
15,918,243 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to send sms to lots of people.

I'm using a Code Project sample code which uses a web service, but I'm getting a program error.

Can you help?

Here's the code:

C#
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace SmsTest
{
    /// <summary>
    /// Summary description for WebForm1.
    /// </summary>
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, System.EventArgs e)
        {
            txtCountryCode.Enabled = false;
        }
        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
        }
        #endregion
        protected void Send_Click(object sender, System.EventArgs e)
        {
            try
            {
                SmsTest.net.webservicex.www.SendSMS smsIndia = new SmsTest.net.webservicex.www.SendSMS();
                SmsTest.com.webservicex.www.SendSMSWorld smsWorld = new SmsTest.com.webservicex.www.SendSMSWorld();
                if (rdoType.SelectedValue == "1")
                    smsIndia.SendSMSToIndia(txtMobileNo.Text.Trim(), txtEmailId.Text.Trim(), txtMessage.Text);
                else
                    smsWorld.sendSMS(txtEmailId.Text.Trim(), txtCountryCode.Text.Trim(), txtMobileNo.Text.Trim(), txtMessage.Text);
                lblMessage.Visible = true;
                lblMessage.Text = "Message Send Succesfully";
                        }
            catch(Exception ex)
            {
                lblMessage.Visible = true;
                lblMessage.Text="Error in Sending message"+ex.ToString();
            }
        }
        protected void rdoType_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if(rdoType.SelectedValue =="1")
                txtCountryCode.Enabled = false;
            else
                txtCountryCode.Enabled = false;
        }
    }
}
Posted
Updated 18-Jul-10 23:46pm
v4
Comments
Dalek Dave 19-Jul-10 5:19am    
Edited for readability and to remove the Retard Text-Speak.
Johnny J. 19-Jul-10 5:47am    
Where does the error occur and what error message do you get?

1 solution

Firstly, What Code?

Provide the code you are using.
People are not psychic, so show the code and where the error is.

Second, do not use text-speak, it is for children and retards.

Third, a link to the code snippet you are basing your work on would also be useful so that comparisons can be made.

Do this and help may be more readily available.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900