Hello, I am trying to create a way for the user to view a pdf, xlsx, jpg, gif, etc., from a link button within my Detail table in a radgrid. I am able to accomplish this for a pdf, but not the image files or Excel files.
One of the main issues is that the file types stored within the SQL table field can be any of those above types. My question is how can I write the vb.net code to display any type of file from the same RadGrid column; as the Details Table can have numerous records of different file types.
Here's what I have --
01.
<
DetailTables
>
02.
<
telerik:GridTableView
DataKeyNames
=
"fileID"
Name
=
"Attachments"
DataSourceID
=
"sdsVenFiles"
CommandItemDisplay
=
"Top"
Caption
=
"Files Attached to this Vendor Maintenance Request:"
03.
NoDetailRecordsText
=
"No files are attached to this Vendor Adjustment request."
Width
=
"75%"
EditFormSettings-FormCaptionStyle-Font-Bold
=
"true"
>
04.
<
ParentTableRelation
>
05.
<
telerik:GridRelationFields
DetailKeyField
=
"wfID"
MasterKeyField
=
"wfID"
/>
06.
</
ParentTableRelation
>
07.
<
CommandItemSettings
ShowAddNewRecordButton
=
"false"
ShowRefreshButton
=
"true"
/>
08.
<
Columns
>
09.
<
telerik:GridBoundColumn
SortExpression
=
"fileID"
HeaderText
=
"File ID"
HeaderButtonType
=
"TextButton"
DataField
=
"fileID"
Visible
=
"false"
></
telerik:GridBoundColumn
>
10.
<
telerik:GridBoundColumn
SortExpression
=
"wfID"
HeaderText
=
"Control #"
HeaderButtonType
=
"TextButton"
DataField
=
"wfID"
Visible
=
"false"
></
telerik:GridBoundColumn
>
11.
<
telerik:GridTemplateColumn
HeaderText
=
"Open File"
>
12.
<
ItemTemplate
>
13.
<
asp:LinkButton
ID
=
"lnkDownload"
runat
=
"server"
Text='<%# Eval("fileName")%>' OnClick="viewFile" CommandArgument='<%# Eval("fileID")%>'></
asp:LinkButton
>
14.
</
ItemTemplate
>
15.
</
telerik:GridTemplateColumn
>
16.
17.
<
telerik:GridButtonColumn
CommandName
=
"Delete"
ConfirmText
=
"Delete this file?"
HeaderText
=
"Delete"
Text
=
"Delete"
UniqueName
=
"DeleteColumn1"
>
18.
</
telerik:GridButtonColumn
>
19.
</
Columns
>
20.
</
telerik:GridTableView
>
21.
</
DetailTables
>
And my vb.net --
01.
Protected
Sub
viewFile(sender
As
Object
, e
As
EventArgs)
02.
03.
Dim
id
As
Integer
=
Integer
.Parse(TryCast(sender, LinkButton).CommandArgument)
04.
Dim
bytes
As
Byte
()
05.
Dim
fileName
As
String
, contentType
As
String
06.
Dim
constr
As
String
= ConfigurationManager.ConnectionStrings(
"DbName"
).ConnectionString
07.
Using con
As
New
SqlConnection(constr)
08.
Using cmd
As
New
SqlCommand()
09.
cmd.CommandText =
"SELECT fileID, fileName, fileType, fileData FROM tblVendorFile WHERE fileId=@Id"
10.
cmd.Parameters.AddWithValue(
"@Id"
, id)
11.
cmd.Connection = con
12.
con.Open()
13.
Using sdr
As
SqlDataReader = cmd.ExecuteReader()
14.
sdr.Read()
15.
bytes =
DirectCast
(sdr(
"fileData"
),
Byte
())
16.
contentType = sdr(
"fileType"
).ToString()
17.
fileName = sdr(
"fileName"
).ToString()
18.
End
Using
19.
con.Close()
20.
End
Using
21.
End
Using
22.
23.
Response.Clear()
24.
Response.Buffer =
True
25.
Response.Charset =
""
26.
Response.Cache.SetCacheability(HttpCacheability.NoCache)
27.
Response.ContentType =
"application/pdf"
28.
Response.BinaryWrite(bytes)
29.
Response.Flush()
30.
Response.
End
()
31.
32.
End
Sub
Thanks for any and all help!
If you go to this page:
https://demos.telerik.com/aspnet-ajax/editor/examples/overview/defaultcs.aspx
And then go to the HTML tab and pasted this code in:
<div style="border: red 1px solid;" contenteditable="false" unselectable="on">
Non Editable AREA
<div style="border: green 1px solid;" contenteditable="true" unselectable="off">
<!--Content name="info" -->
Editable REGION...
<!--/Content -->
</div>
Non Editable AREA
</div>
Which is from the documentation page:
https://docs.telerik.com/devtools/aspnet-ajax/controls/editor/managing-content/editable-and-non-editable-areas
If you go back to the design tab, you are unable to type anything in the editable area. This works fine in the legacy edge (non-Chromium).
Also interesting is that you can delete things in the non-editable area.
Hello,
I want manually install the Telerick Web Part for SharePoint, but I don't understand how do download the .wsp file or where find it.
I just found the Telerik_Web_Parts_For_Sharepoint2013_2020_2_512_Dev.msi.
Thanks in advance
I was wondering if it was possible use the filter builder with the kendo grid?
I have been having a number of problems:
1) when i tried to use the Kendo MVC fluent to build my datasource external to the grid nothing ever got output to the page. ei no script was generated
2) when i created the javascript by hand the grid loaded i was able to associate it with the filter and the grid and it appeared i was able to build custom filters, but the filter never bound to the DataSourceRequest request.filter on the controller during a read. This is what is put into the querystring (note i manually put the canimpersonateonly=true)?canImpersonateOnly=True&take=50&skip=0&page=1&pageSize=50&filter%5Blogic%5D=and&filter%5Bfilters%5D%5B0%5D%5Bfield%5D=UvaId&filter%5Bfilters%5D%5B0%5D%5Bvalue%5D=ksa&filter%5Bfilters%5D%5B0%5D%5Boperator%5D=eq
Do you have any samples that use the external filter builder along with the kendo grid in asp.net mvc?
Thanks,
Logan
Can we upload large file using RadFileExcplorer without setting Maximum request length in web config file?
The link for the Medial Player from the controls overview is dead:
https://demos.telerik.com/aspnet-ajax/errorpageresources.aspx?aspxerrorpath=/aspnet-ajax/media-player/examples/overview/defaultcs.aspx
Marc
Hi everyone,
I want to visible RadwizardStep
Ex. I'm login website ID = a >> i want to show 3 Step
but i'm login ID = b>> i want to show 2 step
i use visible is not working
i use disable in css >> Tab is hide but Body Not hide
Please Help me.
Thank you.