tags:

views:

34

answers:

1

Hi

I'm calling an dialog from code behind and i've an asp:button. Now i'm trying to call the click event of asp:button inside the dialog but with no sucess.

First i've a jQuery function on document ready that doesn't allow the dialog to open, then i register this script through code behind. (if i don't add the function "open" the dialogs works properly but doesn't call the event. if i add like i have in the code bellow, the dialog just don't open but i don't get any javascript error).

sb.Append("$('#mensagemUtilizador').dialog({ ");
sb.Append("position:'center', width:'auto', autoresize:true, modal:true,");
sb.Append("open: function(type,data) {");
sb.Append("$(this).parent().appendTo(\"form\");");
sb.Append("}");
sb.Append("}");
sb.Append("});");
ScriptManager.RegisterStartupScript(this, GetType(), "openDialog", sb.ToString(), true);

Am i doing something wrong?

I've tried too to add an jQuery button. Then i tried to call a Webservice with that button click event but with no sucess too.

+1  A: 

Try to surround your code with

$(document).ready(function () {
    //your code here
});
despart
Thanks mate, solved ;)
Guilherme Cardoso