I have implent one jquery modal popup
Jquery Code:-
<script type="text/javascript">
$(function(){
$('#<%=a2.ClientID %>').click(function(){
$('#modelPopup').dialog({
title: "Add New Server",
width:650,
height:450,
modal:true,
buttons:{
Close:function(){
$(this).dialog('close');
}
}
});
});
})
</script>
Html:-
<asp:Button ID="btnAddNewServic" Text="Add Service" runat="server"
CssClass="btnSmall_bg_green" Height="26px" Width="98px" OnClick="btnAddNewServic_Click" />
Code Behind:-
protected void btnAddNewServic_Click(object sender, EventArgs e)
{
int rowCount = 0;
rowCount = Convert.ToInt32(Session["clicks"]);
rowCount++;
Session["clicks"] = rowCount;
for (int i = 0; i < rowCount; i++)
{
TextBox txtServerU = new TextBox();
Label lblU = new Label();
txtServerU.ID = "txtServerU" + i.ToString();
lblU.ID = "lblU" + i.ToString();
lblU.Text = "Service" + (i + 1).ToString() + ":";
panelnewserver.Controls.Add(lblU);
panelnewserver.Controls.Add(txtServerU);
}
}
I could not able to find the issue of this code. Can anyone help me to fire this button click event. Thanks in advance.
Updated:-
JQuery Code:-
$(function(){
$('#<%=a2.ClientID %>').click(function(){
var $dialog= $('#modelPopup').dialog({
autoopen:false,
title: "Add New Server",
width:650,
height:450,
modal:true,
buttons:{
Close:function(){
$(this).dialog('close');
}
}
});
$dialog.parent().appendTo($("form:first"));
return false;
});
})
</script>
Now the button click event is fired but after Complete my process the modal popup will be automatically closed. Can anyone help me to overcome this issue.