ravish.tiwari
New Member
I am using an ASP button in a DataList control to pop up an AjaxPopupExtender. However the following error is being thrown:Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.Markup:\[code\]<asp:HiddenField ID="ModalPopUpHidden" runat="server" /><cc1:ModalPopupExtender ID="mdlComments" runat="server" CancelControlID="btnCancelComment" PopupControlID="pnlComments" TargetControlID="ModalPopUpHidden" PopupDragHandleControlID="PopupHeader" Drag="true" BackgroundCssClass="ModalPopupBG"></cc1:ModalPopupExtender><aspanel ID="pnlComments" Style="display: none" runat="server"> <div class="popup_Container"> <div class="popup_Titlebar" id="PopupHeader"> Comment </div> <div class="popup_Body"> <asp:TextBox ID="txtPopupComment" runat="server" MaxLength="500" TextMode="MultiLine" Width="200" Height="200"> </asp:TextBox> </div> <div class="popup_Buttons"> <asp:Button id="btnSaveComment" type="button" value="http://stackoverflow.com/questions/12775366/Save" runat="server" Text="Save" CommandName="SaveComment" /> <input id="btnCancelComment" type="button" value="http://stackoverflow.com/questions/12775366/Cancel"/> </div> </div></aspanel>\[/code\]Code-Behind:\[code\]protected void dtListBids_ItemCommand(object source, DataListCommandEventArgs e){ if (e.CommandName == "Comments") { AjaxControlToolkit.ModalPopupExtender mdlComments = (AjaxControlToolkit.ModalPopupExtender)e.Item.FindControl("mdlComments"); BidId = Convert.ToInt64(dtListBids.DataKeys[0]); mdlComments.Show(); }}\[/code\]