Am pulling my hair out on this...
By scenario is kind of complex, but I have a masterpage with a radajaxmanager, then a page with multiple use controls. In one of the controls, I have a button within a radgrid that I want to generate a download request:
Response.Clear()
Response.ContentType = "Application/msword"
Response.AddHeader("content-disposition", "attachment;filename=test.xml")
Response.Write(teststring)
Response.End()
Obviously, I need to disable AJAX for this postback...
In my grid, I have a GridTemplateColumm that has a btnGenerate
On the grid's ItemDataBound:
Dim sm As ScriptManager = ScriptManager.GetCurrent(Page)
sm.RegisterPostBackControl(CType(e.Item.FindControl("btnGenerate"), LinkButton))
But no matter what I try, when the Grid's ItemCommand is raised by the button, it remains an AJAX request.
Thanks,
Reuven
(I don't want to save the generated file nor run it through a handler to generate since it contains confidential data)
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="NewsTicker.ascx.cs" Inherits="UserControls_GI_NewsTicker" %>
<%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
<%@ Register TagPrefix="sfWeb" Assembly="Telerik.Libraries" Namespace="Telerik.Libraries.WebControls" %>
<
style
type
=
"text/css"
>
*+html .rrItemsList
{
float: none !important;
}
*html .rrItemsList
{
float: none !important;
}
</
style
>
<
asp:UpdatePanel
ID
=
"updatePanel"
runat
=
"server"
>
<
ContentTemplate
>
<
div
class
=
"newsHeading"
>
<
asp:Literal
runat
=
"server"
ID
=
"liLatestNews"
Text="<%$ Resources: GlobalResource, LatestNews %>"></
asp:Literal
></
div
>
<
div
class
=
"newsContents"
>
<
telerik:RadRotator
ID
=
"radRotator"
runat
=
"server"
Height
=
"30px"
Width
=
"500px"
ItemWidth
=
"500px"
ItemHeight
=
"30px"
FrameDuration
=
"3000"
RotatorType
=
"SlideShowButtons"
SlideShowAnimation-Duration
=
"3000"
SlideShowAnimation-Type
=
"Fade"
OnItemDataBound
=
"radRotator_ItemDataBound"
>
<
ControlButtons
LeftButtonID
=
"img_Left"
RightButtonID
=
"img_Right"
/>
<
ItemTemplate
>
<
asp:HyperLink
runat
=
"server"
ID
=
"hlNavigator"
>
<
asp:Literal
ID
=
"NewsTitle"
runat
=
"server"
/>
</
asp:HyperLink
>
</
ItemTemplate
>
</
telerik:RadRotator
>
</
div
>
<
div
class
=
"controls"
>
<
asp:ImageButton
ID
=
"img_Left"
runat
=
"server"
ImageUrl
=
"~/App_Themes/English/Images/back.png"
OnClick
=
"Play_Click"
/>
<
asp:ImageButton
runat
=
"server"
ID
=
"Play"
ImageUrl
=
"~/App_Themes/English/Images/pause.png"
OnClick
=
"Play_Click"
/>
<
asp:ImageButton
ID
=
"img_Right"
runat
=
"server"
ImageUrl
=
"~/App_Themes/English/Images/forward.png"
OnClick
=
"Play_Click"
/>
</
div
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
using
System.Data;
using
System.Linq;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.HtmlControls;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Xml.Linq;
using
Telerik.Web.UI;
using
System.ComponentModel;
using
Telerik.Cms.Web.UI;
using
Telerik.Cms.Engine;
using
System.Collections.Generic;
using
System.Globalization;
using
Telerik.Cms.Data;
using
System.Threading;
using
System;
using
System.Collections;
public
partial
class
UserControls_GI_NewsTicker : System.Web.UI.UserControl
{
#region Public Properties
[Category(
"Data"
)]
public
string
ProviderName
{
get
{
if
(String.IsNullOrEmpty(
this
.providerName))
this
.providerName = ContentManager.DefaultProviderName;
return
this
.providerName;
}
set
{
this
.providerName = value;
}
}
[Category(
"Filters"
)]
public
string
CategoryName
{
get
{
return
this
.categoryName;
}
set
{
this
.categoryName = value;
}
}
[Category(
"Filters"
)]
public
string
SortExpression
{
get
{
return
this
.sortExpression;
}
set
{
this
.sortExpression = value;
}
}
[Category(
"Main"
)]
[WebEditor(
"Telerik.Cms.Web.UI.CmsUrlWebEditor, Telerik.Cms"
)]
public
string
MoreInfoUrl
{
get
{
return
moreInfoUrl; }
set
{ moreInfoUrl = value; }
}
#endregion
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
IList dataSource =
null
;
if
(
this
.manager ==
null
)
this
.manager =
new
ContentManager(
this
.ProviderName);
if
(!
string
.IsNullOrEmpty(
this
.CategoryName))
{
List<IMetaSearchInfo> filter =
new
List<IMetaSearchInfo>();
// add a new filter to the list
filter.Add(
new
MetaSearchInfo(MetaValueTypes.ShortText,
"Category"
,
this
.CategoryName));
dataSource = manager.GetContent(
this
.SortExpression, filter.ToArray());
}
else
{
dataSource = manager.GetContent();
}
this
.radRotator.DataSource = dataSource;
this
.radRotator.DataBind();
radRotator.RotatorType = RotatorType.SlideShow;
}
}
private
string
moreInfoUrl;
private
ContentManager manager;
private
string
providerName =
"News"
;
private
string
categoryName;
private
string
sortExpression =
"Position Asc"
;
protected
void
radRotator_ItemDataBound(
object
sender, Telerik.Web.UI.RadRotatorEventArgs e)
{
IContent content = (IContent)e.Item.DataItem;
if
(content !=
null
)
{
HyperLink hlNav = e.Item.FindControl(
"hlNavigator"
)
as
HyperLink;
Literal newsTitle = e.Item.FindControl(
"NewsTitle"
)
as
Literal;
if
(newsTitle !=
null
)
newsTitle.Text = content.GetMetaData(
"SubTitle"
).ToString();
string
navigateTitle = content.Url.Trim();
if
(Thread.CurrentThread.CurrentUICulture.Name ==
"en"
)
hlNav.NavigateUrl =
"~/en/home/mediacentre/news/"
+ navigateTitle.Replace(
". "
,
"_"
).Replace(
" "
,
"_"
).Replace(
"("
,
""
).Replace(
")"
,
""
) +
".aspx"
;
else
hlNav.NavigateUrl =
"~/ar/home/mediacentre/news/"
+ navigateTitle.Replace(
". "
,
"_"
).Replace(
" "
,
"_"
).Replace(
"("
,
""
).Replace(
")"
,
""
) +
".aspx"
;
}
}
protected
void
Play_Click(
object
sender, ImageClickEventArgs e)
{
if
(radRotator.RotatorType == RotatorType.SlideShow)
{
radRotator.RotatorType = RotatorType.SlideShowButtons;
Play.ImageUrl =
"~/App_Themes/English/Images/play.png"
;
}
else
if
(radRotator.RotatorType == RotatorType.SlideShowButtons)
{
radRotator.RotatorType = RotatorType.SlideShow;
Play.ImageUrl =
"~/App_Themes/English/Images/pause.png"
;
}
}
}
public static int GetWeekNumber(DateTime dtPassed)
{
CultureInfo ciCurr = CultureInfo.CurrentCulture;
int weekNum = ciCurr.Calendar.GetWeekOfYear(dtPassed, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
return weekNum;
}
Does anyone know how to retrieve the Week number display in the Rad Calendar?
also,
Does anyone know how to select a week based on a Week number in the Rad Calendar?
Your response to this thread would be excellent.
Regards,
Alberto