I have a Modal Popup Extender in my application that displays a gridview that is populated in the behind code with a dataset. The TargetControlID is just a hidden button that is not use, except to fulfill the extender's requirements. I have used this extender
in other projects and it worked fine, but for this one it is throwing this error:
I have tested everything and it works fine, the dataset populates the gridview inside the updatepanel inside a panel, I allowed the TargetControlID button be shown and when pressed it popups the empty panel (this because the gridview is not populated). However when you put it all together it does not work. I am on a bit of a time crunch so any help would be greatly appreciated.
Thank you for the link, but it was no help. None of my factors exist in that tutorial, I know and understand how the Modal Popup Extender works, what I do not understand is why it is not working for me under these conditions. I have tested everything and
it should work, my call to the data layer returns a dataset which does populate the gridview when I do not use the extender.
I am going to try something and I will let you know if it works, but in the mean time if you guys come across something that could help please post it.
The event is you enter persons last name and click the search button, it checks the database with people with that last name. If there is more then one entry then it should popup with a gridview with all entries with the same last name so you can choose.
When it get to this point it throw the error in the original post.
I have strip it down to just a empty panel and a button and when I call it from the codebehind I get the same error. For some reason it will not let me use it from codebehind. I have other apps that use it in a similar way and they work great, but not
this one. I am banging my head against the wall, not to mention I am on a time crunch.
goug76
Member
66 Points
51 Posts
Modal Popup Extender throwing error
Aug 11, 2012 01:27 PM|LINK
I have a Modal Popup Extender in my application that displays a gridview that is populated in the behind code with a dataset. The TargetControlID is just a hidden button that is not use, except to fulfill the extender's requirements. I have used this extender in other projects and it worked fine, but for this one it is throwing this error:
Microsoft JScript runtime error: Object expected document.getElementById('Content_vsCustomer').dispose = function() { Array.remove(Page_ValidationSummaries, document.getElementById('Content_vsCustomer')); } (function() {var fn = function() {Sys.Extended.UI.ModalPopupBehavior.invokeViaServer('Content_mpeSearch', true); Sys.Application.remove_load(fn);};Sys.Application.add_load(fn);})();I have tested everything and it works fine, the dataset populates the gridview inside the updatepanel inside a panel, I allowed the TargetControlID button be shown and when pressed it popups the empty panel (this because the gridview is not populated). However when you put it all together it does not work. I am on a bit of a time crunch so any help would be greatly appreciated.
ASPX CODE
<asp:Button ID="bntSearchPopup" runat="server" CssClass="hidden" /> <asp:Panel ID="pnlSearch" runat="server" CssClass="popup"> <asp:UpdatePanel ID="udpSearch" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:GridView ID="gvSearch" runat="server" AutoGenerateColumns="false" DataKeyNames="CustFName, CustPhone"> <Columns> <asp:CommandField ShowSelectButton="true" /> <asp:BoundField DataField="CustFName" HeaderText="First Name" SortExpression="CustFName" /> <asp:BoundField DataField="CustLName" HeaderText="Last Name" SortExpression="CustLName" /> <asp:BoundField DataField="CustPhone" HeaderText="Phone#" SortExpression="CustPhone" /> </Columns> </asp:GridView> </ContentTemplate> </asp:UpdatePanel> </asp:Panel> <ajaxToolkit:ModalPopupExtender ID="mpeSearch" runat="server" TargetControlID="bntSearchPopup" PopupControlID="pnlSearch" DropShadow="true"> </ajaxToolkit:ModalPopupExtender>ASPX.CS CODE
CSS CODE
.popup { width: 350px; height: auto; padding: 20px; text-align: center; background-color: #eee; color: #000; -webkit-border-radius:0px 10px 10px 10px; -moz-border-radius-bottomleft:10px; -moz-border-radius-topleft:0px; -moz-border-radius-bottomright:10px; -moz-border-radius-topright:10px; } .hidden { display: none; }Tim Cadieux
Participant
966 Points
317 Posts
Re: Modal Popup Extender throwing error
Aug 11, 2012 03:01 PM|LINK
There's another example here
http://everymanprogrammer.com/index.php/using-the-ajax-modalpopup-a-beginners-guide/
***
Mark the replies as Answers if they answered your question.
goug76
Member
66 Points
51 Posts
Re: Modal Popup Extender throwing error
Aug 12, 2012 02:11 AM|LINK
Thank you for the link, but it was no help. None of my factors exist in that tutorial, I know and understand how the Modal Popup Extender works, what I do not understand is why it is not working for me under these conditions. I have tested everything and it should work, my call to the data layer returns a dataset which does populate the gridview when I do not use the extender.
I am going to try something and I will let you know if it works, but in the mean time if you guys come across something that could help please post it.
Tim Cadieux
Participant
966 Points
317 Posts
Re: Modal Popup Extender throwing error
Aug 12, 2012 03:55 AM|LINK
When you say it 'doesn't work', is it not popping up, the gridview is empty, etc.?
***
Mark the replies as Answers if they answered your question.
goug76
Member
66 Points
51 Posts
Re: Modal Popup Extender throwing error
Aug 12, 2012 03:37 PM|LINK
The event is you enter persons last name and click the search button, it checks the database with people with that last name. If there is more then one entry then it should popup with a gridview with all entries with the same last name so you can choose. When it get to this point it throw the error in the original post.
Ramesh Chand...
Star
12922 Points
2672 Posts
Re: Modal Popup Extender throwing error
Aug 12, 2012 05:07 PM|LINK
Can you please tell use what the error you are getting ?
goug76
Member
66 Points
51 Posts
Re: Modal Popup Extender throwing error
Aug 12, 2012 05:16 PM|LINK
Microsoft JScript runtime error: Object expected
goug76
Member
66 Points
51 Posts
Re: Modal Popup Extender throwing error
Aug 12, 2012 05:19 PM|LINK
I have strip it down to just a empty panel and a button and when I call it from the codebehind I get the same error. For some reason it will not let me use it from codebehind. I have other apps that use it in a similar way and they work great, but not this one. I am banging my head against the wall, not to mention I am on a time crunch.
Allen Li - M...
Star
10411 Points
1196 Posts
Re: Modal Popup Extender throwing error
Aug 13, 2012 07:39 AM|LINK
Hi, please remove the UpdatePanel and check the result again:
<asp:Button ID="bntSearchPopup" runat="server" CssClass="hidden" /> <asp:Panel ID="pnlSearch" runat="server" CssClass="popup"> <asp:GridView ID="gvSearch" runat="server" AutoGenerateColumns="false" DataKeyNames="CustFName, CustPhone"> <Columns> <asp:CommandField ShowSelectButton="true" /> <asp:BoundField DataField="CustFName" HeaderText="First Name" SortExpression="CustFName" /> <asp:BoundField DataField="CustLName" HeaderText="Last Name" SortExpression="CustLName" /> <asp:BoundField DataField="CustPhone" HeaderText="Phone#" SortExpression="CustPhone" /> </Columns> </asp:GridView> </asp:Panel> <ajaxtoolkit:modalpopupextender id="mpeSearch" runat="server" targetcontrolid="bntSearchPopup" popupcontrolid="pnlSearch" dropshadow="true"> </ajaxtoolkit:modalpopupextender>If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework