Wednesday, February 6, 2013

Show Popup Window On RadGrid Link Button Click


This example demonstrate how to show a popup window on a link buttin click inside Telerik RadGrid. Our RadGrid mark up code looks like below.

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
<Windows>
<telerik:RadWindow ID="RadWindow1" runat="server" ShowContentDuringLoad="false" Width="400px"
Height="400px" Title="Record Data" Behaviors="Default">
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
<div style="width: 840px; overflow: auto">
<telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="False" Width="600px"
Skin="Hay" AllowPaging="True" AllowSorting="True" AllowFilteringByColumn="True"
CellSpacing="0" onitemcreated="RadGrid1_ItemCreated" PageSize="30">
<MasterTableView IsFilterItemExpanded="true" TableLayout="Auto">
<Columns>
<telerik:GridTemplateColumn UniqueName="Data" HeaderText="View Data" AllowFiltering="false">
<ItemTemplate>
<asp:HyperLink ID="hlink" runat="server" Text="View"></asp:HyperLink>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</telerik:RadGrid>
</div>
Code behind:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
HyperLink photoLink = (HyperLink)e.Item.FindControl("hlink");
photoLink.Attributes.Add("Onclick", " return radopen('ShowData.aspx','RadWindow1');");
}
An example preview would be as follows:



1 comment:
Write comments
Recommended Posts × +