using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Help_Filter : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["FilterValue"] == null)
Session.Remove("FilterValue");
else
Session["FilterValue"] = Request.QueryString["FilterValue"];
if (Session["FilterValue"] != null)
{
string test = Session["FilterValue"].ToString();
string strscript = "<script language=javascript> parent.parent.GB_hide(); </script>";
//if (window.opener && !window.opener.closed) { window.opener.location.reload(); } </script>";
//window.top.close();
if (!ClientScript.IsStartupScriptRegistered("clientScript"))
ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strscript);
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
GridView d = (GridView)sender;
string valueSelected = d.SelectedRow.Cells[0].Text;
Session["FilterValue"] = valueSelected;
string strscript = "<script language=javascript> parent.parent.GB_hide(); </script>";
//if (window.opener && !window.opener.closed) { window.opener.location.reload(); } </script>";
//window.top.close();
if (!ClientScript.IsStartupScriptRegistered("clientScript"))
ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strscript);
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#ceedfc'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=''");
e.Row.Attributes.Add("style", "cursor:pointer;");
e.Row.Attributes.Add("onclick", "location='PreviousFilter.aspx?FilterValue=" + e.Row.Cells[0].Text + "'");
}
}
}
Tuesday, 25 May 2010
ASP .NET: recall page through gridview selection
ASP .Net: Greybox close and refresh parent
There are several steps to this process.
1. Create function in Master page to create new window reload
2. Call class
3. Close parent window
parent.parent.GB_hide();
1. Create function in Master page to create new window reload
<script type="text/javascript">
GB_myShow = function(caption, url, height, width, is_reload_on_close) {
var options = {
caption: caption,
height: height || 500,
width: width || 500,
fullscreen: false,
overlay_click_close: true,
show_loading: true,
reload_on_close: is_reload_on_close || false,
center_win: true
}
win = new GB_Window(options);
return win.show(url);
}
</script>
2. Call class
<a href="Help/PreviousFilter.aspx" onclick="return GB_myShow('Previous Filters', this.href, 330,500, true)" style="color:Blue;"><img src="graphics/Search.png" height="16px" title="Previous Filters" alt="#" /></a>
3. Close parent window
parent.parent.GB_hide();
parent.parent.GB_hide();
<div class="viewcode">
string test = Session["FilterValue"].ToString();
string strscrip
Publish Post
t = "<script language=javascript> parent.parent.GB_hide(); </script>";
//if (window.opener && !window.opener.closed) { window.opener.location.reload(); } </script>";
//window.top.close();
if (!ClientScript.IsStartupScriptRegistered("clientScript"))
ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strscript);
</div>
Friday, 21 May 2010
Subscribe to:
Posts (Atom)