|
大致代码如下:
protected void Page_Load(object sender, EventArgs e)
{
.......(省略)
FineUI.Button btn = new FineUI.Button();
btn.ID = item;
btn.Text = method.Description;
btn.Icon = Icon.Add;
btn.Click += new EventHandler(MethodButtonScriptReference);
.......
}
public void MethodButtonScriptReference(object sender,EventArgs e)
{
(执行这里出错!)
PageContext.RegisterStartupScript(GetmethodCode());
}
public string GetmethodCode()
{
Window win = new Window();
win.ID = panelName;
win.Hidden = true;
win.EnableIFrame = true;
win.EnableResize = true;
win.WindowPosition = WindowPosition.GoldenSection;
win.Target = Target.Parent;
win.IsModal = true;
PageManager.Instance.Controls.Add(win);
string url = "~/Pages/EditPanelPage.aspx";
return win.GetShowReference(url,"新增",new Unit(600),new Unit(400));
}
调用的顺序是页面上添加一个按钮,按钮事件由服务器端处理,然后调用PageContext.RegisterStartupScript返回一段js脚本,在这里就出错了。
如果换用btn.OnClientClick = MethodButtonScriptReference(btn)使用脚本就没问题,但我希望使用事件响应函数,这样每次调用GetmethodCode()可以返回不同的脚本,请教下如何解决问个问题?
|
|