Posted on Apr 30, 2012 (permalink)
Reply
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
"server"
>
AjaxSettings
telerik:AjaxSetting
AjaxControlID
"RadGrid1"
UpdatedControls
telerik:AjaxUpdatedControl
ControlID
/>
"Button1"
</
Posted on May 2, 2012 (permalink)
Response.ClearContent()
Response.ContentType =
"application/vnd.xls"
Response.AppendHeader(
"Content-Disposition", "attachment; filename=" & OnlyName)
Response.TransmitFile(filename)
Response.End() the above code does not seem to work. this is on the same page where I have my Radgrid. What could be the work around for this? Thanks
Posted on May 7, 2012 (permalink)
ClientEvents
OnRequestStart
"onRequestStart"
<script type=
"text/javascript"
function
onRequestStart(sender, args)
{
if
(args.get_eventTarget().indexOf(
"lnkDownload"
) >= 0)
args.set_enableAjax(
false
);
}
</script>
MasterTableView
DataKeyNames
"ID"
Columns
telerik:GridBoundColumn
DataField
UniqueName
HeaderText
telerik:GridTemplateColumn
ItemTemplate
asp:LinkButton
Text
"Download sample excel file"
OnClick
"lnkDownload_Click"
CausesValidation
"false"
></
protected
void
lnkDownload_Click(
object
sender, EventArgs e)
// you can access your grid row
Button lnkDownload = sender
as
Button;
GridDataItem item = lnkDownload.NamingContainer
GridDataItem;
string
str1 = item.GetDataKeyValue(
).ToString();
// by datakey ID
str2 = item[
].Text;
// by column name
try
path = Server.MapPath(
"~/filepath/YourFilename.xlsx"
attachment =
"attachment; filename=yourfilename.xlsx"
;
Response.Clear();
Response.AddHeader(
"content-disposition"
, attachment);
"text/plain"
Response.WriteFile(path);
Response.End();
catch
(Exception ex)
Posted on May 8, 2012 (permalink)
Back to Top
[ ASP.NET Grid Features | Documentation | Demos | Step-by-step Tutorial ]
UI controls for ASP.NET AJAX, MVC, WPF,Silverlight, Windows 8 and Windows Phone
Cross-platform Mobile Development Toolwith cloud-based architecture
Everything you need to build sites andmobile apps with JavaScript and HTML5
One easy tool for Functional, Performance,Load and Mobile software testing
Everything for your online business - contentmanagement, ecommerce, emarketing
Simple and intuitive project managementand collaboration software