0

We are using asp.net button to open light box.But because of post back light box doent appear. We tried to use html button, it opens the light box but the validations in page is not controlled.How we may manage this?

            StringBuilder sb = new StringBuilder();
            sb.Append("<script type='text/javascript\'>");
            sb.Append("$(function () {");
            sb.Append("$('#dialog').dialog({");
            sb.Append("bgiframe: true, autoOpen: false, height: 500,");
            sb.Append("minWidth: 780, resizable: false, modal: true, position:'center',");
            sb.Append("open: function (type, data) {");
            sb.Append("$(this).parent().appendTo('form');");
            sb.Append("}");
            sb.Append("});");
            sb.Append("$('#dialog_link').click(function () {");
            sb.Append("$('#dialog').dialog('open');");
            sb.Append("return false;");
            sb.Append("});");
            sb.Append("});");
            sb.Append("</script>");

            ClientScript.RegisterClientScriptBlock(this.GetType(), "Lightbox", sb.ToString(), false);

Not working on ButtonClick event are there any mistakes in code ?

4

1 回答 1

0

这个怎么样

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        buttonId.Attributes.Add("onClick", "return false;");
    }
}

这应该可以阻止回发,但仍然可以为您提供所需的内容。

于 2012-06-06T14:29:34.263 回答