我在index.aspx 中用了iframe 内嵌了 b.aspx,如何在b.aspx中点击linkbutton 控制index.aspx 中的一个input内的值?
这是我的index.aspx中的一段html代码:
<form id="perfectform1" method="post" runat="server">
<asp:TableCell>
<iframe name="ad" frameborder="0" width="100%" height="30" scrolling="no" src="b.aspx">
</iframe>
</asp:TableCell>
<asp:TableRow AccessKey="Y">
<asp:TableCell ColumnSpan="2">
<input name="oneimg">
</asp:TableCell>
</asp:TableRow>
</form>
我的 b.aspx.cs中的
protected void button_click_upload(Object sender, EventArgs e)
{
Response.Write("<"+"script>parent.perfectform1.oneimg.value+='"+FN+"'</"+"script>");
}
这里的button_click 里的程序是好使的,它能使 index.aspx中名称为oneimg的input值为变量 "FN"的值。但是我同样在 b.aspx.cs中定义了一个linkbutton我想清空oneimg的input值,却为什么不启作用,如下:
private void Page_Load(object sender, System.EventArgs e)
{
LinkButton myLinkButton = new LinkButton(); //实例化一个 linkbutton
myLinkButton.ID = "myLink";
myLinkButton.Text = "清空";
myLinkButton.Visible=false;
myLinkButton.Click += new EventHandler(this.Process);
this.Controls[1].Controls.Add(myLinkButton);
}
private void Process(object sender,EventArgs e)
{
//如何加上清空index.aspx中名称为oneimg的input值
upload_file.Visible=true;
Button1.Visible=true;
((LinkButton)FindControl("myLink")).Visible=false; //让linkbutton不可见
Info.Visible=false;
}
请大家帮我看看应该如何把那段清空的程序加上,非常感谢!!