这是就是从已上传过的图片库中选择的,和图片素材管理界面的功能基本相似,只不过多了一个确认选择的按钮,因为确认选择了之后,要关闭本页,回到新建图文页面,主要代码:
/// <summary> /// 确认选择,选中之后,跳转至新建图文页面 /// </summary> /// <param></param> /// <param></param> protected void LinkBtnSubMitSelected_Click(object sender, EventArgs e) { Boolean bools = false; int num = 0; foreach (DataListItem item in this.DLSuCaiImageList.Items) { CheckBox checkIn = item.FindControl("CheckIn") as CheckBox; if (checkIn.Checked) { num += 1; bools = true; } } if (!bools) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "", "alert('请选择一个图片素材!!!')", true); return; } if (num >= 2) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "", "alert('您只能选择一个图片素材!');", true); return; } else { foreach (DataListItem item in this.DLSuCaiImageList.Items) { CheckBox checkIn = item.FindControl("CheckIn") as CheckBox; if (checkIn.Checked) { ///获取选中图片media_id Label lbmedia_ID = item.FindControl("lbmedia_ID") as Label; Session["imgmedia_id"] = lbmedia_ID.Text.ToString(); Response.Write("<script>alert('已选择!');window.opener.location.reload();window.close();</script>"); } } } }
新建图文的页面在接收的时候可以这样: