0

我创建了动态生成的链接按钮。单击这些按钮时,我想创建一个弹出窗口。这怎么可能。

   foreach (string fileName in allFiles)
  {
      // now create the LinkButtons ...

      Panel1.Controls.Add(new LiteralControl("<div>"));
      LinkButton lb = new LinkButton();
      lb.Text = fileName;
      lb.ID = fileName;
      Session["fn"] = fileName;
      Panel1.Controls.Add(lb);
      Panel1.Controls.Add(new LiteralControl("</div>"));
      lb.PostBackUrl = ScriptManager.RegisterStartupScript(Page, typeof(Page), "New", "window.open('pdf_files.aspx');", true);


 }

它显示错误“无法将字符串转换为 void”

4

1 回答 1

0

更改lb.PostBackUrllb.OnClick

尝试这个

lb.**OnClick** += Clickedevent













private void Clickedevent (object sender, EventArgs e)
    {
        ScriptManager.RegisterStartupScript(Page, typeof(Page), "New", "window.open('pdf_files.aspx');", true);
    }
于 2013-08-22T04:55:55.973 回答