Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
123 views

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!

Doncho
Telerik team
 answered on 15 May 2020
2 answers
78 views
그룹화 할 때 빈 열이 첫 번째 열에 추가되고 하나씩 입력됩니다. 이 문제를 해결하는 방법을 알려주십시오. 스크린 샷을 첨부합니다.
Eyup
Telerik team
 answered on 15 May 2020
4 answers
538 views
Environment: VS 2008 SP1, ASP.NET AJAX 2009 Q3, WIN XP, IE 7.

Demo I am following is from below link.

http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/gridattachmentcolumn/defaultcs.aspx

Is it possible to show file type along with uploaded file name in RadGrid. Attached are my modified Radgrid (GridAttachmentcolumnDisplay.JPG) and Windows exploreer source folder (GridAttachmentUploadSourceFolder.JPG) for  Uploaded Files.

What I mean if Document.rtf has a W icon along with file name in exploreer, I would like to display the file in same display format in Radgrid. Currently in Radgrid it shows C:\Documents and Settings\GC\Test\Document.rtf, no icon for file type. Although by double clicking the uploaded file name, it opens with it's appropriate program type. But showing the file type along with file name will be really helpful to users..

In above Telerik Demo, Sushi.pdf or Customer.xls does not show the windows exploreer like file name icon either.

Thanks

gc_0620


Dimo
Telerik team
 answered on 15 May 2020
1 answer
284 views

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.

Rumen
Telerik team
 answered on 14 May 2020
1 answer
199 views

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

 

 

Rumen
Telerik team
 answered on 14 May 2020
1 answer
349 views

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

Angel Petrov
Telerik team
 answered on 14 May 2020
5 answers
125 views
HI,

 i have used show/hide column functionallity of radgrid.it workes fine on every browser on windows OS but should not able show/hide column on MAC OS...................

did i need some more files for running this functionallity on MAC OS
Vessy
Telerik team
 answered on 14 May 2020
1 answer
115 views

Can we upload large file using RadFileExcplorer without setting Maximum request length in web config file?

Vessy
Telerik team
 answered on 14 May 2020
1 answer
92 views

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

Peter Milchev
Telerik team
 answered on 14 May 2020
1 answer
199 views

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.

Vessy
Telerik team
 answered on 14 May 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?