473,385 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How do i redirect page after confirmation

Actuall im designing my web page, in that i have text box with name book number
...what i require is if the user will type a new number which is not in the data base and press enter then i want to display a message box saying the book number is not available weather he want to insert new book into database....
in the confirm box if he press ok i want to redirect to InsertBook page.else i want to display the same page. actually i have to write this code in the .cs file using java script...i cant able to use java script in .cs file... i wrote by code as follows
Expand|Select|Wrap|Line Numbers
  1.                 SqlConnection objCon = new SqlConnection(con);
  2.                 SqlDataAdapter objDA = new SqlDataAdapter(fill, objCon);
  3.                 DataSet ds = new DataSet();
  4.                 objDA.Fill(ds, "tblBook");
  5.                 DataTable objDT = ds.Tables[0];               
  6.                 added = objDT.Rows.Count;           
  7.                 if (added == 1)
  8.                 {
  9.                     foreach (DataRow dr in objDT.Rows)
  10.                     {
  11.                         txtAuthor.Text = dr["AuthorName"].ToString();
  12.                         txtBtitle.Text = dr["BookTitle"].ToString();
  13.                     }
  14.                     //GridView1.DataSource=objDT;
  15.                     //GridView1.DataBind();
  16.                 }
  17.                 else
  18.                 {
  19.  
  20.                     Response.Write("<script language='javascript'> var result=confirm('File not found');</script>");
  21.                 }  
  22.  
my problem is in else part of the above code....of course im able to display a confirm box but i cant make it redirect...can any one help me

thanks
Jan 2 '09 #1
3 3135
Bassem
344 100+
You can use this
Response.Redirect("InsertBookPage.htm");
Jan 3 '09 #2
kenobewan
4,871 Expert 4TB
If you simply must do it using JS try registerclientscript method or similar. Good luck.
Jan 4 '09 #3
liawcv
33
JavaScript for redirection:
Expand|Select|Wrap|Line Numbers
  1. window.location = 'AnotherPage.aspx';
  2.  
Jan 9 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sean Pinto | last post by:
My hosting company has an automatic redirect page called /missing/missing.php and I want to log all of the page not founds that result in a redirection to missing.php. I can't seem to find out how...
3
by: Sean Berry | last post by:
Hi there. I am relativly new to Python CGI and need a question answered. I have made custom 404 error pages and have them in various web directories. I have not been able to figure out a way...
1
by: Paul Oakfleet | last post by:
The script below will disable Submit button until user accept terms, and will redirect user to another page after clicking on Submit button. The script seems to work fine on my PC (Windows XP,...
1
by: Umesha | last post by:
Hello pals, I have one problem, how to redirect the user from intro page to the main page, once user visits the site. If user visitng first time the intro page has to be shown, then further...
12
by: JenHu | last post by:
Hi all, I have to ask a stupid question: In asp.net, I use Response.Redirect ("Main.aspx") to redirect pages, but what is the syntax of redirect forms in vb.net windows application? I have...
4
by: shapper | last post by:
Hello, I am using the following code line in my VB code to redirect to another page inside my web site: Response.Redirect("Message.aspx") I am getting the error: The page isn't redirecting...
1
by: thirunavukarasukm | last post by:
i created one web form the form contain two label box and text box in the form one button is placed i click the button the page redirect to next page window.location.href="fdfgd.com";
9
by: JCCDEVEL | last post by:
Hi All, I'm trying to do the following: 1) ON a php page, calculate fees based upon user entires. I'm calculating it in a javascript function and that is working well. However, I need to take...
4
by: sva0008 | last post by:
Hi, How do i redirect page in the javascript function? I am using Response.redirect ("LoadDetail_DS.asp"); but it gives me error : 'Response' is undefined. Thanks
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.