iframe 中是另外一个页面,子页面b,子页面的按钮最后想调用父页面a的方法,如何做

plglenn27 plglenn27 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
b页面:
   protected void btnOk_Click(object sender, EventArgs e)
{
string sum = "";
for (int i = 0; i < Repeater1.Items.Count; i++)
{
CheckBox cb = (CheckBox)Repeater1.Items[i].FindControl("CheckBox1");
if (cb.Checked)
{
sum += cb.ToolTip + "_" + cb.Text + "ttttt";
}
}
if (sum.Length > 2)
{
sum = sum.Substring(0, sum.Length - 6);
}
Session["Sight"] = sum;
Page.ClientScript.RegisterStartupScript(this.GetType(), "Begin", " <script>ymPrompt.close();top.document.all.btnOk.btnOk_Click (); </script>");


}

b页面最后调用a页面的BindRepeater()方法。


private void BindRepeater()
{
try
{


//if (Session["Sight"]==null )
//{
// return;
//}
string sum = Session["Sight"].ToString();
if (sum.Length < 2)
{
return;
}
DataTable dt = new DataTable();
dt.Columns.Add("SightName", typeof(string));
dt.Columns.Add("SightId", typeof(int));

Regex r = new Regex("ttttt");
foreach (string item in r.Split(sum))
{
DataRow dr = dt.NewRow();
dr["SightId"] =Convert.ToInt32( item.Substring(0, item.IndexOf('_') ));
dr["SightName"] = item.Substring(item.IndexOf('_')+1);
dt.Rows.Add(dr);
}
Repeater2.DataSource = dt;
Repeater2.DataBind();
}
catch (Exception err)
{


}

}

...全文

相关推荐

评论 8
收藏 已收藏
分享
返回顶部
plglenn27
.NET社区 62,275 成员 668,968 内容