如何在asp.net中一个buttonclick改变的iframe? [英] how to change the iframe by a buttonclick in asp.net?

查看:177
本文介绍了如何在asp.net中一个buttonclick改变的iframe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页,它有一个iframe..i想要的点击按钮后签署in..the particualr的iframe将有user.aspx..but如何code来实现这个用户的背后在buttonclick .aspx.cs?我要为服务器端解决它......我已经知道,由于我在服务器端希望它javascript函数无法使用。

i have a homepage and it has a iframe..i want that after clicking the button sign in..the particualr iframe will have the user.aspx..but how to implement this in code behind of the user.aspx.cs on buttonclick?? i want work it for server side...and i have learnt that javascript function can't be used as i am wanting it in server side..

在home.aspx我的ASP按钮和iframe

my asp button and iframe in home.aspx

 <asp:Button runat="server" ID="signin" CssClass="signinbt" Text="Sign in" OnClick="signin_Click"/>
    </div>
       <iframe id ="iframestyle" src="homeframe.aspx" name="iframe_a" runat="server" style="margin-top:0px;width:100%;height:500px;"></iframe>
   </div>

我的codebehind

my codebehind

 protected void signin_Click(object sender, EventArgs e)
{
   iframstyle.Attributes["src"] = "userpage.aspx"; 
}

这里表示iframestyle不会在present上下文包含..

here showing that iframestyle doesn't contain in the present context..

推荐答案

试试这个

protected void btnChange_Click(object sender, EventArgs e)
 {
 iframestyle.Attributes["src"] = "homeframe.aspx"
 }

这篇关于如何在asp.net中一个buttonclick改变的iframe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆