Need urgent help from you guys.
1) i am displaying all PDF files stored on Directory from specific path inside the radgrid using "GridHyperLinkColumn".
2) the display is perfect but when clicked on the link the path taken is not fully correct and Hence cannot open the Files.
Actual Path ="../help/PDFfiles/*.pdf"
Path Taken = "../help/*.pdf"
It cannot take PDFFiles folder and hence fiel cannot be display
Please help for the same. Below is the code as shown.
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
/>
<
telerik:RadGrid
ID
=
"gridFilesDisplay"
runat
=
"server"
>
<
MasterTableView
EditMode
=
"InPlace"
ShowHeadersWhenNoRecords
=
"true"
AllowFilteringByColumn
=
"false"
>
<
Columns
>
<
telerik:GridHyperLinkColumn
DataNavigateUrlFields
=
"Name"
DataTextField
=
"Name"
HeaderText
=
"Document Name"
> ></
telerik:GridHyperLinkColumn
>
</
Columns
>
<
PagerStyle
Mode
=
"NextPrevNumericAndAdvanced"
/>
</
MasterTableView
>
</
telerik:RadGrid
>
</
form
>
************************** CODEBEHIND******************************
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
sPath = "..//help/PDFFILES//" //(This value taken from webconfig)
DirectoryInfo objDirectory = new DirectoryInfo(Server.MapPath(sPath));
gridFilesDisplay.DataSource = objDirectory.GetFiles("*.pdf");
gridFilesDisplay.DataBind();
}
}
13 Answers, 1 is accepted
RadGrid displays what it is bound to, so have you tried debugging the data-binding to confirm that the values passed to the grid control are what you expect it to display?
Additionally, if you are going to enable editing for the grid, I would advise you to use advanced data-binding, instead of simple.
Regards,
Tsvetina
the Telerik team

Thankyou for your reply.
I solved myself by using additional objects in itemdatabound of the grid.
Thanks..!!
Regards
Sudhakar

I am trying to do something similar... I think. I want to have a hyperlink in the grid that will do either of the following:
1 - Open the folder specified in the link
OR
2 - Open all the PDF files located in the folder specified in the link.
If you (or anyone else) is able to help with this, it would be much appreciated.
I assume you are trying to display all files in chosen directory at your server. Since this is not possible by using a RadGrid I would recommend you to add RadFileExporer control in your project. Please check out the following live example and our documentation for additional information.
Regards,
Kostadin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Is there a way to allow the user to drag to select rows? This is much easier, faster, and efficient for the end user.

Thank you. It looks like I need to use command buttons to select rows. I was allowing the user to drag the mouse to select rows.
Is there a way to allow the user to drag to select rows? This is much easier, faster, and efficient for the end user.
I am afraid I am not completely understand your requirement. Could you please elaborate a little bit more on your scenario?
Regards,
Kostadin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

This much I have working, HOWEVER, I am using Column Groups and in order for those to be displayed properly, I have to issue a rebind. The rebind makes the Column groups appear properly, but all of the rows on the page are exported rather than the selected rows.
I believe that the solution you linked requires that the Select command is pressed for each row. Is there a way around that so they could drag to select? Or perhaps, when the user drags, it recreates the manual clicking of the select button for each row selected?
A possible solution is to hook OnItemDataBound event handler and set Visible to false to all items which are not selected. Please check out the following code snippet.
protected
void
RadGrid1_ItemDataBound(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem && isExport)
{
GridDataItem item = e.Item
as
GridDataItem;
if
(!item.Selected)
{
item.Visible =
false
;
}
}
}
bool
isExport =
false
;
protected
void
RadGrid1_ItemCommand(
object
sender, Telerik.Web.UI.GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.ExportToExcelCommandName)
{
isExport =
true
;
}
}
Please let me know if that approach serves your needs.
Regards,
Kostadin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Protected
Sub
btnExport_Click(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
isExport =
True
Me
.RadGrid1.MasterTableView.GetColumn(
"Location"
).Display =
True
Me
.RadGrid1.MasterTableView.GetColumn(
"Proposal_NotIssued"
).Display =
True
Me
.RadGrid1.MasterTableView.GetColumn(
"Proposal_NotIssuedReason"
).Display =
True
Me
.RadGrid1.MasterTableView.GetColumn(
"Proposal_Qualification"
).Display =
True
Me
.RadGrid1.MasterTableView.GetColumn(
"Proposal_EstimatedProjectArea"
).Display =
True
Me
.RadGrid1.MasterTableView.GetColumn(
"Proposal_EstimatedConstructionCost"
).Display =
True
Me
.RadGrid1.MasterTableView.GetColumn(
"Proposal_WinningProbabilityPct"
).Display =
True
Me
.RadGrid1.MasterTableView.GetColumn(
"Proposal_DateGranted"
).Display =
True
Me
.RadGrid1.MasterTableView.GetColumn(
"Proposal_ProjectID"
).Display =
True
Me
.RadGrid1.MasterTableView.GetColumn(
"Proposal_Comments"
).Display =
True
For
Each
item
As
GridDataItem
In
Me
.RadGrid1.Items
If
item.Selected =
False
Then
item.Visible =
False
End
If
Next
Me
.RadGrid1.Rebind()
Me
.RadGrid1.ExportSettings.ExportOnlyData =
True
Me
.RadGrid1.ExportSettings.OpenInNewWindow =
True
Me
.RadGrid1.ExportSettings.FileName =
"Selected Proposals "
& Format(Now,
"yyyy-MM-dd-h-mm-ss"
)
'Me.RadGrid1.ExportSettings.IgnorePaging = True
Me
.RadGrid1.ExportSettings.UseItemStyles =
True
Me
.RadGrid1.MasterTableView.ExportToExcel()
End
Sub
Private
Sub
RadGrid1_ItemDataBound(sender
As
Object
, e
As
GridItemEventArgs)
Handles
RadGrid1.ItemDataBound
If
TypeOf
e.Item
Is
GridDataItem
AndAlso
isExport
Then
Dim
item
As
GridDataItem = TryCast(e.Item, GridDataItem)
If
Not
item.Selected
Then
item.Visible =
False
End
If
End
If
End
Sub
Private
isExport
As
Boolean
=
False

The rebind in the btnExport_Click triggers the RadGrid1_ItemDataBound. There grid page contains 20 items. The first six times the ItemDataBound is run, the criteria is not met. The next 20 times, it is met and item.visible is set to false. This is the case regardless of how many items are actually selected.
So it would seem like the code is reading that nothing is selected, yet it's exporting everything.
Also, I ran this with and without the following code in the command button and it's the same.
For
Each
item
As
GridDataItem
In
Me
.RadGrid1.Items
If
item.Selected =
False
Then
item.Visible =
False
End
If
Next

You have to either call Rebind() or enable the IgnorePaging property in order to fire the ItemDataBound event handler and disable the items which are not selected.
Regards,
Kostadin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.