在当前页面弹出对话框,请教错在哪呢?
.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');";
[解决办法]