Ok, here is what I ended up doing.
1. put a grid view in an update panel with an id of "GridView1" Mine is bound to an objectdatasource called society.
<asp:Panel ID="collapse" runat="server" CssClass="collapsePanel">
<atlas:UpdatePanel runat="server" ID="up">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="society">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="MiddleName" HeaderText="MiddleName" SortExpression="MiddleName" />
<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="Gender" HeaderText="Gender" SortExpression="Gender" />
<asp:BoundField DataField="BirthDate" HeaderText="BirthDate" SortExpression="BirthDate" />
<asp:BoundField DataField="Address1" HeaderText="Address1" SortExpression="Address1" />
<asp:BoundField DataField="Address2" HeaderText="Address2" SortExpression="Address2" />
<asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
<asp:BoundField DataField="State" HeaderText="State" SortExpression="State" />
<asp:BoundField DataField="Zip" HeaderText="Zip" SortExpression="Zip" />
</Columns>
</asp:GridView>
</ContentTemplate>
</atlas:UpdatePanel>
2. Add a second update panel set to Mode="Always" and put an asp:Textbox in it with the ID "popupID", style="display:none" and EnableViewState="False" This textbox' value will be set in the code behind with the id of the mpe you wish to open. If you don;t set this panel to Mode="Always", the textbox won't write out its new value when you change it in the code behind.
<atlas:UpdatePanel runat="server" ID="up2" Mode="Always" RenderMode="Inline">
<ContentTemplate>
<asp:TextBox runat="server" ID="popupID" Style="display: none;" EnableViewState="false"></asp:TextBox>
</ContentTemplate>
</atlas:UpdatePanel>
3. Add your modalpopupextender to the page. Make sure to add an ID attribute to the ModalPopupProperties with the ID of "mpepop" Also add a hidden button to your page to dummy up something for the mpe to point at. You'll still want your command button in the grid to postback so you can do any work necessary to filter the data if needed for your popup. If you point the mpe at your command button, you'll lose your postback.
<atlasToolkit:ModalPopupExtender ID="mpe" runat="server">
<atlasToolkit:ModalPopupProperties TargetControlID="hiddenbutton" PopupControlID="form" BackgroundCssClass="modalBackground" DropShadow="false" OkControlID="OkButton" CancelControlID="CancelButton" ID="mpepop" />
</atlasToolkit:ModalPopupExtender>
<div style="display: none">
<asp:LinkButton ID="hiddenbutton" runat="server"></asp:LinkButton>
</div>
4. Add a hidden div with the ID "bindingstatus"
<div id="bindingstatus" style="display: none;">
</div>
5. Add your popup content div with the id of "form"
<div style="display: none">
<asp:Panel ID="form" runat="server" CssClass="modalPopup">
<asp:Button ID="OkButton" runat="server" Text="OK"></asp:Button>
<asp:Button ID="CancelButton" runat="server" Text="Cancel"></asp:Button>
</asp:Panel>
</div>
6. Now for the stuff that makes it all work. You need to add your own binding to the xml-script at the bottom of your page. Add the following to the components section of the xml. This points at the hidden div you created. It will cause the javascript function indicated in the transform property to fire after the page has finished loading and the atlas stuff has been initialized. In the transformerArgument I put the client ID of our hidden textbox. It is hardcoded for now, which needs to be fixed. Eventually I'll be adding this binding from code so I will have access to not hardcode it then.
<control id="bindingstatus">
<bindings>
<binding dataContext="_PageRequestManager"
dataPath="inPostBack"
property="associatedElement"
propertyKey="innerHTML"
transform="deferredPopup"
transformerArgument="popupID"
direction="In"
/>
</bindings>
</control>
7. Add a javascript funtion called deferredPopup that the binding will call. I added this script block to the page after the xml-script. This gets the textbox whose value should be the ID of the popup to open. Then it calls the _show method on that popup.
function deferredPopup(sender, e) {
var component = document.getElementById(e.get_transformerArgument());
if(component.value != '') {
var popup = $object(component.value);
if(popup) {
component.value = '';
popup._show();
}
else {
debug.trace('component not found...');
}
}
}
8. Add the code to the selectedIndexChanged event of your GridView to set the ID of the popup you wish to open in your hidden textbox.
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
popupID.Text = "mpepop";
}
I know that this still needs some polish, but it works. If anyone has any ideas on how to make this better, or if I have gone completely the wrong direction, let me know.
Thanks,
Stoney