我在 asp:dynamic
中有 formview
控件,我需要从服务器端在其中显示文本。
客户端:
<asp:DynamicControl ID="text1" runat="server" DataField="image_path" Mode="Edit" ClientIDMode="Static" UIHint="MultilineText" />
服务端
FileUpload tb = (FileUpload)FormView1.FindControl("FileUpload1");
DynamicControl tb1 = (DynamicControl)FormView1.FindControl("text1");
tb.SaveAs(Server.MapPath("~/images/slider/") + Path.GetFileName(tb.FileName));
TextBox linkText = new TextBox();
linkText.ID = "txtLink";
linkText.Text = "~/images/slider/" + Path.GetFileName(tb.FileName);
linkText.ClientIDMode = System.Web.UI.ClientIDMode.Static;
tb1.Controls.Add(linkText);
UpdatePanel1.Update();
}