I am trying to save multiple files to my database, and for whatever reason, it is not doing so. Any help will be greatly appreciated.
ASP:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CAF_Detail.aspx.cs" Inherits="DetailViews_CAF_Detail" MasterPageFile="~/EUEMain.master" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"cphLeftNav"
runat
=
"Server"
>
<
asp:HyperLink
ID
=
"HomeLink"
runat
=
"server"
NavigateUrl
=
"..\Default.aspx"
Text
=
"Home"
/>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"cphContent"
runat
=
"Server"
>
<
h1
>CAF Tracking System</
h1
>
<
telerik:RadScriptManager
runat
=
"server"
ID
=
"RadScriptManager1"
/>
<
h7
>Please make sure to leave your initials at the end of any comments you make.</
h7
>
<
h5
> </
h5
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock2"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
var manager;
Sys.Application.add_load(function () {
manager = $find('<%= RadAjaxManager.GetCurrent(Page).ClientID %>');
});
</
script
>
</
telerik:RadCodeBlock
>
<
script
type
=
"text/javascript"
src
=
"../DetailViews/Scripts.js"
></
script
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid2"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid2"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
>
</
telerik:RadAjaxLoadingPanel
>
<
div
>
<
telerik:RadGrid
ID
=
"RadGrid2"
DataSourceID
=
"SqlDataSource1"
AllowPaging
=
"False"
Width
=
"100%"
runat
=
"server"
AutoGenerateColumns
=
"False"
AllowSorting
=
"True"
AllowAutomaticInserts
=
"true"
AllowAutomaticUpdates
=
"true"
OnItemDataBound
=
"RadGrid2_ItemDataBound"
OnItemCommand
=
"RadGrid2_ItemCommand"
OnUpdateCommand
=
"RadGrid2_OnUpdateCommand"
>
<
MasterTableView
DataKeyNames
=
"Unique, ChangeLog"
AutoGenerateColumns
=
"False"
CommandItemDisplay
=
"Top"
DataSourceID
=
"SqlDataSource1"
EditMode
=
"EditForms"
>
<
NestedViewTemplate
>
<
asp:Panel
runat
=
"server"
ID
=
"InnerContainer"
Visible
=
"False"
></
asp:Panel
>
<
telerik:RadMultiPage
runat
=
"server"
ID
=
"Multipage1"
SelectedIndex
=
"0"
RenderSelectedPageOnly
=
"False"
>
<
telerik:RadPageView
runat
=
"server"
ID
=
"Details"
>
<
asp:Label
ID
=
"Label1"
Font-Bold
=
"true"
Font-Italic
=
"true"
Text='<%# Bind("Unique") %>'
Visible="False" runat="server"></
asp:Label
>
<
telerik:RadGrid
runat
=
"server"
ID
=
"SubNotesGrid"
DataSourceID
=
"SqlDataSource3"
ShowFooter
=
"true"
AllowSorting
=
"true"
EnableLinqExpressions
=
"false"
>
<
MasterTableView
ShowHeader
=
"true"
AutoGenerateColumns
=
"False"
AllowPaging
=
"true"
DataKeyNames
=
"Unique, Changelog"
PageSize
=
"25"
HierarchyLoadMode
=
"Client"
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"CAF_Number"
DataField
=
"CAF_Number"
HeaderText
=
"CAF Number"
AllowFiltering
=
"false"
/>
<
telerik:GridBoundColumn
UniqueName
=
"CAF_Rev"
DataField
=
"CAF_Rev"
HeaderText
=
"Revision"
/>
<
telerik:GridBoundColumn
UniqueName
=
"CAF_Approved"
DataField
=
"CAF_Approved"
HeaderText
=
"Approved"
/>
<
telerik:GridBoundColumn
UniqueName
=
"CAF_System"
DataField
=
"CAF_System"
HeaderText
=
"CAF System"
/>
<
telerik:GridBoundColumn
UniqueName
=
"CAF_Build"
DataField
=
"CAF_Build"
HeaderText
=
"Build"
/>
<
telerik:GridBoundColumn
UniqueName
=
"CAF_BNSF"
DataField
=
"CAF_BNSF"
HeaderText
=
"Affecting BNSF"
/>
<
telerik:GridBoundColumn
UniqueName
=
"CAF_Desc"
DataField
=
"CAF_Desc"
HeaderText
=
"CAF Description"
AllowFiltering
=
"False"
/>
<
telerik:GridBoundColumn
UniqueName
=
"CAF_Post_Date"
DataField
=
"CAF_Post_Date"
HeaderText
=
"Post Date"
DataFormatString
=
"{0:MM/dd/yyyy}"
/>
<
telerik:GridBoundColumn
UniqueName
=
"CAF_Due_Date"
DataField
=
"CAF_Due_Date"
HeaderText
=
"Due Date"
DataFormatString
=
"{0:MM/dd/yyyy}"
/>
<
telerik:GridBoundColumn
UniqueName
=
"Target_Date"
DataField
=
"Target_Date"
HeaderText
=
"Target Review Date"
DataFormatString
=
"{0:MM/dd/yyyy}"
/>
<
telerik:GridBoundColumn
UniqueName
=
"Comments"
DataField
=
"Comments"
HeaderText
=
"Comments"
/>
<
telerik:GridBoundColumn
UniqueName
=
"ChangeLog"
DataField
=
"ChangeLog"
HeaderText
=
"ChangeLog"
/>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"SqlDataSource3"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings: PtcDbModelEntities %>"
SelectCommand="SELECT * FROM [PtcDbTracker].[dbo].[CAFTable] as t0
Inner join [PtcDbTracker].[dbo].[CafFileTable] as t1 on t0.[Unique] = t1.[Unique1] where t0.[Unique] = @Unique">
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"Label1"
Name
=
"Unique"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
</
telerik:RadPageView
>
</
telerik:RadMultiPage
>
</
NestedViewTemplate
>
<
Columns
>
<
telerik:GridEditCommandColumn
/>
<
telerik:GridBoundColumn
UniqueName
=
"CAF_Number"
DataField
=
"CAF_Number"
HeaderText
=
"CAF Number"
AllowFiltering
=
"false"
/>
<
telerik:GridTemplateColumn
UniqueName
=
"CAF_Desc"
DataField
=
"CAF_Desc"
HeaderText
=
"Description"
AllowFiltering
=
"False"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"caf_desc"
Text='<%# Bind("CAF_Desc") %>' Width="350px"></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:TextBox
runat
=
"server"
ID
=
"CAF_Desc_TextBox"
Width
=
"300px"
Height
=
"75px"
Text='<%# Bind("CAF_Desc") %>' Wrap="True" TextMode="MultiLine"></
asp:TextBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"CAF_System"
Visible
=
"False"
HeaderText
=
"System"
>
<
EditItemTemplate
>
<
asp:DropDownList
ID
=
"Label6"
runat
=
"server"
SelectedValue='<%# Bind("CAF_System") %>'
DataSource='<%# (new[] { "OB", "BOS", "EM"}) %>'
AppendDataBoundItems="True"
CausesValidation="False">
<
asp:ListItem
Selected
=
"True"
Text
=
"Select"
Value
=
""
>
</
asp:ListItem
>
</
asp:DropDownList
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"CAF_Rev"
DataField
=
"CAF_Rev"
HeaderText
=
"Revision"
Visible
=
"True"
/>
<
telerik:GridTemplateColumn
UniqueName
=
"Comments"
DataField
=
"Comments"
HeaderText
=
"Comments"
AllowFiltering
=
"False"
Visible
=
"False"
>
<
EditItemTemplate
>
<
asp:TextBox
runat
=
"server"
ID
=
"Comments_TextBox"
Width
=
"400px"
Height
=
"150px"
Text='<%# Bind("Comments") %>' Wrap="True" TextMode="MultiLine"></
asp:TextBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridDateTimeColumn
UniqueName
=
"CAF_Post_Date"
DataField
=
"CAF_Post_Date"
PickerType
=
"DatePicker"
HeaderText
=
"Post Date"
Visible
=
"False"
/>
<
telerik:GridDateTimeColumn
UniqueName
=
"CAF_Due_Date"
DataField
=
"CAF_Due_Date"
PickerType
=
"DatePicker"
Visible
=
"False"
HeaderText
=
"Due Date"
/>
<
telerik:GridDateTimeColumn
UniqueName
=
"Target_Date"
DataField
=
"Target_Date"
PickerType
=
"DatePicker"
Visible
=
"True"
HeaderText
=
"Target Review Date"
/>
<
telerik:GridBoundColumn
UniqueName
=
"CAF_Build"
DataField
=
"CAF_Build"
Visible
=
"False"
HeaderText
=
"Build"
/>
<
telerik:GridTemplateColumn
UniqueName
=
"CAF_BNSF"
Visible
=
"True"
HeaderText
=
"Affecting BNSF"
>
<
EditItemTemplate
>
<
asp:DropDownList
ID
=
"Label5"
runat
=
"server"
SelectedValue='<%# Bind("CAF_BNSF") %>'
DataSource='<%# (new[] { "None", "Low", "Medium", "High"}) %>'
AppendDataBoundItems="True"
CausesValidation="False">
<
asp:ListItem
Selected
=
"True"
Text
=
"Select"
Value
=
""
>
</
asp:ListItem
>
</
asp:DropDownList
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"CAF_Approved"
DataField
=
"CAF_Approved"
Visible
=
"True"
HeaderText
=
"Approved"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"caf_approved"
Text='<%#Bind("CAF_Approved") %>'></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:DropDownList
ID
=
"Label12"
runat
=
"server"
SelectedValue='<%# Bind("CAF_Approved") %>'
DataSource='<%# (new[] { "Approved", "Not Approved"}) %>'
AppendDataBoundItems="True"
CausesValidation="False">
<
asp:ListItem
Selected
=
"True"
Text
=
"Select"
Value
=
""
>
</
asp:ListItem
>
</
asp:DropDownList
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridAttachmentColumn
SortExpression
=
"FileName"
UploadControlType
=
"RadAsyncUpload"
DataSourceID
=
"SqlDataSource5"
EditFormHeaderTextFormat
=
"Upload File:"
HeaderText
=
"Attachment Column"
AttachmentDataField
=
"BinaryData"
AttachmentKeyFields
=
"Unique"
FileNameTextField
=
"FileName"
DataTextField
=
"FileName"
UniqueName
=
"AttachmentColumn"
/>
<
telerik:GridBoundColumn
UniqueName
=
"ChangeLog"
DataField
=
"ChangeLog"
HeaderText
=
"ChangeLog"
ReadOnly
=
"True"
Visible
=
"True"
/>
<%-- <
telerik:GridAttachmentColumn
SortExpression
=
"FileName2"
UploadControlType
=
"RadAsyncUpload"
DataSourceID
=
"SqlDataSource6"
EditFormHeaderTextFormat
=
"Upload File:"
HeaderText
=
"Additional Attachment"
AttachmentDataField
=
"BinaryData2"
AttachmentKeyFields
=
"Unique"
FileNameTextField
=
"FileName2"
DataTextField
=
"FileName2"
UniqueName
=
"AttachmentColumn2"
/>--%>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
ClientEvents
OnCommand
=
"gridCommand"
></
ClientEvents
>
</
ClientSettings
>
</
telerik:RadGrid
>
<
br
/>
</
div
>
<%--OnInserted="SqlDataSource2_Inserted"
OnUpdated="SqlDataSource2_Updated"--%>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings: PtcDbModelEntities %>"
InsertCommand="INSERT INTO [PtcDbTracker].[dbo].[CAFTable] ([CAF_Number], [CAF_System], [CAF_Rev], [CAF_Build], [CAF_BNSF], [CAF_Desc], [Comments]
, [CAF_Post_Date], [CAF_Due_Date], [Target_Date], [CAF_Approved])
VALUES (@CAF_Number, @CAF_System, @CAF_Rev, @CAF_Build, @CAF_BNSF, @CAF_Desc, @Comments, @CAF_Post_Date, @CAF_Due_Date, @Target_Date, @CAF_Approved) SET @InsertedID = SCOPE_IDENTITY()"
SelectCommand="SELECT * FROM [PtcDbTracker].[dbo].[CAFTable] as t0
Inner join [PtcDbTracker].[dbo].[CafFileTable] as t1 on t0.[Unique] = t1.Unique1 Order By [CAF_Number] DESC, [CAF_Rev] DESC"
UpdateCommand="UPDATE [PtcDbTracker].[dbo].[CAFTable]
SET [CAF_Number] = @CAF_Number
, [CAF_System] = @CAF_System
, [CAF_Rev] = @CAF_Rev
, [CAF_Build] = @CAF_Build
, [CAF_BNSF] = @CAF_BNSF
, [CAF_Desc] = @CAF_Desc
, [Comments] = @Comments
, [CAF_Due_Date] = @CAF_Due_Date
, [CAF_Post_Date] = @CAF_Post_Date
, [CAF_Approved] = @CAF_Approved
WHERE [Unique] = @Unique">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"Unique"
Type
=
"Int32"
></
asp:Parameter
>
</
DeleteParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"CAF_Number"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_System"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_Rev"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_Build"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_BNSF"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_DESC"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"Comments"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_Post_Date"
DbType
=
"Date"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_Due_Date"
DbType
=
"Date"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"Target_Date"
DbType
=
"Date"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_Approved"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"ChangeLog"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"InsertedID"
Type
=
"Int32"
Direction
=
"Output"
></
asp:Parameter
>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"CAF_Number"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_System"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_Rev"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_Build"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_BNSF"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_DESC"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"Comments"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_Post_Date"
DbType
=
"Date"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_Due_Date"
DbType
=
"Date"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"Target_Date"
DbType
=
"Date"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CAF_Approved"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"ChangeLog"
Type
=
"String"
/>
</
UpdateParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"SqlDataSource5"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:PtcDbModelEntities %>"
SelectCommand="SELECT t1.[Unique1], t1.[BinaryData] FROM [PtcDbTracker].[dbo].[CAFTable] as t0
Inner join [PtcDbTracker].[dbo].[CafFileTable] as t1 on t0.[Unique] = t1.Unique1 WHERE t1.[Unique1] = @Unique">
<
SelectParameters
>
<
asp:Parameter
Name
=
"Unique"
Type
=
"Int32"
></
asp:Parameter
>
</
SelectParameters
>
</
asp:SqlDataSource
>
</
asp:Content
>
And C#:
using
System.Collections;
using
System.Runtime.InteropServices;
using
System.Text;
using
Telerik.Web.UI;
using
System;
using
xi = Telerik.Web.UI.ExportInfrastructure;
using
System.Web.UI.WebControls;
using
System.Configuration;
using
System.Data.SqlClient;
using
System.IO;
using
MultipleFileSelection = Telerik.Web.UI.AsyncUpload.MultipleFileSelection;
public
partial
class
DetailViews_CAF_Detail : BNSF.EUECommonApplication.EUEBasePage
{
int
fileId;
byte
[] fileData;
string
fileName;
string
mystring1;
private
string
oldChangeLogValue;
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
}
}
protected
void
RadGrid2_ItemDataBound(
object
sender, GridItemEventArgs e)
{
var editItem = e.Item
as
GridEditFormItem;
if
(editItem !=
null
&& editItem.IsInEditMode)
{
var datePicker = editItem[
"CAF_Post_Date"
].Controls[0]
as
RadDatePicker;
datePicker.Width = Unit.Pixel(100);
var datePicker2 = editItem[
"CAF_Due_Date"
].Controls[0]
as
RadDatePicker;
datePicker2.Width = Unit.Pixel(100);
var datePicker3 = editItem[
"Target_Date"
].Controls[0]
as
RadDatePicker;
datePicker3.Width = Unit.Pixel(100);
var attachment = editItem[
"AttachmentColumn"
].Controls[0]
as
RadAsyncUpload;
attachment.MultipleFileSelection = MultipleFileSelection.Automatic;
}
}
protected
void
RadAsyncUpload1_FileUploaded1(
object
sender, FileUploadedEventArgs e)
{
string
path = Server.MapPath(
"~/Uploads/"
);
e.File.SaveAs(path + e.File.GetName());
}
protected
void
SqlDataSource2_Inserted(
object
sender, SqlDataSourceStatusEventArgs e)
{
var mystring =
new
StringBuilder();
mystring.Append(EUEUser.DisplayName +
' '
+ DateTime.Now);
fileId = (
int
)e.Command.Parameters[
"@InsertedID"
].Value;
UpdateFileData(
"UPDATE [PtcDbTracker].[dbo].[CAFTable] SET [ChangeLog] = @Changelog WHERE [Unique] = @Unique"
, fileId, mystring.ToString());
}
protected
void
SqlDataSource2_Updated(
object
sender, SqlDataSourceStatusEventArgs e)
{
var mystring =
new
StringBuilder(oldChangeLogValue +
"<br />"
);
mystring.AppendLine(EUEUser.DisplayName +
' '
+ DateTime.Now);
UpdateFileData(
"UPDATE [PtcDbTracker].[dbo].[CAFTable] SET [ChangeLog] = @ChangeLog WHERE [Unique] = @Unique"
, fileId, mystring.ToString());
}
private
void
UpdateFileData(
string
command,
int
fileId,
string
mystring)
{
using
(SqlConnection conn =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"PtcDbModelEntities"
].ConnectionString))
{
using
(SqlCommand comm =
new
SqlCommand(command, conn))
{
if
(fileData !=
null
&& fileData.Length > 0)
{
//comm.Parameters.Add(new SqlParameter("Unique", fileId));
//comm.Parameters.Add(new SqlParameter("BinaryData", fileData));
//comm.Parameters.Add(new SqlParameter("FileName", fileName));
comm.Parameters.Add(
new
SqlParameter(
"ChangeLog"
, mystring));
conn.Open();
comm.ExecuteNonQuery();
}
}
}
}
protected
void
RadGrid2_ItemCommand(
object
source, GridCommandEventArgs e)
{
var mystring =
new
StringBuilder(oldChangeLogValue +
"<br />"
);
mystring.AppendLine(EUEUser.DisplayName +
' '
+ DateTime.Now);
if
(e.CommandName == RadGrid.UpdateCommandName ||
e.CommandName == RadGrid.PerformInsertCommandName)
{
var item = e.Item
as
GridEditableItem;
if
(!(item
is
GridEditFormInsertItem))
{
fileId = (
int
)item.GetDataKeyValue(
"Unique"
);
}
var asyncUpload = item[
"AttachmentColumn"
].Controls[0]
as
RadAsyncUpload;
if
(asyncUpload !=
null
&& asyncUpload.UploadedFiles.Count > 0)
{
var uploadedFile = asyncUpload.UploadedFiles[0];
fileData =
new
byte
[uploadedFile.ContentLength];
fileName = uploadedFile.FileName;
using
(Stream str = uploadedFile.InputStream)
{
str.Read(fileData, 0, (
int
)uploadedFile.ContentLength);
}
foreach
(UploadedFile file
in
asyncUpload.UploadedFiles)
{
byte
[] bytes =
new
byte
[file.ContentLength];
using
(
SqlConnection conn1 =
new
SqlConnection(
ConfigurationManager.ConnectionStrings[
"PtcDbModelEntities"
].ConnectionString))
{
using
(
SqlCommand comm1 =
new
SqlCommand(
"Insert into [PtcDbTracker].[dbo].[CAFFileTable] ([Unique1], [BinaryData], [FileName]) Values (?,?,?)"
,
conn1))
{
comm1.Parameters.AddWithValue(
"@Unique1"
, fileId);
comm1.Parameters.AddWithValue(
"@BinaryData"
, bytes);
comm1.Parameters.AddWithValue(
"@FileName"
, fileName);
}
}
}
}
}
}
protected
void
RadGrid2_OnUpdateCommand(
object
sender, GridCommandEventArgs e)
{
oldChangeLogValue = (e.Item
as
GridEditableItem).GetDataKeyValue(
"ChangeLog"
).ToString();
}
}
I am using several pages with grids all with Word, CSV, Excel and PDF export
All export the column headers (i.e. field labels) except the PDF exportI
have tried a multitude of settings without result although I think this
used to work before we moved to using GridTemplateColumn
Currently these are the export settings in aspx
<
ExportSettings
ExportOnlyData
=
"True"
IgnorePaging
=
"true"
FileName
=
"TimesheetList"
OpenInNewWindow
=
"true"
HideStructureColumns
=
"true"
Pdf-DisableContentEncryption
=
"true"
Pdf-Title
=
"Timesheet list"
UseItemStyles
=
"false"
Word-Format
=
"Html"
Pdf-PaperSize
=
"A4"
Excel-Format
=
"Html"
>
<
Pdf
PageHeight
=
"297mm"
PageWidth
=
"420mm"
PageTopMargin
=
"20mm"
PageRightMargin
=
"10mm"
PageLeftMargin
=
"10mm"
BorderStyle
=
"Thin"
BorderColor
=
"#666666"
PaperSize
=
"A4"
ForceTextWrap
=
"True"
>
</
Pdf
>
</
ExportSettings
>
And here is the code behind
case "exportpdf":
isExport = true;
RadGridTimesheets.MasterTableView.ExportToPdf();
Response.AppendCookie(CustomNavigationHelper.CreateExportCookie());
break;
Any ideas what I am doing wrong?
Hello,
I want to translate project built by DevExpress into Telerik, So I looking To corresponding features and functions, and my project is a fully dynamic controls and dynamic data source and a fully ajax treatment after rendering the controls as HTML and CSS,my code in DevExpress
newcontrol = new ASPxGridLookup();
(newcontrol as ASPxGridLookup).DataSource = rep.GetDataSource(ListQuery, "", ""); //ListQuery = select * from ...
(newcontrol as ASPxGridLookup).KeyFieldName = ListID; //ListID = "ID" for all tables
(newcontrol as ASPxGridLookup).AutoGenerateColumns = true;
(newcontrol as ASPxGridLookup).IncrementalFilteringMode = IncrementalFilteringMode.Contains;
(newcontrol as ASPxGridLookup).DataBind();
the code above will give me something like the link below with AutoGenerateColumns and auto design width & height
https://demos.devexpress.com/ASPxGridViewDemos/ASPxGridLookup/FilterServerMode.aspx
I see that you have this below but not easy as the above code (is it right corresponding? )
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multicolumncombo/defaultcs.aspx
or this
http://www.telerik.com/support/code-library/dynamic-multi-column-template
I need it without any PostBack with auto design for dynamic tables and fields
So please I need the help to move to Telerik UI (ASP.net).
Hello,
I am facing the issue in radeditor control which capital letter not come after full stop. The requirement is capital letter should auto come after full stop when I typing in radeditor control like MS Word.
I think this functionality should be there in radeditor control.
Pl. help me as soon as possible.
Thanks
Jiten Mutum
Hi,
I have a grid with CheckList filtering implemetented on some of the columns in the MasterTableView, this works as expected. Implementing the same filtering in the DetailsTables does not work. Clicking the filtering does not fire the OnFilterChecklistItemsRequested event, so no filtering list is shown. The documentation I have found regarding DetailTables filtering does no say anything about specific settings for DetailTables filtering. Setting AllowFiltering on Grid or each table should be enough. Any ideas why this doesn't work?
Regards
John
<
telerik:RadGrid
ID
=
"grdDemo"
runat
=
"server"
AutoGenerateColumns
=
"false"
PageSize
=
"50"
GridLines
=
"Both"
OnNeedDataSource
=
"grdDemo_NeedDataSource"
Width
=
"100%"
all
OnDetailTableDataBind
=
"grdDemo_DetailTableDataBind"
OnRowDrop
=
"grdDemo_RowDrop"
FilterType
=
"CheckList"
AllowMultiRowSelection
=
"true"
OnItemDataBound
=
"grdDemo_ItemDataBound"
OnFilterCheckListItemsRequested
=
"grdDemo_FilterCheckListItemsRequested"
>
<
ClientSettings
AllowRowsDragDrop
=
"true"
>
<
Selecting
AllowRowSelect
=
"True"
/>
<
ClientEvents
OnRowDropping
=
"RowDropping"
/>
</
ClientSettings
>
<
MasterTableView
EnableHierarchyExpandAll
=
"true"
DataKeyNames
=
"RCARealFaultId,GrcaRealFaultId"
AllowFilteringByColumn
=
"True"
>
<
DetailTables
>
<
telerik:GridTableView
EnableHierarchyExpandAll
=
"true"
DataKeyNames
=
"RCARealFaultId,RCASymptomId,GrcaRealFaultId"
Name
=
"Symptom"
AllowFilteringByColumn
=
"true"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"GrcaRealFaultId"
MasterKeyField
=
"GrcaRealFaultId"
/>
</
ParentTableRelation
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"InternalRCADeviceId"
HeaderText
=
"Internal Id"
UniqueName
=
"InternalRCADeviceId"
AllowFiltering
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Project"
HeaderText
=
"Variant"
AllowFiltering
=
"False"
UniqueName
=
"Project"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"IMEI"
HeaderText
=
"IMEI"
UniqueName
=
"IMEI"
AllowFiltering
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"InternalRCASymptomId"
HeaderText
=
"Internal Symptom Id"
UniqueName
=
"InternalRCASymptomId"
AllowFiltering
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Source"
HeaderText
=
"Source"
UniqueName
=
"Source"
AllowFiltering
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"AnalysisResponsible"
HeaderText
=
"Analysis Responsible"
UniqueName
=
"AnalysisResponsible"
AllowFiltering
=
"True"
FilterControlAltText
=
"Analysis Responsible"
FilterCheckListEnableLoadOnDemand
=
"True"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"ButtonTemplateColumn"
AllowFiltering
=
"False"
>
<
ItemTemplate
>
<
asp:Button
ID
=
"bnShowNotes"
runat
=
"server"
Text
=
"Notes"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
Visible
=
"False"
FilterControlAltText
=
"Filter TemplateColumn column"
UniqueName
=
"TemplateColumnRcaSymptomId"
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"tbRCASymptomId"
runat
=
"server"
Text="<%# Bind('RcaSymptomId') %>"
Visible="false"></
asp:TextBox
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
Visible
=
"False"
FilterControlAltText
=
"Filter TemplateColumn column"
UniqueName
=
"TemplateColumnRcaDeviceId"
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"tbRCADeviceId"
runat
=
"server"
Text="<%# Bind('RcaDeviceId') %>"
Visible="false"></
asp:TextBox
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
Visible
=
"False"
FilterControlAltText
=
"Filter TemplateColumn column"
UniqueName
=
"TemplateColumnRCARealFaultId"
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"tbRCARealFaultId"
runat
=
"server"
Text="<%# Bind('GrcaRealFaultId') %>"
Visible="false"></
asp:TextBox
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"RCARealFaultId"
HeaderText
=
"Issue Id"
UniqueName
=
"RCARealFaultId"
AllowFiltering
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"RealFaultFoundDescription"
HeaderText
=
"RealFaultFound Description"
AllowFiltering
=
"False"
UniqueName
=
"RealFaultFoundDescription"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"DefectComponent"
HeaderText
=
"Defect Component"
UniqueName
=
"DefectComponent"
AllowFiltering
=
"true"
FilterCheckListEnableLoadOnDemand
=
"true"
FilterControlAltText
=
"Filter Defect Component column"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"DefectCondition"
HeaderText
=
"Defect Condition"
UniqueName
=
"DefectCondition"
FilterCheckListEnableLoadOnDemand
=
"true"
FilterControlAltText
=
"Filter Defect Condition column"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ResponsibleArea"
HeaderText
=
"Responsible Area"
UniqueName
=
"ResponsibleArea"
FilterCheckListEnableLoadOnDemand
=
"true"
FilterControlAltText
=
"Filter Responsible Area column"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"RealFaultStatus"
HeaderText
=
"RealFault Status"
AllowFiltering
=
"False"
UniqueName
=
"RealFaultStatus"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Hi, we're migrating a site with lots of gridviews to radgrids. We want a uniform setup of radgrids with the same paging options, enable scrolling and show footer settings.
is there way to set these settings globally for all radgrids in a site, or alternatively is there a way of setting the values for these properties for all newly added radgrids from the toolbox?
doing and find/replace throughout he site is not really a good idea
thanks
james
Hi All,
I have a chart that has a whole year shown by day on the xaxis.
Obviously 365 axis labels don't work very well. I'd like to still display the data as days but show the lebels as 12 Months - with corresponding vertical grid lines.
How would I go about doing this?
Regards
Jon
Hello,
I facing issue in radeditor control the font size and name not update when we select the size and name in radeditor control function from dropdown if we copy paste from other word document. But font size and name update if i type in rad editor control.
Please help me
Thanks
Jiten Mutum