How do I access the Radscriptmanager located in my master page from my content page.
We have been having lots of problems with Response.Redirect because of Ajax Requests, and I found an article on your site that indicated that you should use RadAjaxManager.Redirect. To do so, I need to determine if the postback is an ajax postback, which I think is done like this:
But I can't figure out how to get to the script manager tag in the content page.
I am doing this right now, but would like to do this by using the RadAjaxManager.Redirect.
I am also using a RadAjaxManager Proxy, and don't see a redirect method for the proxy.
We have been having lots of problems with Response.Redirect because of Ajax Requests, and I found an article on your site that indicated that you should use RadAjaxManager.Redirect. To do so, I need to determine if the postback is an ajax postback, which I think is done like this:
scriptManager.IsInAsyncPostBack
But I can't figure out how to get to the script manager tag in the content page.
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.CommandName.ToUpper() == "SELECT" || e.CommandName.ToUpper() == "SELECTNEWWINDOW")
{
GridDataItem item = RadGrid1.MasterTableView.Items[e.Item.ItemIndex];
string encryptedVal = Cryptography.Encrypt(item["AssetNumber"].Text);
if (e.CommandName.ToUpper() == "SELECT")
Response.Redirect(string.Format("~/Client/Asset/?id={0}", encryptedVal));
if (e.CommandName.ToUpper() == "SELECTNEWWINDOW")
Helper.RedirectPage(Page, GetType(), string.Format("~/Client/Asset/?id={0}", encryptedVal), true);
}
}
I am doing this right now, but would like to do this by using the RadAjaxManager.Redirect.
I am also using a RadAjaxManager Proxy, and don't see a redirect method for the proxy.
public static void RedirectPage(Page page, System.Type type, string url, bool openInNewWindow)
{
string urlResolved = page.ResolveUrl(url);
if (!openInNewWindow)
{
ScriptManager scriptManager = ScriptManager.GetCurrent(page);
bool isPartialPagePostback = false;
if (scriptManager != null && scriptManager.IsInAsyncPostBack)
isPartialPagePostback = true;
if (isPartialPagePostback)
ScriptManager.RegisterStartupScript(page, type, "''", "window.location.href='" + urlResolved + "'",
true);
else
HttpContext.Current.Response.Redirect(url);
}
else
{
ScriptManager.RegisterStartupScript(page, type, "''",
"window.open('" + urlResolved +
"', '', 'height=600,width=800,scrollbars=yes,resizable=yes,location=yes')",
true);
}
}