Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
I have URL like this http://127.0.0.1:81/Redirect.aspx?TagId=1,
In that I am passing querystring parameter value comming from database,
Based on tad id It will display Another column is their in database(URL)
 
My question is I want to changing query string parameter One page will open(That page url comming from database table)along with that one I will send sms to number based on TagId
Posted 8-Oct-12 22:20pm
Comments
aspnet_regiis -i at 9-Oct-12 5:47am
   
I don't see any problem in your question.. Where are you stuck ?
Member 9171128 at 9-Oct-12 5:54am
   
HOW IT IS POSSIBLE?
aspnet_regiis -i at 9-Oct-12 6:24am
   
Although your english is too bad, I tried to understand it and suggest you this
 
Follow these steps in your page_load event
1. Read QueryString 'TagId'
2. Read URL from database for 'TagId= value'
3. Response.Redirect("Page2.aspx")
 
In Page_Load of Page2.aspx
 
1. Send SMS to the number. Place the mobile number in Session on Page1.aspx if required OR get the mobile number from database in second Page2.aspx
Member 9171128 at 9-Oct-12 6:47am
   
Page1.aspx
<asp:GridView ID="QS1" runat="server" AutoGenerateSelectButton="True" AutoGenerateColumns="false"
onselectedindexchanging="GvDept_SelectedIndexChanging">

.cs
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=<>;Initial Catalog=productdb;Persist Security Info=True;User ID=<>;Password=<>");
 
SqlDataAdapter da = new SqlDataAdapter("select * from redirecturl", con);
 
DataSet ds = new DataSet();
da.Fill(ds, "redirecturl");
QS1.DataSource = ds.Tables["redirecturl"];
QS1.DataBind();
QS1.DataKeyNames = new string[] { "Tagid" };
}
protected void GvDept_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
QS1.SelectedIndex = e.NewSelectedIndex;
 
string Dno = QS1.SelectedValue.ToString();
Response.Redirect("~/Page2.Aspx?TagId="+Dno);

}
Page2.aspx
<div>
<asp:GridView ID="QS2" runat="server"
EmptyDataText="There Are No Employees In Selected Department"
AutoGenerateColumns="false" Width="99px">

<br />

<iframe width="100%" runat="server" id="ifrmBrs">your browser does not support IFRAMEs</iframe>
 
</div>
.cs
String URL = "";
protected void Page_Load(object sender, EventArgs e)
{
string Dno = Request.QueryString["TagId"];

SqlConnection con = new SqlConnection(@"Data Source=<>;Initial Catalog=productdb;Persist Security Info=True;User ID=<>;Password=<>");
 

 
SqlCommand cmd = new SqlCommand("select coupounurl from redirecturl where Tadid=" + Dno, con);
 
con.Open();

SqlDataReader dr = cmd.ExecuteReader();
QS2.DataSource = dr;
QS2.DataBind();
dr.Close();
 
object drReader = cmd.ExecuteScalar();
if (drReader != null)
{
URL = drReader.ToString();
}
 
con.Close();
if (!String.IsNullOrEmpty(URL))
{
//Use Iframe if it works
ifrmBrs.Attributes["src"] =URL;
}
}
I am trying this one
Member 9171128 at 9-Oct-12 6:53am
   
My QUESTION IS
tABLE
Tagid coupounurl phonenumber
1 http://page4.aspx 655666666
2 http://page5.aspx 67867668
3 http://page6.aspx 6868769879
Based on tag id Redirect perticular url,
In redirect perticular url based on TagId I want to send sms to perticular pnonenumber(Worldwide)
I dont known idea on sending sms
plz help me ........
I am pure in ENGLISH
aspnet_regiis -i at 9-Oct-12 7:02am
   
I agree about your command on the language. The one of the many changes required in your last sentence is to change the spelling from INGLISH to ENGLISH...
aspnet_regiis -i at 9-Oct-12 7:03am
   
Member 9171128 at 9-Oct-12 10:44am
   
You are under standing my question?
plz tell me any modifications in the above code,
Sending sms us,uk and India also
How can i implement that one
plz help me
Member 9171128 at 10-Oct-12 0:57am
   
Can you tell me plz Any services are available send SMS (US,UK and also INDIA),Now i am ready to buy a SMS service,
and also how to this service integrate?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Your code fetches the URL from the database. Now you need to make a small change in the above code to fetch the phone number from the database. Add the extra column name 'phonenumber' to it . Here it is
 
 protected void Page_Load(object sender, EventArgs e)
    {
        string Dno = Request.QueryString["TagId"];
        
        SqlConnection con = new SqlConnection(@"Data Source=<>;Initial Catalog=productdb;Persist Security Info=True;User ID=<>;Password=<>");
 
       
 
        SqlCommand cmd = new SqlCommand("select coupounurl, phonenumber from redirecturl where Tadid=" + Dno, con);//** FIXED HERE

        con.Open();
        
        SqlDataReader dr = cmd.ExecuteReader();
        QS2.DataSource = dr;
        QS2.DataBind();
        dr.Close();
 
        object drReader = cmd.ExecuteScalar();
        if (drReader != null)
        {
            URL = drReader["couponurl"].ToString();//FIXED HERE
            phonenumber = drReader["phonenumber "].ToString();//FIXED HERE
        }
 
        con.Close();
        if (!String.IsNullOrEmpty(URL))
        {
            //Use Iframe if it works               
            ifrmBrs.Attributes["src"] =URL;
Session ["phonenumber "]=phonenumber;//FIXED HERE
}
}
 

Then redirect to Response.Redirect(URL);
 

Then on the Page_Load of the redirected page, you can call the webservice to send SMS. Remember that SMS cannot be sent through asp.net alone. You need to buy a SMS service and integrate it into asp.net application
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I am creating phonenumber column in database getting an error,
 
URL = drReader["couponurl"].ToString();
phonenumber = drReader["phonenumber "].ToString();
 
ErrorIs:Can't apply indexind with[]to an expression of type 'object'
  Permalink  
v2

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



Advertise | Privacy | Mobile
Web02 | 2.8.140821.2 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100