Hi Guys,
i currently have a rad window that opens when a picture in the RadGrid is clicked
My RadGrid
Javascript that opens the window
Code behind
Reference numbers are being loaded from the database into the radGrid as a GridHyperLink column, what needs to be done is when a hyper link is clicked it opens the RadWindow, how would i go about doing this? while still loading the reference numbers from the database.
i currently have a rad window that opens when a picture in the RadGrid is clicked
My RadGrid
<
telerik:RadGrid
ID
=
"grdIncidents"
Height
=
"890px"
runat
=
"server"
OnItemCreated
=
"grdIncidents_ItemCreated"
AllowAutomaticInserts
=
"True"
AutoGenerateColumns
=
"False"
OnNeedDataSource
=
"grdIncidents_NeedDataSource"
meta:resourcekey
=
"grdIncidentsResource1"
AllowPaging
=
"True"
PageSize
=
"15"
AllowSorting
=
"True"
OnDeleteCommand
=
"grdIncidents_DeleteCommand"
CellSpacing
=
"0"
GridLines
=
"None"
onprerender
=
"grdIncidents_PreRender"
>
<
ClientSettings
Scrolling-AllowScroll
=
"false"
>
<
Selecting
CellSelectionMode
=
"None"
></
Selecting
>
</
ClientSettings
>
<
MasterTableView
DataKeyNames
=
"IncidentID"
ClientDataKeyNames
=
"IncidentID"
CommandItemDisplay
=
"Top"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Status"
HeaderText
=
"Status"
ItemStyle-Font-Names
=
"Calibri"
meta:resourcekey
=
"GridBoundColumnResource1"
Resizable
=
"False"
UniqueName
=
"Status"
ReadOnly
=
"True"
Reorderable
=
"False"
ShowSortIcon
=
"False"
>
<
FooterStyle
HorizontalAlign
=
"Center"
Width
=
"20px"
Wrap
=
"True"
/>
<
HeaderStyle
HorizontalAlign
=
"Center"
Width
=
"20px"
Wrap
=
"True"
/>
<
ItemStyle
Font-Names
=
"Calibri"
HorizontalAlign
=
"Center"
Width
=
"20px"
Wrap
=
"True"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridHyperLinkColumn
FooterText
=
"HyperLinkColumn footer"
UniqueName
=
"IncidentType"
HeaderText="Title</br>Reference" DataTextField="IncidentType" NavigateUrl="#">
</
telerik:GridHyperLinkColumn
>
<
telerik:GridBoundColumn
DataField
=
"AccountDetails"
HeaderText="Account<br/>Site<
br
/>Location"
meta:resourcekey="GridBoundColumnResource4" UniqueName="AccountDetails" Resizable="False"/>
<
telerik:GridBoundColumn
DataField
=
"ProductDetails"
HeaderText="Product<br/>Component"
meta:resourcekey="GridBoundColumnResource5" UniqueName="ProductDetails" Resizable="False"/>
<
telerik:GridBoundColumn
DataField
=
"DepartmentDetails"
HeaderText="Department<br/>Category"
meta:resourcekey="GridBoundColumnResource6" UniqueName="DepartmentDetails" Resizable="False"/>
<
telerik:GridBoundColumn
DataField
=
"ImpactLevel"
HeaderText
=
"Impact"
meta:resourcekey
=
"GridBoundColumnResource7"
UniqueName
=
"ImpactLevel"
Resizable
=
"False"
/>
<
telerik:GridBoundColumn
DataField
=
"CurrentAssignedPerson.FullName"
HeaderText
=
"Assigned User"
meta:resourcekey
=
"GridBoundColumnResource8"
UniqueName
=
"Assigned"
Resizable
=
"False"
/>
<
telerik:GridBoundColumn
DataField
=
"LoggedDate"
HeaderText
=
"Incident Log Date"
meta:resourcekey
=
"GridBoundColumnResource9"
UniqueName
=
"LoggedDate"
/>
<
telerik:GridBoundColumn
DataField
=
"LastUpdated"
HeaderText
=
"Last Action Date"
meta:resourcekey
=
"GridBoundColumnResource10"
UniqueName
=
"LastUpdated"
/>
<
telerik:GridTemplateColumn
UniqueName
=
"TemplateEditColumn"
>
<
ItemStyle
HorizontalAlign
=
"Center"
/>
<
ItemTemplate
>
<
asp:HyperLink
ID
=
"EditLink"
runat
=
"server"
Text
=
"Edit"
><
img
src
=
"../Images/icons/pencil.png"
class
=
"editPics"
></
asp:HyperLink
>
<
br
>Edit
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"ActionColumn"
>
<
ItemStyle
HorizontalAlign
=
"Center"
/>
<
ItemTemplate
>
<
asp:HyperLink
ID
=
"ActionLink"
Text
=
"Action"
runat
=
"server"
><
img
src
=
"../Images/icons/action.png"
class
=
"editPics"
></
asp:HyperLink
>
<
br
>Action
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridButtonColumn
UniqueName
=
"GridDeleteButton"
ConfirmText
=
"Are you sure that you would like \nto delete this incident?"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"Delete"
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
/>
</
Columns
>
<
CommandItemTemplate
>
<
div
id
=
"AddIncidentDiv"
runat
=
"server"
style
=
"padding: 4px 7px 4px; text-align:right;"
>
<
asp:ImageButton
ID
=
"btnAdd"
runat
=
"server"
ToolTip
=
"Add New Incident"
ImageUrl
=
"../Images/icons/add.png"
OnClientClick
=
"return ShowInsertForm();"
/>
</
div
>
</
CommandItemTemplate
>
</
MasterTableView
>
</
telerik:RadGrid
>
Javascript that opens the window
function
ShowEditForm(id, rowIndex) {
var
grid = $find(
"<%= grdIncidents.ClientID %>"
);
var
rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
grid.get_masterTableView().selectItem(rowControl,
true
);
window.radopen(
"EditIncidents.aspx?IncidentID="
+ id,
"IncidentListDialog"
);
return
false
;
}
Code behind
protected
void
grdIncidents_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
HyperLink editLink = (HyperLink)e.Item.FindControl(
"EditLink"
);
editLink.Attributes[
"href"
] =
"#"
;
editLink.Attributes[
"onclick"
] = String.Format(
"return ShowEditForm('{0}','{1}');"
, e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][
"IncidentID"
], e.Item.ItemIndex);
HyperLink actionLink = (HyperLink)e.Item.FindControl("ActionLink");
actionLink.Attributes["href"] = "#";
actionLink.Attributes["onclick"] = String.Format("return ShowActionForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["IncidentID"], e.Item.ItemIndex);
}
}
Reference numbers are being loaded from the database into the radGrid as a GridHyperLink column, what needs to be done is when a hyper link is clicked it opens the RadWindow, how would i go about doing this? while still loading the reference numbers from the database.