日期:2014-05-17  浏览次数:20603 次

在当前页面弹出对话框,请教错在哪呢?
.cs:
C# code
 
    protected void btnEditCommand(object sender, CommandEventArgs e)
    {
        string url = "CategoryEdit.aspx?ID=" + e.CommandName.ToString();
        string strCommand = "window.showModalDialog("+url+", window, \"dialogHeight: 330px; dialogWidth: 400px;edge: Raised; center: Yes; help: No; resizable: No; status: No\")";
        string strCommandTest = @"window.showModalDialog(CategoryEdit.aspx');";
        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", strCommand, true);            
    }



.aspx:

HTML code
<asp:Button ID="btnEdit" runat="server" Text="编辑" CommandName='<%#Eval("ID") %>' OnCommand="btnEditCommand"/>


button控件在repeater的ItemTemplate中,repeater在updatepanel中
结果点击编辑,没弹出什么,求大侠们指点,多谢!

------解决方案--------------------
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", strCommand, true);
这句错了,改成:

ScriptManager.RegisterStartupScript(btnEdit, btnEdit.GetType(), "", strCommand, true);
------解决方案--------------------
string strCommandTest = @"window.showModalDialog(CategoryEdit.aspx');";
改成
string strCommandTest = @"window.showModalDialog('CategoryEdit.aspx');";
------解决方案--------------------
探讨

引用:
string strCommandTest = @"window.showModalDialog(CategoryEdit.aspx');";
改成
string strCommandTest = @"window.showModalDialog('CategoryEdit.aspx');";


晕死,呵呵,多谢指点,确实是少了个引号,顺便请教一下一个问题……