Welcome to Dream.In.Code
Getting Help is Easy!

Join 107,399 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,167 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Not sure about this error

 
Reply to this topicStart new topic

Not sure about this error, step through doesnt show where error is

rgfirefly24
post 8 May, 2008 - 11:09 AM
Post #1


D.I.C Regular

Group Icon
Joined: 7 Apr, 2008
Posts: 307



Thanked 5 times

Dream Kudos: 150
My Contributions


Ok so i have an AJAX enabled website. Its running properly except for one tiny problem:

Attached Image

Basically this happens when i click a linkbutton here:

Attached Image

which is in an Update panel with a txtbox

the code behind is as follows:

CODE

  protected void Confirm_Click(object sender, EventArgs e)
    {
        Connectto();
        String DBresponse = null;

        
        SqlParameter CusPhone = new SqlParameter();
        CusPhone.ParameterName = "@CusPhone";
        CusPhone.DbType = DbType.String;
        CusPhone.Value = Session["<removed>"];

        String poolDB = "Select <removed> FROM <removed> WHERE <removed>";

        SqlCommand pool = new SqlCommand(poolDB, connect);
        pool.Parameters.Add(CusPhone);

        DBresponse = (String)pool.ExecuteScalar();
        if (DBresponse != null)
        {
            connect.Close();
            Server.Transfer("<removed>.aspx", true);
        }
        else
        {
            a label.Text = "<br /><removed><br />";
        }
    }


i've tried googling it but cannot understand why its poping up. I have removed all Response.write's from the code in that area and still no go.

This post has been edited by rgfirefly24: 8 May, 2008 - 11:18 AM
User is offlineProfile CardPM

Go to the top of the page


rgfirefly24
post 8 May, 2008 - 11:50 AM
Post #2


D.I.C Regular

Group Icon
Joined: 7 Apr, 2008
Posts: 307



Thanked 5 times

Dream Kudos: 150
My Contributions


QUOTE(rgfirefly24 @ 8 May, 2008 - 11:09 AM) *

Ok so i have an AJAX enabled website. Its running properly except for one tiny problem:

Attached Image

Basically this happens when i click a linkbutton here:

Attached Image

which is in an Update panel with a txtbox

the code behind is as follows:

CODE

  protected void Confirm_Click(object sender, EventArgs e)
    {
        Connectto();
        String DBresponse = null;

        
        SqlParameter CusPhone = new SqlParameter();
        CusPhone.ParameterName = "@CusPhone";
        CusPhone.DbType = DbType.String;
        CusPhone.Value = Session["<removed>"];

        String poolDB = "Select <removed> FROM <removed> WHERE <removed>";

        SqlCommand pool = new SqlCommand(poolDB, connect);
        pool.Parameters.Add(CusPhone);

        DBresponse = (String)pool.ExecuteScalar();
        if (DBresponse != null)
        {
            connect.Close();
            Server.Transfer("<removed>.aspx", true);
        }
        else
        {
            a label.Text = "<br /><removed><br />";
        }
    }


i've tried googling it but cannot understand why its poping up. I have removed all Response.write's from the code in that area and still no go.



Sigh, My overuse of Server.Transfer strikes again! I had to change it to Response.Redirect and it worked.......
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 8 May, 2008 - 04:36 PM
Post #3


DIC.Rules == true;

Group Icon
Joined: 26 Jul, 2007
Posts: 7,135



Thanked 50 times

Dream Kudos: 7700

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, GDI

My Contributions


Be very careful when using Server.Transfer() as it can, as you just learned, lead to problems that arent associated with Response.Redirect(). I rarely, if ever, use Server.Transfer
User is online!Profile CardPM

Go to the top of the page

rgfirefly24
post 9 May, 2008 - 10:39 AM
Post #4


D.I.C Regular

Group Icon
Joined: 7 Apr, 2008
Posts: 307



Thanked 5 times

Dream Kudos: 150
My Contributions


QUOTE(PsychoCoder @ 8 May, 2008 - 04:36 PM) *

Be very careful when using Server.Transfer() as it can, as you just learned, lead to problems that arent associated with Response.Redirect(). I rarely, if ever, use Server.Transfer


the only reason i used Server.Transfer is because it is said to save session data where Response.Redirect doesnt. I could be totally wrong on this, but thats what i read
User is offlineProfile CardPM

Go to the top of the page

jayman9
post 9 May, 2008 - 12:52 PM
Post #5


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,289



Thanked 21 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


Session data persistance has nothing to do with how you send a user to another page. They are completely unrelated.
User is online!Profile CardPM

Go to the top of the page

rgfirefly24
post 9 May, 2008 - 03:28 PM
Post #6


D.I.C Regular

Group Icon
Joined: 7 Apr, 2008
Posts: 307



Thanked 5 times

Dream Kudos: 150
My Contributions


QUOTE(jayman9 @ 9 May, 2008 - 12:52 PM) *

Session data persistance has nothing to do with how you send a user to another page. They are completely unrelated.


I know there is a big difference between the two that makes Server.Transfer more appealing in al ot of cases, guess i'm not sure of what it is.
User is offlineProfile CardPM

Go to the top of the page

jayman9
post 9 May, 2008 - 04:02 PM
Post #7


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,289



Thanked 21 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


Here is the difference between the two:

Response.Redirect sends message to browser saying that the browser should request some other page.

Server.Transfer doesn't tell the browser to request page, it just sends the new page directly to the browser.

If you want to know more
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/28/08 04:32PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month