Please try below mentioned steps.
Step 1: Check whether your scripts having ay script error by using chrome dev tools
Step 2 :
Don't use live method (which is outdated).Instead of use
on method with your events.
Step 3 ; Use is as below.
$("[id*=btnOpenDialog]").off('click').on('click', function(){
$("#modal_dialog").dialog({
title: "Details",
modal: true,
width: "700px"
});
return false;
})
<div id="modal_dialog" style="display:none">
<asp:Label ID="lblError" runat="server" Visible="true" ForeColor="Red"></asp:Label>
<asp:Label ID="lblLastName" runat="server" Text="Last Name"></asp:Label>
<asp:TextBox ID="txtLastName" Width="100px" runat="server"></asp:TextBox>
<asp:Label ID="lblFirstName" runat="server" Text="First Name"> </asp:Label>
<asp:TextBox ID="txtFirstName" Width="100px" runat="server"></asp:TextBox>
<asp:Button ID="btnSearch" UseSubmitBehavior="false" runat="server" Text="Search" OnClick="btnSearch_Click"/>
<asp:Button ID ="btnClose" Text="Close" runat="server"></asp:Button>
</div>
$("[id*=btnSearch]").off('click').on('click', function(e){
var firstName = $("#<%= txtFirstName.ClientID %>").val();
var lastName = $("#<%= txtLastName.ClientID %>").val();
if(firstName == "" & lastName == "")
{
e.preventDefault();
$("#<%= lblError.ClientID %>").text("Enter minimum two characters in either first name or last name");
return false;
}
else
{
$("#<%= lblError.ClientID %>").text("");
$("#hdnFirstNameInitiator").val($("#<%= txtFirstName.ClientID %>").val());
$("#hdnLastNameInitiator").val($("#<%= txtLastName.ClientID %>").val());
return true;
}
})
$("[id*=btnClose]").off('click').on('click', function(e){
$("#modal_dialog").dialog('close');
return false;
})
I hope this will help to you. :)