Kev Patil

Kev Patil

  • NA
  • 21
  • 4.2k

jquery with dialog confirm

Feb 22 2016 2:32 PM
I have the following sql select code, where im trying to get value and i would like to ask user to continue if value is found or start new.
 
  1. var getJOB = txtJobNo.Text;  
  2.   
  3. try  
  4. {  
  5.     MGMT_CON.Open();  
  6.     MGMT_COM = new SqlCommand("SELECT [job],[revno] FROM [MATRR] WHERE [job] = '" + getJOB + "'",  
  7.         MGMT_CON);   
  8.     var sqlRRev = MGMT_COM.ExecuteReader();  
  9.     if (sqlRRev.Read())  
  10.     {    
  11.         //ask user if want to continue   
  12.         //if wants to continue use the value from sql  
  13.         //else write something else into textbox  
  14.   
  15.         //if reads get the revno from sql and convert into int  
  16.         var revno = Convert.ToInt32(sqlRRev.GetValue(1).ToString());  
  17.         //write mrr based on revno  
  18.         ddlRR.Text = "BBB-" + getJOB + "-" + (revno + 1);  
  19.     }  
  20.     else  
  21.     {  
  22.         ddlRR.Text = "BBB-" + getJOB + "-" + 1001;  
  23.     }  
  24.     MGMT_CON.Close();  
  25. }  
  26. catch (Exception e)  
  27. {  
  28.     ClientScript.RegisterClientScriptBlock(GetType(), "alert", e.Message);  
  29. }  
 I tried looking around for different solution, one was trying jquery but im not familiar with it.
  
  1. <script>  
  2.     $(function () {  
  3.         $("#dialog-confirm").dialog({  
  4.             resizable: true,  
  5.             height: 140,  
  6.             modal: true,  
  7.             buttons: {  
  8.                 "Use New"function () {  
  9.                     $(this).dialog("close");  
  10.                 },  
  11.                 "Continue"function () {  
  12.                     $('#<%=Label1.ClientID%>').html("hello"); /* but sometimes i would need to calculate (adding or subtracting) */  
  13.                     $(this).dialog("close");  
  14.                 }  
  15.             }  
  16.         });  
  17.     });  
  18. </script>    

please help.
Thankyou 

Answers (5)