4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 07 Aug 2013, 11:04 AM
Hi Berk,
Please have a look at the following code snippet that I have tried which works fine at my end.
ASPX:
C#:
Thanks,
Shinu.
Please have a look at the following code snippet that I have tried which works fine at my end.
ASPX:
<
telerik:RadListBox
ID
=
"RadListBox1"
runat
=
"server"
CheckBoxes
=
"true"
DataTextField
=
"Text"
DataValueField
=
"Value"
OnLoad
=
"RadListBox1_Load"
>
</
telerik:RadListBox
>
<
telerik:RadTreeView
ID
=
"testtree"
runat
=
"server"
>
<
Nodes
>
<
telerik:RadTreeNode
runat
=
"server"
Text
=
"Node 1"
>
</
telerik:RadTreeNode
>
</
Nodes
>
</
telerik:RadTreeView
>
<
br
/>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
Text
=
"Copy"
OnClick
=
"RadButton1_Click"
>
</
telerik:RadButton
>
C#:
protected
void
RadButton1_Click(
object
sender, EventArgs e)
{
foreach
(RadListBoxItem item
in
RadListBox1.CheckedItems)
{
RadTreeNode node1 =
new
RadTreeNode(item.Text, item.Value);
testtree.Nodes.Add(node1);
}
}
Thanks,
Shinu.
0
Berkman
Top achievements
Rank 1
answered on 06 Sep 2013, 03:11 AM
It worked. Sorry for the late response. Does telerik ajax suite has any controls similar to radpdfviewer in wpf? I am populating pdf file names in a radlistbox which are actually uploaded user files stored inside an upload folder in my project. On clicking each filename i want to open the pdf. This is my requirement.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 06 Sep 2013, 08:10 AM
Hi Berkman,
The Telerik RadControls for ASP.NET AJAX does not contain any specific controls to view PDF files. One option is you can use the RadWindow to view PDF files. Please have a look at the sample code I tried which works fine at my end. Attach the openPdf javascript method to the OnClientItemDoubleClicked event of the RadListBox.
ASPX:
JavaScript:
In the above code all the PDF files are stored in a folder called UploadedPDFFiles which is inside the project directory.
Hope this helps,
Shinu.
The Telerik RadControls for ASP.NET AJAX does not contain any specific controls to view PDF files. One option is you can use the RadWindow to view PDF files. Please have a look at the sample code I tried which works fine at my end. Attach the openPdf javascript method to the OnClientItemDoubleClicked event of the RadListBox.
ASPX:
<
span
class
=
"style1"
>Double click on file name to view contents</
span
><
br
/>
<
telerik:RadWindowManager
ID
=
"RadWindowManager"
runat
=
"server"
Width
=
"400px"
Height
=
"600px"
>
</
telerik:RadWindowManager
>
JavaScript:
<script type=
"text/javascript"
>
function
openPdf(sender, args) {
var
filelocation =
"UploadedPDFFiles/"
+ args.get_item().get_text();
radopen(filelocation,
""
);
}
</script>
In the above code all the PDF files are stored in a folder called UploadedPDFFiles which is inside the project directory.
Hope this helps,
Shinu.
0
Berkman
Top achievements
Rank 1
answered on 06 Sep 2013, 05:02 PM
Excellent solution since users can double click the file name to open it in a window with all options such as print, zoom, download etc. and close it; similar to how we do often. Thanks a lot shinu.