Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
sTableName = "" & e.Item.OwnerTableView.Name
Select Case sTableName
Case "Noms"
Select Case e.CommandName
Case "EditAll"
' Edit All button pressed. Reset any rows in Insert mode
e.Item.OwnerTableView.IsItemInserted = False
'Code to add records to Database is here.
' Put all rows in Edit mode
e.Item.Edit = True
End Select
End Select
End Sub
Hello
I am trying to get RadScriptManager to work on a page in conjunction with controls from the Ajax Control Toolkit. The website runs under .NET 3.5, and I have a version of the ACT DLL that is built on a .NET 3.5 reference.
Specifically, I have Telerik.Web.UI v2011.3.1115.35, with an AnimationExtender from ACT v3.5.40412.2. I have all the DLLs correctly referenced, and no errors are reported, but the AnimationExtender does not appear to be working - it is not responsive to any mouse events. As I understand the issue, I need the RadScriptManager from Telerik.Web.UI to substitute for the ToolkitScriptManager from ACT. On that basis, I found the forum posting shown here:
http://www.telerik.com/community/forums/aspnet-ajax/scriptmanager-and-stylesheetmanager/fix-radscriptmanager-compatibility-issues-with-ajax-control-toolkit.aspx
This post looks as if it might go some way to addressing my objective. However, I need to carry out the script reference customization programmatically. Hence, I managed to come up with the following code to run on Page_Load, where radsm is the declared RadScriptManager control ...
radsm.EnableScriptCombine = False
radsm.Scripts.Add(New ScriptReference( _
"MicrosoftAjax.js", _
"System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"))
radsm.Scripts.Add(New ScriptReference( _
"MicrosoftAjaxWebForms.js", _
"System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"))
The problem is this code does not seem to solve my issue. Where could I be going wrong? Is this combination of libraries and controls even possible? Can the RadScriptManager be manipulated in this way programmatically?
If you could provide me with some pointers of the right direction to work in, that would be really useful.
Thanks very much
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"HeadContent"
Runat
=
"Server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"BodyContent"
Runat
=
"Server"
>
<
asp:UpdatePanel
ID
=
"udp1"
runat
=
"server"
>
<
Triggers
>
<
asp:AsyncPostBackTrigger
ControlID
=
"lnkDisplay"
/>
</
Triggers
>
<
ContentTemplate
>
<
asp:Panel
ID
=
"pnlPick"
Runat
=
"server"
>
<
table
width
=
"100%"
>
<
tr
>
<
td
align
=
"center"
width
=
"100%"
>Pick Deployment:
<
asp:DropDownList
id
=
"ddlDeployment"
Runat
=
"server"
Width
=
"160"
AutoPostBack
=
"True"
></
asp:DropDownList
>
Pick BN: <
asp:DropDownList
id
=
"ddlBn"
Runat
=
"server"
Width
=
"120"
AutoPostBack
=
"True"
></
asp:DropDownList
>
Pick Uic: <
asp:DropDownList
id
=
"ddlUic"
Runat
=
"server"
Width
=
"120"
AutoPostBack
=
"true"
></
asp:DropDownList
>
<
asp:Button
ID
=
"btnPanel"
runat
=
"server"
style
=
"display:none"
/>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"center"
><
asp:LinkButton
ID
=
"lnkDisplay"
Runat
=
"server"
CausesValidation
=
"True"
>Display DMD</
asp:LinkButton
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"height:10px"
></
td
>
</
tr
>
</
table
>
</
asp:Panel
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
<
asp:UpdatePanel
ID
=
"udp2"
runat
=
"server"
>
<
ContentTemplate
>
<
asp:Panel
ID
=
"pnlgrid"
runat
=
"server"
Visible
=
"false"
>
<
table
width
=
"100%"
>
<
tr
>
<
td
align
=
"center"
>
<
telerik:RadGrid
ID
=
"myRadGrid"
runat
=
"server"
Width
=
"98%"
BorderWidth
=
"1px"
CellPadding
=
"6"
GridLines
=
"None"
BorderColor
=
"#404040"
Skin
=
"Web20"
>
<
ExportSettings
ExportOnlyData
=
"true"
FileName
=
"DonorSlots"
IgnorePaging
=
"true"
OpenInNewWindow
=
"true"
></
ExportSettings
>
<
MasterTableView
AutoGenerateColumns
=
"false"
Name
=
"MasterGrid"
BorderColor
=
"#404040"
Font-Size
=
"9"
Font-Names
=
"Veranda,arial,sans-serif"
HeaderStyle-HorizontalAlign
=
"Center"
GridLines
=
"Both"
BorderWidth
=
"1px"
CommandItemDisplay
=
"Top"
EditMode
=
"EditForms"
>
<
CommandItemSettings
ShowAddNewRecordButton
=
"false"
ShowRefreshButton
=
"false"
ShowExportToExcelButton
=
"false"
/><
AlternatingItemStyle
BackColor
=
"#B0C4DE"
HorizontalAlign
=
"Center"
/>
<
ItemStyle
HorizontalAlign
=
"Center"
/><
HeaderStyle
ForeColor
=
"White"
Font-Bold
=
"true"
BorderColor
=
"#404040"
BorderWidth
=
"1px"
/>
<
CommandItemTemplate
>
<
table
width
=
"100%"
>
<
tr
>
<
td
align
=
"right"
><
asp:Button
ID
=
"btnExport"
runat
=
"server"
CommandName
=
"ExportToExcel"
Text
=
"Export Excel"
/></
td
>
</
tr
>
</
table
>
</
CommandItemTemplate
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Unit"
HeaderText
=
"Unit"
/>
<
telerik:GridBoundColumn
DataField
=
"Para\Line\Pos"
HeaderText
=
"Para\Line\Pos"
/>
<
telerik:GridBoundColumn
DataField
=
"Posn_title"
HeaderText
=
"Posn_Title"
/>
<
telerik:GridBoundColumn
DataField
=
"Name"
HeaderText
=
"Name"
/>
<
telerik:GridBoundColumn
DataField
=
"Rank"
HeaderText
=
"Rank"
/>
<
telerik:GridBoundColumn
DataField
=
"SSN"
HeaderText
=
"SSN"
/>
<
telerik:GridBoundColumn
DataField
=
"Grade"
HeaderText
=
"Grade"
/>
<
telerik:GridBoundColumn
DataField
=
"DMOS"
HeaderText
=
"Duty_Posn"
/>
<
telerik:GridBoundColumn
DataField
=
"REQCLR"
HeaderText
=
"Req Clr"
/>
<
telerik:GridBoundColumn
DataField
=
"PassPortDT"
HeaderText
=
"Pass_Port_DT"
/>
<
telerik:GridBoundColumn
DataField
=
"MobDay"
HeaderText
=
"Mob Days Cottad"
/>
<
telerik:GridBoundColumn
DataField
=
"SCTYDT"
HeaderText
=
"Scty_Dt"
/>
<
telerik:GridBoundColumn
DataField
=
"PHY_EXAM_DT"
HeaderText
=
"Phy_Exam_DT"
/>
<
telerik:GridBoundColumn
DataField
=
"MRD\ETS"
HeaderText
=
"Ets\Mrd"
/>
<
telerik:GridBoundColumn
DataField
=
"SRP_DT"
HeaderText
=
"Srp_DT"
/>
<
telerik:GridBoundColumn
DataField
=
"CLS"
HeaderText
=
"Cls Trained"
/>
<
telerik:GridBoundColumn
DataField
=
"Profile"
HeaderText
=
"P3\P4 Profile"
/>
<
telerik:GridBoundColumn
DataField
=
"Cleared"
HeaderText
=
"Mmrp|Peb|Meb Cleared"
/>
<
telerik:GridBoundColumn
DataField
=
"Remarks"
HeaderText
=
"Remarks"
/>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
td
>
</
tr
>
</
table
>
</
asp:Panel
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
</
asp:Content
>
<
telerik:RadChart
ID
=
"RadChart1"
runat
=
"server"
DefaultType
=
"StackedBar"
>
<
PlotArea
>
<
YAxis
MaxValue
=
"300"
Step
=
"10"
AutoScale
=
"True"
AxisMode
=
"Extended"
>
</
YAxis
>
</
PlotArea
>
<
Series
>
</
Series
>
</
telerik:RadChart
>
string
sql =
string
.Format(
"..."
);
DataTable openLeads = db.FillTable(sql);
if
(openLeads.Rows.Count > 0)
{
RadChart1.DataSource = openLeads;
foreach
(DataRow row
in
openLeads.Rows)
{
ChartSeries chrtSeries =
new
ChartSeries {Name = row[
"Description"
].ToString()};
chrtSeries.Type = ChartSeriesType.StackedBar;
RadChart1.SeriesOrientation = ChartSeriesOrientation.Vertical;
RadChart1.Series.Add(chrtSeries);
}
RadChart1.PlotArea.XAxis.DataLabelsColumn =
"UserName"
;
RadChart1.DataBind();
}
<
telerik:GridAttachmentColumn
MaxFileSize
=
"1048576"
EditFormHeaderTextFormat
=
"Download File:"
HeaderText
=
"Download"
AttachmentKeyFields
=
"AudioID"
FileNameTextField
=
"AudioPath"
DataTextField
=
"SongTitle"
UniqueName
=
"AttachmentColumn"
>
</
telerik:GridAttachmentColumn
>
<
ClientSettings
>
<
ClientEvents
OnCommand
=
"gridCommand"
/>
</
ClientSettings
>
function gridCommand(sender, args) {
if (args.get_commandName() == "DownloadAttachment") {
var manager = $find('<%= RadAjaxManager.GetCurrent(Page).ClientID %>');
manager.set_enableAJAX(false);
setTimeout(function () {
manager.set_enableAJAX(true);
}, 0);
}
}
protected void RadGridAudio_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.DownloadAttachmentCommandName)
{
e.Canceled = true;
GridDownloadAttachmentCommandEventArgs args = e as GridDownloadAttachmentCommandEventArgs;
string fileName = args.FileName;
long attachmentId = (int)args.AttachmentKeyValues["AudioID"];
BusinessLayer.RegistrationAudio audio = new RegistrationAudio();
audio = registrationManager.GetRegistrationAudio(attachmentId);
string filePath = audio.AudioPath.Substring(0, audio.AudioPath.LastIndexOf(@"\"));
string _DownloadableProductFileName = audio.FileName;
if (audio.AudioPath != null && audio.FileName != null)
{
System.IO.FileInfo FileName = new System.IO.FileInfo(filePath + "\\" + _DownloadableProductFileName);
FileStream myFile = new FileStream(filePath + "\\" + _DownloadableProductFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
try
{
if (FileName.Exists)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;attachment; filename=\"" + FileName.Name + "\"");
HttpContext.Current.Response.AddHeader("Content-Length", FileName.Length.ToString());
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.TransmitFile(FileName.FullName);
HttpContext.Current.Response.Flush();
}
else
{
throw new Exception("File not found");
}
}
catch (Exception ex)
{
HttpContext.Current.Response.ContentType = "text/plain";
HttpContext.Current.Response.Write(ex.Message);
}
finally
{
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
}
}
}
function resize() {
if (grid) {
var w = document.documentElement.clientWidth;
var h = document.documentElement.clientHeight -100;
grid.get_element().style.height = h + "px";
grid.repaint();
}
}