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
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
...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
Code:
SqlConnection objCon = new SqlConnection(con); SqlDataAdapter objDA = new SqlDataAdapter(fill, objCon); DataSet ds = new DataSet(); objDA.Fill(ds, "tblBook"); DataTable objDT = ds.Tables[0]; added = objDT.Rows.Count; if (added == 1) { foreach (DataRow dr in objDT.Rows) { txtAuthor.Text = dr["AuthorName"].ToString(); txtBtitle.Text = dr["BookTitle"].ToString(); } //GridView1.DataSource=objDT; //GridView1.DataBind(); } else { Response.Write("<script language='javascript'> var result=confirm('File not found');</script>"); }
thanks
Comment