Loading
How to open popup page    
  •         
  •       
  •     
  • then on sucess populate all
     
    1. [WebMethod]    
    2. public static User CheckUsername(string username)    
    3. {    
    4.     using(SqlConnection con=new SqlConnection(cs))    
    5. {    
    6.   SqlCommand cmd= new SqlCommand("select Count(*) from tblUser where Name=@userName");    
    7.   cmd.Parameters.AddWithValue("@userName",username);    
    8.   SqlDataReader rdr= cmd.ExecuteReader();  
    9. User user= new User();  
    10.   while(rdr.Read())  
    11. {  
    12.   
    13. user.Name= rdr["UserName"].ToString();  
    14. // similarly other fields  
    15. }  
    16.    
    17. }    
    18.   return User;  
    19.   }  
    20.   
    21. public class User  
    22. {    
    23.     public int Id{ get; set; }    
    24.     public string Name{ get; set; }    
    25.     public string Address { get; set; }    
    26.     public string MobileNo { get; set; }    
    27. }   
    1. "text/javascript">      
    2.          $("[id$=txtUser]").focusout(function(){      
    3.       
    4.  var username = $("[id$=txtUser]").val();      
    5.             $.ajax({      
    6.                 type: "POST",      
    7.                 url: "PageName.aspx/CheckUsername",      
    8.                 data: '{username: "' + username + '" }',      
    9.                 contentType: "application/json; charset=utf-8",      
    10.                 dataType: "json",      
    11.                 success: function (response) {     
    12.                 if(response) {    
    13.                $("#txtUserName").val(response.Name);  
    14. // similarly other fields  
    15.                  $("#myModal").Modal('show');    
    16.                 }     
    17. }     
    18.             });      
    19.         };      
    20. });      
    21.     
     
  • Bhavesh Vankar
    i have not used modal.
    i have used aspx page for some records. 
    in my page 1 three textboxes like FName MName Lname when use enter Full Name details in three textboxes  then the name should be match in table if name exists than the popup page should be open with all details of that full name.
    but the query is in form their is three textboxes and the name column in table is only single column like name.
     
    i have used and fetch record like below sql query i want to concat that three textboxes and want to match with table column which is single column.
     
    1. SqlCommand cmd = new SqlCommand("Select Name='"+ txtfname.Text+ " " + txtmname.Text + " " +txtlname.Text + "' From StudentRecord", con);  
     
     
  • Sachin Singh
    This is very simple
    step 1. Aspx page
     
     
    1. class="modal" tabindex="-1" role="dialog" id="myModal">  
    2.   class="modal-dialog" role="document">  
    3.     class="modal-content">  
    4.       class="modal-header">  
    5.         class="modal-title">Modal title  
    6.         "button" class="close" data-dismiss="modal" aria-label="Close">  
    7.           "true"  
    8.           
    9.       
      
  •       class="modal-body">  
  •         

    Modal body text goes here.

      
  •         
  •       class="modal-footer">  
  •         "button" class="btn btn-primary">Save changes  
  •         "button" class="btn btn-secondary" data-dismiss="modal">Close  
  •         
  •       
  •     
  •   
  •   
  •   
  •   
  • "text/javascript">    
  •          $("[id$=txtUser]").focusout(function(){    
  •     
  •  var username = $("[id$=txtUser]").val();    
  •             $.ajax({    
  •                 type: "POST",    
  •                 url: "PageName.aspx/CheckUsername",    
  •                 data: '{username: "' + username + '" }',    
  •                 contentType: "application/json; charset=utf-8",    
  •                 dataType: "json",    
  •                 success: function (response) {   
  •                 if(response) {  
  •                  $("#myModal").Modal('show');  
  •                 }   
  • }   
  •             });    
  •         };    
  • });    
  •   
  •   
  •  step 2. Code behind
    1. [WebMethod]  
    2. public static bool CheckUsername(string username)  
    3. {  
    4.     using(SqlConnection con=new SqlConnection(cs))  
    5. {  
    6.   SqlCommand cmd= new SqlCommand("select Count(*) from tblUser where Name=@userName");  
    7.   cmd.Parameters.AddWithValue("@userName",username);  
    8.   int count= Convert.ToInt32(cmd.ExecuteScalar());  
    9.   if(count>=1)  
    10. {  
    11.   return true;  
    12. }  
    13. return false;  
    14.   
    15. }  
    16.   
    17.   }  
    18.