This is a migrated thread and some comments may be shown as answers.

radgird usercontrol modalpopup

1 Answer 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sener
Top achievements
Rank 1
sener asked on 14 Jun 2011, 02:44 PM

I try to show detail of item using user control in radgrid template column
I just see first record detail, the other seems empty
what can be the reason for that?

My code look like

ASPX


 

 

<

 

telerik:GridTemplateColumn DataField="transactionID" HeaderText="" CurrentFilterFunction="StartsWith"

 

 

 

 

 

 

 

UniqueName="transactionID" Groupable="False" AllowFiltering="false">

 

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

<%

--<a id="transactionAnchor" title="Click to edit transaction" target="_parent" style="color: #3399ff;"

 

 

class="link" href='<%#"../Transaction/editTransaction.aspx?tid=" + Eval("transactionID") + "&id=" + Eval("transaction.type.category.categoryID") %>'>

 

<%# Eval("transactionID")%></a>--

 

%>

 

 

 

<uc1:ucModalPopup ID="modalPopup1" runat="server" />

 

 

 

<asp:ImageButton runat="server" ID="btnDETAILTRANSACTION" ToolTip="Click to show transaction detail."

 

 

 

 

 

 

 

ImageUrl="../images/details.png" CommandName="DetailTransaction" />

 

 

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 


ASPX.CS

 

 

protected

 

void transactionApprovalerRadGrid_ItemCommand(object source, GridCommandEventArgs e)

 

 

{

 

 

if ((e.CommandName == "Filter"))

 

 

{

 

 

foreach (GridColumn column in e.Item.OwnerTableView.Columns)

 

 

{

 

column.CurrentFilterValue =

string.Empty;

 

 

column.CurrentFilterFunction =

GridKnownFunction.NoFilter;

 

 

}

 

}

 

 

else if (e.CommandName == "DetailTransaction")

 

 

{

 

 

ReportViewer rv = new ReportViewer();

 

 

rv.Width = 820;

 

rv.Height = 400;

 

rv.ShowToolBar =

false;

 

 

 

Hashtable paramaters = new Hashtable();

 

 

paramaters.Add(

"transactionID", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["transactionID"].ToString());

 

 

lib.

CommonFunctions.BuildReport(rv, "HAREKETDETAY", paramaters);

 

 

((Comman.

modalPopup)e.Item.FindControl("modalPopup1")).customPanel.Controls.Add(rv);

 

 

((Comman.

modalPopup)e.Item.FindControl("modalPopup1")).Notification.Show();

 

 

}

 

}

 

 


ASCX

 

 

<%

@ Control Language="C#" AutoEventWireup="true" CodeBehind="modalPopup.ascx.cs" Inherits="deva.ITracker.Comman.modalPopup" %>

 

 

<%

@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

 

 

 

 

 

 

 

Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

 

 

<%

@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

 

 

 

 

 

<

 

asp:LinkButton ID="hiddenLinkButton1" Style="display: none" runat="server" OnClientClick="return false"></asp:LinkButton>

 

 

 

 

 

 

 

<div id="popup1" style="border: medium outset #C0C0C0; display: none; max-width: 900px; min-width: 700px; background-color: #f0f0f0;">

 

 

 

 

 

 

 

<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">

 

 

 

 

 

 

 

<tr>

 

 

 

 

 

 

 

<td align="left" style="padding-bottom: 2px">

 

 

 

 

 

 

 

<asp:Image ID="imgExclamation1" runat="server" ImageUrl="~/images/exclamation.png" />

 

 

 

 

 

 

 

</td>

 

 

 

 

 

 

 

<td align="right">

 

 

 

 

 

 

 

<asp:ImageButton ID="LoginCancelButton1" runat="server" ImageUrl="~/images/cancel.png"

 

 

 

 

 

 

 

AlternateText="Kapat" ToolTip="Kapat" />

 

 

 

 

 

 

 

</td>

 

 

 

 

 

 

 

</tr>

 

 

 

 

 

 

 

</table>

 

 

 

 

 

 

 

<div id="popupContainer1">

 

 

 

 

 

 

 

<table border="0" cellpadding="0" cellspacing="0">

 

 

 

 

 

 

 

<tr>

 

 

 

 

 

 

 

<td align="left">

 

 

 

 

 

 

 

<asp:Label ID="masterPopupLabel1" runat="server" Text=""></asp:Label>

 

 

 

 

 

 

 

</td>

 

 

 

 

 

 

 

</tr>

 

 

 

 

 

 

 

<tr>

 

 

 

 

 

 

 

<td align="left">

 

 

 

 

 

 

 

<asp:Panel ID="customPopupPanel1" runat="server">

 

 

 

 

 

 

 

 

 

</asp:Panel>

 

 

 

 

 

 

 

</td>

 

 

 

 

 

 

 

</tr>

 

 

 

 

 

 

 

</table>

 

 

 

 

 

 

 

</div>

 

 

 

 

 

 

 

</div>

 

 

 

 

 

 

 

<cc1:ModalPopupExtender ID="ModalPopupExtenderNotification1"

 

 

 

runat="server" CancelControlID="LoginCancelButton1" RepositionMode="RepositionOnWindowResize"

 

 

 

 

 

 

 

PopupControlID="popup1" TargetControlID="hiddenLinkButton1"

 

 

 

 

 

 

 

BackgroundCssClass="modalBackground" DropShadow="false">

 

 

 

 

 

 

 

</cc1:ModalPopupExtender>

 

 

<

 

asp:HiddenField ID="HiddenField1" runat="server" />

 

 

 

 

ASCX.CS

 

 

namespace

 

deva.ITracker.Comman

 

 

{

 

 

public partial class modalPopup : System.Web.UI.UserControl

 

 

 

 

 

 

{

 

 

protected string tid;

 

 

 

public ModalPopupExtender Notification

 

 

{

 

 

get { return ModalPopupExtenderNotification1; }

 

 

 

set { ModalPopupExtenderNotification1 = value; }

 

 

}

 

 

public Panel customPanel

 

 

{

 

 

get { return customPopupPanel1; }

 

 

 

set { customPopupPanel1 = value; }

 

 

}

 

 

public HiddenField Hidden

 

 

{

 

 

get { return HiddenField1; }

 

 

 

set { HiddenField1 = value; }

 

 

}

 

 

public String TransID

 

 

{

 

 

get { return tid; }

 

 

 

set { tid = value; }

 

 

}

 

 

public void ShowMessage(string popupText,Control control, string css)

 

 

{

 

masterPopupLabel1.CssClass = css;

 

masterPopupLabel1.Text = popupText;

 

 

if (control != null)

 

 

{

 

control.Visible =

true;

 

 

customPopupPanel1.Controls.Add(control);

 

}

 

ModalPopupExtenderNotification1.Show();

 

}

 

 

public void HideMessage()

 

 

{

 

ModalPopupExtenderNotification1.Hide();

 

}

 

 

protected void Page_Load(object sender, EventArgs e)

 

 

{

 

 

 

}

 

}

 

}

 

 

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 17 Jun 2011, 08:49 AM
Hello sener,

 I assume the problem is that the dynamic controls that you add in the modal popup extender are not always initialized correctly. If this is the case you should check the ShowMessage method to see if it is executed as expected. Also note that when adding multiple instances of the same user control its initialization code will be executed for each record so you should check whether you have some conditions that prevent initialization of the controls on subsequent passes through this code.
If the problem persists please open a formal support ticket and send us a sample application that reproduces the issue.

Best wishes,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
sener
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or