Wednesday, March 21, 2012

ModalPop-Up

Hello,

On my web form I have a repeater control which has a link button as the ItemTemplate.

<asp:RepeaterID="rptMyFavoriteReports"runat="server"OnItemCommand="rptMyFavoriteReports_ItemCommand">

<ItemTemplate>

<asp:ImageID="Image1"runat="server"<b><%#DataBinder.Eval(Container.DataItem,"ReportName") %></b> (<ahref="#"class="anchor">More Information</a>)

<asp:Linkbuttonid="lnkBtn"runat="server"CssClass="anchor">Remove</asp:Linkbutton><br/>

</ItemTemplate>

</asp:repeater>

When the user clicks on this link button the Modal Pop-up should show up. When i set the the modal pop-up extender properties as TargetControlsID="linkbutton:

<atlasTools:ModalPopupExtenderID="ModalPopupExtender1"runat="server">

<atlasTools:ModalPopupProperties

TargetControlID="lnkBtn"

PopupControlID="Panel1"

OkControlID="OkButton"

CancelControlID="CancelButton"

OnOkScript="OnOK()"/>

</atlasTools:ModalPopupExtender>

i get the following error.

Object reference not set to an instance of an object.

NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.AtlasControlExtender.ExtenderControlBase`2.ConnectDataBindingHandlers() +276
Microsoft.AtlasControlExtender.ExtenderControlBase`2.OnInit(EventArgs e) +45
System.Web.UI.Control.InitRecursive(Control namingContainer) +459
System.Web.UI.Control.InitRecursive(Control namingContainer) +271
System.Web.UI.Control.InitRecursive(Control namingContainer) +271
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1739

Any sugesstion how to over come this.

Thanks!!

Hi Radhikap,

Try putting the whole extender inside the repeater's ItemTemplate.

Thanks,
Ted

Hello Ted,

It worked like a charm Thank you

Radhika


Another Problem

my modal pop-up has yes or no options.When the user clicks on yes i have the onOkScript to a javascript function.

my Qs is how do i get the javascript to raise the event repeater_ItemCommand event of the repeater control.

Thanks!!

Radhika


Can you have the onOkScript code end by "clicking" (via .onclick()) a suitable element in the repeater control? I think people have had some success with this approach in the past.

No comments:

Post a Comment