Ok, first of all hi :)
ALready programming two-months with Telerik, I feel I started to get the grip of things. However there is something that has troubled me for the past few days in my work trying different implementations, but I still cannot seem to find a solution....
What I want to do:
I want to redirect to a new page through a button ( - I don't know if there are practical differences between Image and Link button other than how it is viewed on the user, but I prefer ImageButton - ), which also will pass a variable it in the url (http://www.lala.com?var=myvar - any other way are acceptable)
What I currently do:
In my .aspx file I have
(Grid Properties)
(Grid Buttons - Download is the button to redirect, Link keeps the text to parse)
In my .cs file
(I eventually found out that LinkButton has no OnCLick attribute, so that brings me at a dead end...I think..)
(After it found the correct element, it should call the javascript function in the MasterPage - included in the <head>)
In my .js file
(Since I have the text I need in a hidden column, I get it and pass it to the page I want)
Errors:
My main error is that downloadbutton(.cs) is always null. And even if it progressed properly I already have a bad feeling it won't work even then.
For some parts, I am not even 100% of what their functions are.
Any help in the matter?
ALready programming two-months with Telerik, I feel I started to get the grip of things. However there is something that has troubled me for the past few days in my work trying different implementations, but I still cannot seem to find a solution....
What I want to do:
I want to redirect to a new page through a button ( - I don't know if there are practical differences between Image and Link button other than how it is viewed on the user, but I prefer ImageButton - ), which also will pass a variable it in the url (http://www.lala.com?var=myvar - any other way are acceptable)
What I currently do:
In my .aspx file I have
(Grid Properties)
<
telerik:RadGrid
ID
=
"rdEthnologicalImages"
runat
=
"server"
AllowSorting
=
"True"
AutoGenerateColumns
=
"False"
CellSpacing
=
"0"
AllowPaging
=
"True"
ShowStatusBar
=
"True"
GridLines
=
"None"
OnItemCommand
=
"RadGrid_Command"
OnNeedDataSource
=
"RadGrid_NeedDataSource"
OnItemDataBound
=
"RadGrid_ItemDataBound"
>
(Grid Buttons - Download is the button to redirect, Link keeps the text to parse)
<
telerik:GridButtonColumn
FilterControlAltText
=
"Filter Download column"
HeaderText
=
"Download"
ImageUrl
=
"~/Img/download.png"
ItemStyle-HorizontalAlign
=
"Center"
Text
=
"Download"
CommandName
=
"Download"
UniqueName
=
"Download"
><
HeaderStyle
Width
=
"50px"
></
HeaderStyle
>
<
ItemStyle
HorizontalAlign
=
"Center"
></
ItemStyle
>
</
telerik:GridButtonColumn
>
<
telerik:GridBoundColumn
DataField
=
"Link"
FilterControlAltText
=
"Filter ImageLink column"
HeaderText
=
"Link"
UniqueName
=
"ImageLink"
Visible
=
"False"
>
</
telerik:GridBoundColumn
>
In my .cs file
(I eventually found out that LinkButton has no OnCLick attribute, so that brings me at a dead end...I think..)
(After it found the correct element, it should call the javascript function in the MasterPage - included in the <head>)
if (e.Item.ItemType == GridItemType.Item)
{
GridDataItem dataItem = (GridDataItem)rdEthnologicalImages.MasterTableView.GetItems(GridItemType.Item)[0];
//LinkButton downloadButton = (LinkButton)dataItem.FindControl("Download");
LinkButton downloadButton = (LinkButton)e.Item.FindControl("Download");
if (downloadButton != null)
{
downloadButton.Attributes.Add("OnClick", "popup");
}
}
In my .js file
(Since I have the text I need in a hidden column, I get it and pass it to the page I want)
function popup()
{
var grid = $find("<%=rdEthnologicalImages.ClientID %>");
var MasterTable = grid.get_masterTableView();
var selectedRows = MasterTable.get_selectedItems();
for (var i = 0; i < selectedRows.length; i++)
{
var row = selectedRows[i];
var link = MasterTable.getCellByColumnUniqueName(row, "ImageLink");
window.open("~/DownloadPopup.aspx?filename=link");
break;
}
}
Errors:
My main error is that downloadbutton(.cs) is always null. And even if it progressed properly I already have a bad feeling it won't work even then.
For some parts, I am not even 100% of what their functions are.
Any help in the matter?