locked
Problems Positioning Popup Extender After Postback RRS feed

  • Question

  • User865450124 posted

    Please read this entire post before responding and refer to the supplied screen shots to fully understand the problem. There are multiple layers of Ajax controls invovled.

    On the main page, I have Modal Popup Extender that displays a User Control. Within the User Control is a Popup Control that displays another User Control. User Control #2 which resides on User Control #1 is comprised of a GridView with sorting capabilities. I've got code in place that displays User Control #1 following a postback generated from within it. I've got additional code that displays User Control #2 (the one with the GridView) following a post back. The result is that when User Control #2 is sorted, it remains visible. The problem is that after the postback for User Control #2 ocurrs, the control is not displayed at the coordinates specified in the markup. If I hide it and then redisplay it, it will appear at the specified location.

        Protected Sub Page_Load() Handles Me.Load
    
            If TextBoxShowCompanyFacilitySelector.Text = "-1" Then
                Dim PopupControlSelectCompanyFacilityId As Object = FormViewContactDetail.FindControl("PopupControlSelectCompanyFacilityId")
                PopupControlSelectCompanyFacilityId.Show()
            End If
    
        End Sub

    These screen shots show the desired and actual behaviors.

    [URL=http://news.webshots.com/photo/2149471790103504187XSwLyV][IMG]http://thumb7.webshots.net/t/83/83/4/71/79/2149471790103504187XSwLyV_th.jpg[/IMG][/URL]

    [URL=http://news.webshots.com/photo/2926559560103504187rUreAr][IMG]http://thumb7.webshots.net/t/83/83/5/59/56/2926559560103504187rUreAr_th.jpg[/IMG][/URL]


    Monday, September 6, 2010 3:36 PM

Answers

  • User865450124 posted

    Its all now a moot point. I had to go with a custom Modal Popup and scrap the AJAX which in doing so eliminated this problem. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 13, 2010 1:54 PM

All replies

  • User-1102123764 posted

    Hi,

    Would you please post your markups of the two user controls and how you use them in your test page?

    We can't guess the reason only according to your description.

     

    Tuesday, September 7, 2010 10:43 PM
  • User865450124 posted

    Here's the source for the page.

    <%@ Page Language="VB" Title="Telephone Directory" AutoEventWireup="false" CodeFile="DirectoryMaintenance.aspx.vb"
    Inherits="_DirectoryMaintenance" MasterPageFile="../../masterpages/Directory.master" %>
    
    <%@ MasterType VirtualPath="../../masterpages/Directory.master" %>
    <%@ Register Src="../../controls/contactdetail.ascx" TagName="ContactDetail" TagPrefix="tfc" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
    
    <asp:Content ContentPlaceHolderID="main" runat="server">
    
    <div class="DirectoryHeader">
    
        <table class="DirectoryDetail" style="background-color: #000066">
                <tr>
                    <!-- needed for proper alignment -->
                    <td class="hideElement">
                    </td>
                    <td>
                        <div class="IconDelegates" style="background-color: #000066; color: White; font-weight: bold">
                             
                        </div>
                    </td>
                    <td class="ColumnDetailName" style="background-color: #000066; color: White; font-weight: bold;text-align: center">
                        <div class="NameFull">
                            Name
                        </div>
                    </td>
                    <td>
                        <div class="IconTimeZone" style="background-color: #000066; color: White; font-weight: bold">
                             
                        </div>
                    </td>
                    <td class="ColumnDetailTelephone" style="background-color: #000066; color: White;font-weight: bold; text-align: center">
                        <div class="PhoneExternalDial">
                            External Dial
                        </div>
                    </td>
                    <td class="ColumnDetailExtension" style="background-color: #000066; color: White;font-weight: bold; text-align: center">
                        <div class="PhoneExtension">
                            Extension
                        </div>
                    </td>
                    <td class="ColumnDetailTelephone" style="background-color: #000066; color: White;font-weight: bold; text-align: center">
                        <div class="PhoneMobile">
                            Fax
                        </div>
                    </td>
                    <td class="ColumnDetailPTT" style="background-color: #000066; color: White; font-weight: bold;text-align: center">
                        <div class="PhoneDirectConnect">
                            PTT
                        </div>
                    </td>
                    <td class="ColumnDetailTelephone" style="background-color: #000066; color: White;font-weight: bold; text-align: center">
                        <div class="PhoneMobile">
                            Cell Phone
                        </div>
                    </td>
                    <td>
                        <div class="IconFax" style="background-color: #000066; color: White; font-weight: bold">
                             
                        </div>
                    </td>
                </tr>
            </table>
    </div>
    
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="0">
        <ProgressTemplate>
            <div id="updateProgressDiv" style="display:block;padding:5px;border-style:solid;border-width:2px;;z-index:100;top:303px;left:409px;width:175px;background-color:#000066">
                <table>
                    <tr>
                        <td valign="middle"><img src="../../images/loader.gif" alt="Loading..." /></td>
                        <td valign="middle"><div class="label" style="width:136px;padding:0px 0px 5px 0px;margin-left:7px;font-size:12pt;color:#FFFFFF;border:solid yellow;border-width:0px 0px 2px 0px">Please Wait...</div></td>
                    </tr>
                </table>
             </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    
     <asp:UpdatePanel ID="UpdatePanel1" runat="server">
         <ContentTemplate>
            <div class="DirectoryPanel" ID="DirectoryPanel">
                <asp:Repeater ID="RepeaterDirectory" enableviewstate="false" runat="server" OnItemDataBound="RepeaterDirectory_ItemDataBound" OnItemCommand="RepeaterDirectory_ItemCommand">
                    <ItemTemplate>
                        <asp:SqlDataSource [Edited] >
                            <SelectParameters>
                                <asp:Parameter Name="ContactId" />
                            </SelectParameters>
                        </asp:SqlDataSource>
    
                        <!-- onRowDataBound programically alters the cssClass so that an AlternatingItemTemplate is not needed -->
                        <asp:Table ID="DirectoryDetail" runat="server" CssClass="DirectoryDetail" EnableViewState="false">
                            <asp:TableRow id="DirectoryItem" runat="server" EnableViewState="False">
                                <asp:TableCell runat="server" CssClass="hideElement" EnableViewState="False">
                                    <div><%#Eval("ContactId") %></div>
                                </asp:TableCell><asp:TableCell runat="server" VerticalAlign="Top" EnableViewState="False">
                                    <div class="IconDelegates">
                                         <asp:LinkButton ID="LinkButtonEdit" runat="server" CommandName="Edit" CommandArgument='<%#Eval("ContactId") %>' Text="Edit" CssClass="hideElement" />
                                    </div>
                                </asp:TableCell><asp:TableCell runat="server" CssClass="ColumnDetailName" EnableViewState="False">
                                    <div class="NameFull" style="overflow-x:hidden;word-wrap:break-word">
                                        <%#Eval("DisplayName")%>
                                    </div>
                                    <div style="font-size:8pt;width:250px;display:table-row">
                                        <div style="width:120px;float:left;display:table-cell">
                                            <%#Eval("Title")%>
                                        </div>
                                        <div style="width:120px;float:right;text-align:right;display:table-cell">
                                            <%#Eval("Department")%>
                                        </div>
                                    </div>
                               </asp:TableCell><asp:TableCell runat="server" EnableViewState="False">
                                    <div class="IconTimeZone">
                                        
                                    </div>
                                </asp:TableCell><asp:TableCell runat="server" CssClass="ColumnDetailTelephone" EnableViewState="False">
                                    <div class="PhoneExternalDial">
                                        <asp:label runat="server" id="LabelPhoneDirect" Text='<%#getDisplayText(Eval("PhoneDirect").ToString, Eval("PhoneDirectTemporary").ToString, Eval("PhoneTemporaryInformationExpirationDate"))%>' />
                                    </div>
                                </asp:TableCell><asp:TableCell runat="server" CssClass="ColumnDetailExtension" EnableViewState="False">
                                    <div class="PhoneExtension">
                                        <asp:label runat="server" id="LabelPhoneExtension" Text='<%#getDisplayText(Eval("PhoneExtension").ToString, Eval("PhoneExtensionTemporary").ToString, Eval("VOIPDialingAvailable"), Eval("VOIPDialingPrefix"), Eval("PhoneTemporaryInformationExpirationDate"))%>' />
                                    </div>
                                </asp:TableCell><asp:TableCell ID="TableCell1" runat="server" CssClass="ColumnDetailTelephone" EnableViewState="False">
                                    <div class="PhoneMobile">
                                        <asp:label runat="server" id="LabelPhoneFax" Text='<%#getDisplayText(Eval("PhoneFax").ToString, Eval("PhoneFaxTemporary").ToString, Eval("PhoneTemporaryInformationExpirationDate"))%>' />
                                    </div>
                                </asp:TableCell><asp:TableCell runat="server" CssClass="ColumnDetailPTT" EnableViewState="False">
                                    <div class="PhoneDirectConnect">
                                        <asp:label runat="server" id="LabelPhoneDirectConnect" Text='<%#getDisplayText(Eval("PhoneDirectConnect").ToString, Eval("PhoneDirectConnectTemporary").ToString, Eval("PhoneTemporaryInformationExpirationDate"))%>' />
                                    </div>
                                </asp:TableCell><asp:TableCell runat="server" CssClass="ColumnDetailTelephone" EnableViewState="False">
                                    <div class="PhoneMobile">
                                        <asp:label runat="server" id="LabelPhoneMobile" Text='<%#getDisplayText(Eval("PhoneMobile").ToString, Eval("PhoneMobileTemporary").ToString, Eval("PhoneTemporaryInformationExpirationDate"))%>' />
                                    </div>
                                </asp:TableCell><asp:TableCell ID="tableCell13A" runat="server" EnableViewState="False">
                                    <!-- place holder for future ability to create fax cover sheets -->
                                    <div class="IconFax">
                                    </div>
                                </asp:TableCell><asp:TableCell runat="server" EnableViewState="False" CssClass="ColumnDetailResponsibility">
                                    <div class="Responsibility">
                                        
                                    </div>
                                </asp:TableCell></asp:TableRow></asp:Table></ItemTemplate></asp:Repeater></div><table class="DirectoryFooter" style="background-color: Silver; border-bottom: 0px">
                <tr>
                    <td width="25%" align="left">
    
                    </td>
                    <td width="50%" align="center">
                        <asp:Panel runat="server" ID="RepeaterPagesParent">
                        </asp:Panel>
                    </td>
                    <td width="25%">
                          </td></tr></table><table class="DirectoryFooter" style="background-color: Silver">
                <tr>
                    <td width="33%">
                         <asp:Label ID="ResultsAdvisory" runat="server" />
                    </td>
                    <td width="33%" align="center">
                        <span>
                            <asp:LinkButton ID="LnkFirst" runat="server" Text="<< First" OnClick="lnkFirst_Click" class="LinkButtonSelectorSilverBackground" />
                        </span>
                        <span>
                            <asp:LinkButton ID="LnkPrev" runat="server" Text="< Previous" OnClick="lnkPrev_Click" class="LinkButtonSelectorSilverBackground" />
                        </span>
                        <span>
                            <asp:LinkButton ID="LnkNext" runat="server" Text="Next >" OnClick="lnkNext_Click" class="LinkButtonSelectorSilverBackground" />
                        </span>
                        <span>
                            <asp:LinkButton ID="LnkLast" runat="server" Text="Last >>" OnClick="lnkLast_Click" class="LinkButtonSelectorSilverBackground" />
                        </span>
                    </td>
                    <td width="33%" align="right">
                        Results Per Page <asp:DropDownList ID="NumberOfResultsPerPage" runat="server" class="GenericControl" AutoPostBack="true">
                            <asp:ListItem>50</asp:ListItem><asp:ListItem>100</asp:ListItem><asp:ListItem>150</asp:ListItem></asp:DropDownList></td></tr></table><table class="DirectoryFooter" style="background-color: #FFFFFF; border-top: 0px">
                <tr>
                    <td class="DirectoryFooterTableCellLeft">
                         Search By Name  <asp:TextBox ID="SearchInput" runat="server" CssClass="searchinput" EnableViewState="True" AutoPostBack="True" />
                          <img id="SearchImage" runat="server" src="../../images/Search.ico" alt="Search" title="Search Entire Directory" style="; top: 2px; cursor: hand" /> </td><td id="FooterTableCellRight" class="DirectoryFooterTableCellRight">
                        <asp:Panel ID="PanelSearchByLetter" runat="server" />
                    </td>
                </tr>
     </table>
    
    <ajax:ModalPopupExtender ID="ModalPopupContactDetail" runat="server" TargetControlID="ContactDetailDummyTarget" X="156" Y="150"
        PopupControlID="ContactDetail" BackgroundCssClass="modalBackground" BehaviorID="BehaviorModalPopupContactDetail" />
    
    <tfc:ContactDetail runat="server" ID="UserControlContactDetail" Title="ContactDetail" ContactId="0" EnableViewState="true" />   
        
    <div id="ContactDetailDummyTarget" runat="server" style="display:none"></div>
    <asp:TextBox ID="TextBoxShowContactDetail" runat="server" style="display:none" />
    
    </ContentTemplate>
    </asp:UpdatePanel> </asp:Content>

    The code behind that displays the Upper Most User Control

        Protected Sub Page_Load() Handles Me.Load
    
            If TextBoxShowContactDetail.Text = "-1" Then
                ModalPopupContactDetail.Show()
            End If
    
            Dim ClientSideJavaScript As New StringBuilder
    
            ClientSideJavaScript.Append("/*File: DirectoryMaintenance.aspx.vb Sub: Page_Load*/" & Chr(10))
            ClientSideJavaScript.Append("function HideContactDetailModalPopup()" & Chr(10))
            ClientSideJavaScript.Append("{" & Chr(10))
            ClientSideJavaScript.Append("document.getElementById('" & TextBoxShowContactDetail.ClientID & "').value='0';" & Chr(10))
            ClientSideJavaScript.Append("$find('BehaviorModalPopupContactDetail').hide();" & Chr(10))
            ClientSideJavaScript.Append("}" & Chr(10))
    
            ClientScript.RegisterClientScriptBlock(Me.GetType, "ContactModalPopup", ClientSideJavaScript.ToString, True)
    
        End Sub
    
        Protected Sub RepeaterDirectory_ItemDataBound(ByVal sender As Object, ByVal e As RepeaterItemEventArgs)
    
            If e.Item.ItemType = ListItemType.Header Then
                Dim DirectoryNameDisplay = CType(e.Item.FindControl("DirectoryNameDisplay"), Label)
                Dim SortOrderDisplay = CType(e.Item.FindControl("SortOrderDisplay"), Label)
                DirectoryNameDisplay.Text = DirectoryNameDisplayText & " " & SearchStringDisplayText
                SortOrderDisplay.Text = SortOrderDisplayText
            End If
    
            If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
    
                Dim LinkButtonEdit As LinkButton = CType(e.Item.FindControl("LinkButtonEdit"), LinkButton)
    
                Dim DirectoryItemTable As Table = CType(e.Item.FindControl("DirectoryDetail"), Table)
                DirectoryItemTable.Attributes.Add("onMouseOver", "this.className='DirectoryDetailHighlight';")
    
                Dim functionName As String
                functionName = "javascript:__doPostBack('" & LinkButtonEdit.UniqueID & "'" + "," + "'')"
                DirectoryItemTable.Attributes.Add("onclick", functionName)
    
                If e.Item.ItemType = ListItemType.Item Then
                    DirectoryItemTable.Attributes.Add("onMouseOut", "this.className='DirectoryDetail';")
                End If
    
                If e.Item.ItemType = ListItemType.AlternatingItem Then
                    DirectoryItemTable.Attributes.Add("onMouseOut", "this.className='DirectoryDetailAlternatingItem';")
                    DirectoryItemTable.CssClass = "DirectoryDetailAlternatingItem"
                End If
    
            End If
    
        End Sub
    
        Protected Sub RepeaterDirectory_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles RepeaterDirectory.ItemCommand
    
            Select Case e.CommandName
                Case "Edit"
                    UserControlContactDetail.ContactId = e.CommandArgument
                    TextBoxShowContactDetail.Text = -1
                    ModalPopupContactDetail.Show()
                Case Else
            End Select
    
        End Sub
    

    Markup for User Control #1

    <%@ Control Language="VB" AutoEventWireup="false" CodeFile="ContactDetail.ascx.vb" Inherits="ContactDetail" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
    <%@ Register Src="../controls/Selector.ascx" TagName="Selector" TagPrefix="tfc" %>
    
    <style type="text/css">
        .SelectorRow
        {
            font-weight:normal;
            color:#000000;
            background-color:#FFFFFF
        }
        .SelectorAlternatingRow
        {   
            font-weight:normal;
            color:#000000;
            background-color:#E7E7FF
        }
        .SelectorRowHighlight
        {
            font-weight:bold;
            color:#FFFFFF;
            background-color:#000066;
            cursor:hand;
        }
        .SelectorSortOrderLinkButton
        {
            font-weight:bold;
            color:Blue
        }
        .SelectorCell
        {
            overflow-x:hidden;
            word-wrap:break-word;
            border-style:solid;
            border-width:0px 0px 1px 0px;
            border-color:#000000
        }
    
    </style>
    
    <script type="text/javascript">
    
        function setValue(ParentPopup, TargetDisplayControl, NewDisplayValue, TargetTextboxControl, NewKeyValue) {
            document.getElementById(TargetDisplayControl).innerHTML = NewDisplayValue;
            document.getElementById(TargetTextboxControl).value = NewKeyValue;
            var popup = $find(ParentPopup);
            popup.hidePopup();
        }
    
    </script>
    
    <div id="ContactDetail" style="display:block;float:left;width:700px;background:#FFFFFF;font-family:Tahoma;border:solid 3px #000000">
                <asp:SqlDataSource ID="SqlDataSourceContactDetails" runat="server"
                    ConnectionString="<%$ ConnectionStrings:Mercury %>" />
    
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="0">
        <ProgressTemplate>
            <div id="updateProgressDiv" style="display:block;padding:5px;border-style:solid;border-width:2px;;z-index:100;top:150px;left:250px;width:175px;background-color:#000066">
                <table>
                    <tr>
                        <td valign="middle"><img src="../../images/loader.gif" alt="Loading..." /></td>
                        <td valign="middle"><div class="label" style="width:136px;padding:0px 0px 5px 0px;margin-left:7px;font-size:12pt;color:#FFFFFF;border:solid yellow;border-width:0px 0px 2px 0px">Please Wait...</div></td>
                    </tr>
                </table>
             </div>
    
        </ProgressTemplate>
    </asp:UpdateProgress>
    
            <asp:FormView ID="FormViewContactDetail" runat="server" DefaultMode="Edit" style="margin:-1px -1px -1px -1px;background-color:#E7E7FF"
                DataSourceID="SqlDataSourceContactDetails" OnItemCreated="FormViewContactDetail_ItemCreated" OnItemCommand="FormViewContactDetail_ItemCommand" DataKeyNames="Id">
            <EditItemTemplate>
    
            <table style="background-color:#000066;color:#FFFFFF;font-weight:bold;margin:-1px -1px -1px -1px" cellpadding="5">
                <tr>
                    <td style="width:550px;font-size:10pt">
                        <asp:label runat="server" ID="LabelTitle" Text='<%#Eval("DisplayName") %>' />
                    </td>
                    <td style="width:150px;text-align:right">
                        <asp:linkbutton runat="server" ID="LinkButtonSave" CommandName="Save" CommandArgument='<%#Eval("Id") %>' Text="Save" Font-Bold="false" ForeColor="#FFFFFF" />
                          
                        <span class="pseudoLink" style="color:#FFFFFF;font-weight:normal;cursor:hand" onclick="HideContactDetailModalPopup();">Close</span>
                    </td>
                </tr>
            </table>
                    
                    <div style="width:100%">
                    <div style="display:table;width:677px;margin-left:auto;margin-right:auto">
    
                        <table style="margin-top:10px;padding-bottom:7px;font-weight:bold">
                            <tr>
                                <td style="width:655px;font-weight:bold">
                                    Permanent Contact Information
                                </td>
                                <td></td>
                            </tr>
                        </table>
                        <table style="width:100%;border:solid 1px #000000;background-color:#FFFFFF">
                            <tr>
                                <td>
                                    <div style="font-weight:bold;width:130px;padding-left:3px">
                                        Direct Dial
                                    </div>
                                </td>
                                <td>
                                    <div style="font-weight:bold;width:130px">
                                        Extension
                                    </div>
                                </td>
                                <td>
                                    <div style="font-weight:bold;width:130px">
                                        Fax
                                    </div>
                                </td>
                                <td>
                                    <div style="font-weight:bold;width:130px">
                                        PTT
                                    </div>
                                </td>
                                <td>
                                      <div style="font-weight:bold;width:130px">
                                        Cell Phone
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <div style="width:125px;padding-left:3px">
                                        <asp:TextBox runat="server" style="font-family:Tahoma;font-size:10pt;width:120px" ID="TextBoxPhoneDirect" Text='<%#Bind("PhoneDirect")%>' />
                                    </div>
                                </td>
                                <td>
                                    <div style="width:125px">
                                        <asp:TextBox runat="server" style="font-family:Tahoma;font-size:10pt;width:120px" ID="TextBoxPhoneExtension" Text='<%#Bind("PhoneExtension")%>' />
                                    </div>
                                </td>
                                <td>
                                    <div style="width:125px">
                                        <asp:TextBox runat="server" style="font-family:Tahoma;font-size:10pt;width:120px" ID="TextBoxPhoneFax" Text='<%#Bind("PhoneFax")%>' />
                                    </div>
                                </td>
                                <td>
                                    <div style="width:125px">
                                        <asp:TextBox runat="server" style="font-family:Tahoma;font-size:10pt;width:120px" ID="TextBoxPhoneDirectConnect" Text='<%#Bind("PhoneDirectConnect")%>' />
                                    </div>
                                </td>
                                <td>
                                    <div style="width:125px">
                                        <asp:TextBox runat="server" style="font-family:Tahoma;font-size:10pt;width:120px" ID="TextBoxPhoneMobile" Text='<%#Bind("PhoneMobile")%>' />
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="5" style="font-size:8pt">
                                        <asp:RegularExpressionValidator runat="server" ID="Validator_TextBoxPhoneDirect" ControlToValidate="TextBoxPhoneDirect"  
                                            Display="Dynamic" ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}"  
                                            ErrorMessage="<br /><b>Invalid Direct Dial Number</b> -Value cannot contain any letters and must be in the format  (###)[space]###-####" />                             
                                        <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator5" ControlToValidate="TextBoxPhoneExtension"  
                                            Display="Dynamic" ValidationExpression="^\d{1,5}$"  
                                            ErrorMessage="<br /><b>Invalid Extension</b> -Value cannot contain any letters and must be 5 characters or less" /> 
                                        <asp:RegularExpressionValidator runat="server" ID="Validator_TextBoxPhoneFax" ControlToValidate="TextBoxPhoneFax"  
                                            Display="Dynamic" ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}"  
                                            ErrorMessage="<br /><b>Invalid Fax Number</b> -Value cannot contain any letters and must be in the format  (###)[space]###-####" /> 
                                        <asp:RegularExpressionValidator runat="server" ID="Validator_TextBoxPhoneDirectConnect" ControlToValidate="TextBoxPhoneDirectConnect"  
                                            Display="Dynamic" ValidationExpression="^(?=^.{9,13}$)\d+\*\d+\*\d+$"  
                                            ErrorMessage="<br /><b>Invalid Direct Connect</b> -Value cannot contain any letters or special characters other than astericks and must have between 9 and 13 numbers" /> 
                                        <asp:RegularExpressionValidator runat="server" ID="Validator_TextBoxPhoneMobile" ControlToValidate="TextBoxPhoneMobile"  
                                            Display="Dynamic" ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}"  
                                            ErrorMessage="<br /><b>Invalid Cell Phone</b> -Value cannot contain any letters and must be in the format  (###)[space]###-####" />  
                                </td>
                            </tr>
                        </table>
    
                        <table style="margin-top:10px;padding-bottom:7px;font-weight:bold">
                            <tr>
                                <td style="width:655px;font-weight:bold">
                                    Temporary Contact Information
                                </td>
                                <td><asp:Image ID="ImageButtonClearAllTemporaryInformation" runat="server" ImageUrl="../../images/clear2.ico" ToolTip="Clear Temporary Information" /></td>
                            </tr>
                        </table>
                        <table style="width:100%;border:solid 1px #000000;background-color:#FFFFFF">
                            <tr>
                                <td>
                                    <div style="font-weight:bold;width:130px;padding-left:3px">
                                        Direct Dial
                                    </div>
                                </td>
                                <td>
                                    <div style="font-weight:bold;width:130px">
                                        Extension
                                    </div>
                                </td>
                                <td>
                                    <div style="font-weight:bold;width:130px">
                                        Fax
                                    </div>
                                </td>
                                <td>
                                    <div style="font-weight:bold;width:130px">
                                        PTT
                                    </div>
                                </td>
                                <td>
                                      <div style="font-weight:bold;width:130px">
                                        Cell Phone
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <div style="width:125px;padding-left:3px">
                                        <asp:TextBox runat="server" style="font-family:Tahoma;font-size:10pt;width:120px" ID="TextBoxPhoneDirectTemporary" Text='<%#Bind("PhoneDirectTemporary")%>' />
                                    </div>
                                </td>
                                <td>
                                    <div style="width:125px">
                                        <asp:TextBox runat="server" style="font-family:Tahoma;font-size:10pt;width:120px" ID="TextBoxPhoneExtensionTemporary" Text='<%#Bind("PhoneExtensionTemporary")%>' />
                                    </div>
                                </td>
                                <td>
                                    <div style="width:125px">
                                        <asp:TextBox runat="server" style="font-family:Tahoma;font-size:10pt;width:120px" ID="TextBoxPhoneFaxTemporary" Text='<%#Bind("PhoneFaxTemporary")%>' />
                                    </div>
                                </td>
                                <td>
                                    <div style="width:125px">
                                        <asp:TextBox runat="server" style="font-family:Tahoma;font-size:10pt;width:120px" ID="TextBoxPhoneDirectConnectTemporary" Text='<%#Bind("PhoneDirectConnectTemporary")%>' />
                                    </div>
                                </td>
                                <td>
                                    <div style="width:125px">
                                        <asp:TextBox runat="server" style="font-family:Tahoma;font-size:10pt;width:120px" ID="TextBoxPhoneMobileTemporary" Text='<%#Bind("PhoneMobileTemporary")%>' />
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="5" style="font-size:8pt">
                                        <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator1" ControlToValidate="TextBoxPhoneDirectTemporary"  
                                            Display="Dynamic" ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}"  
                                            ErrorMessage="<br /><b>Invalid Direct Dial Number</b> -Value cannot contain any letters and must be in the format  (###)[space]###-####" />                             
                                        <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator6" ControlToValidate="TextBoxPhoneExtensionTemporary"  
                                            Display="Dynamic" ValidationExpression="^\d{1,5}$"  
                                            ErrorMessage="<br /><b>Invalid Extension</b> -Value cannot contain any letters and must be 5 characters or less" /> 
                                        <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator2" ControlToValidate="TextBoxPhoneFaxTemporary"  
                                            Display="Dynamic" ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}"  
                                            ErrorMessage="<br /><b>Invalid Fax Number</b> -Value cannot contain any letters and must be in the format  (###)[space]###-####" /> 
                                        <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator3" ControlToValidate="TextBoxPhoneDirectConnectTemporary"  
                                            Display="Dynamic" ValidationExpression="^(?=^.{9,13}$)\d+\*\d+\*\d+$"  
                                            ErrorMessage="<br /><b>Invalid Direct Connect</b> -Value can only contain numbers and astericks and must bein the format [numbers]*[numbers]*[numbers]" /> 
                                        <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator4" ControlToValidate="TextBoxPhoneMobileTemporary"  
                                            Display="Dynamic" ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}"  
                                            ErrorMessage="<br /><b>Invalid Cell Phone Number</b> -Value cannot contain any letters and must be in the format  (###)[space]###-####" />  
                                </td>
                            </tr>
                        </table>
    
                        <table style="margin-top:10px;padding-bottom:7px;font-weight:bold">
                            <tr>
                                <td style="width:655px;font-weight:bold">
                                    Miscellaneous Information
                                </td>
                                <td></td>
                            </tr>
                        </table>
                        <table style="width:100%;border:solid 1px #000000;background-color:#FFFFFF">
                            <tr>
                                <td>
                                    <div style="font-weight:bold;width:130px;padding-left:3px">
                                        Title
                                    </div>
                                </td>
                                <td>
                                    <div style="width:526px">
                                        <asp:Image ID="ImageSelectTitle" runat="server" ImageUrl="../../images/search.ICO" ToolTip="Select Title" style="cursor:hand" />
                                        <asp:Image runat="server" ID="ImageButtonClearTitle" ImageUrl="../../images/clear2.ico" AlternateText="Clear Title"  CommandName="ClearTitle" style="cursor:hand" />
                                        <ajax:PopupControlExtender Id="PopupControlSelectTitleId" runat="server" OffsetX="20" OffsetY="-200"
                                            TargetControlID="ImageSelectTitle" PopupControlID="PanelUserControlHtmlComboBoxSelectTitleId" BehaviorID="PopupControlSelectTitleId" />
                                        <asp:Panel id="PanelUserControlHtmlComboBoxSelectTitleId" runat="server" style="display:none">
                                        <tfc:Selector ID="SelectorTitleId" runat="server" ParentPopupControlId="PopupControlSelectTitleId"
                                            SelectStatement = "SELECT Id,Title FROM Titles" DisplayTargetControl="LabelTitle_Update" DisplaySourceField="Title" InputTargetControl="TextBoxTitle_Update" InputSourceField="Id"
                                            DefaultOrderByStatement="ORDER BY Title" ControlHeight="200"
                                            ColumnCount="1" ColumnHeads="Title" ColumnWidths="225px" SourceFields="Title" Title="Select Title" />
                                         </asp:Panel>
                                        <asp:Label ID="LabelTitle_Update" runat="server" Text='<%#Eval("Title") %>' />
                                        <asp:TextBox runat="server" ID="TextBoxTitle_Update" style="display:none" Text='<%#Eval("TitleId") %>' />
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <div style="font-weight:bold;width:130px;padding-left:3px">
                                        Department
                                    </div>
                                </td>
                                <td>
                                    <div style="width:526px">
                                        <asp:Image runat="server" ID="ImageSelectDepartment" ImageUrl="../../images/search.ICO" ToolTip="Select Department" style="cursor:hand" />  
                                        <asp:Image runat="server" ID="ImageButtonClearDepartment" ImageUrl="../../images/clear2.ico" AlternateText="Clear Department"  CommandName="ClearDepartment" style="cursor:hand" />
                                        <ajax:PopupControlExtender Id="PopupControlSelectDepartmentId" runat="server" OffsetX="20" OffsetY="-200" 
                                            TargetControlID="ImageSelectDepartment" PopupControlID="PanelSelectDepartmentId" BehaviorID="PopupControlSelectDepartmentId" />
                                        <asp:Panel id="PanelSelectDepartmentId" runat="server" style="display:none">
                                        <tfc:Selector ID="SelectorDepartmentId" runat="server" ParentPopupControlId="PopupControlSelectDepartmentId"
                                            SelectStatement = "SELECT Id, Name FROM Departments" DisplayTargetControl="LabelDepartment_Update" DisplaySourceField="Name" InputTargetControl="TextBoxDepartment_Update" InputSourceField="Id"
                                            DefaultOrderByStatement="ORDER BY Name" ControlHeight="200"
                                            ColumnCount="1" ColumnHeads="Department" ColumnWidths="225px" SourceFields="Name" Title="Select Department" />
                                        </asp:Panel>
                                        <asp:Label ID="LabelDepartment_Update" runat="server" Text='<%#Eval("DepartmentName") %>' /> 
                                        <asp:TextBox runat="server" ID="TextBoxDepartment_Update" style="display:none" Text='<%#Eval("DepartmentId") %>' />
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <div style="font-weight:bold;width:130px;padding-left:3px">
                                        Branch
                                    </div>
                                </td>
                                <td>
                                    <div style="width:526px">
                                        <asp:image id="ImageSelectBranch" runat="server" ImageUrl="../../images/search.ICO" ToolTip="Select Branch" style="cursor:hand" />  
                                        <asp:image runat="server" ID="ImageButtonClearBranch" ImageUrl="../../images/clear2.ico" AlternateText="Clear Branch"  CommandName="ClearBranch" style="cursor:hand" />
                                        <ajax:PopupControlExtender Id="PopupControlSelectBranchId" runat="server" OffsetX="20" OffsetY="-200"
                                            TargetControlID="ImageSelectBranch" PopupControlID="PanelSelectBranchId" BehaviorID="PopupControlSelectBranchId" />
                                        <asp:Panel id="PanelSelectBranchId" runat="server" style="display:none">
                                        <tfc:Selector ID="SelectorBranchId" runat="server"  OffsetX="5" OffsetY="5" ParentPopupControlId="PopupControlSelectBranchId" EnableSorting="True"
                                            SelectStatement = "SELECT Id ,NameLong FROM Branches" DisplayTargetControl="LabelBranchName_Update" DisplaySourceField="NameLong" InputTargetControl="TextBoxBranchName_Update" InputSourceField="Id"
                                            DefaultOrderByStatement="ORDER BY Id" ControlHeight = "200"
                                            ColumnCount="2" ColumnHeads="Branch,Name" ColumnWidths="50px,175px" SourceFields="Id,NameLong" Title="Select Branch" />
                                        </asp:Panel>  
                                        <asp:Label ID="LabelBranchName_Update" runat="server" Text='<%#Eval("BranchName") %>' style="border:solid 0px #000000" /> 
                                        <asp:TextBox runat="server" ID="TextBoxBranchName_Update" style="display:none" Text='<%#Eval("BranchId") %>' />
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <div style="font-weight:bold;width:130px;padding-left:3px">
                                        Company Facility
                                    </div>
                                </td>
                                <td>
                                    <div style="width:526px">
                                        <asp:Image id="ImageButtonSelectCompanyFacility" runat="server" ImageUrl="../../images/search.ICO" ToolTip="Select Company Facility" style="cursor:hand" /> 
                                        <asp:Image runat="server" ID="ImageButtonClearCompanyFacility" ImageUrl="../../images/clear2.ico" AlternateText="Clear Company Facility"  CommandName="ClearCompanyFacility" style="cursor:hand" />
                                        
    This is one of four Popup Extenders on User Control #1 that does not properly position when the GridView contained within it does a postback.
                                        <ajax:PopupControlExtender Id="PopupControlSelectCompanyFacilityId" runat="server" OffsetX="0" OffsetY="-285"
                                            TargetControlID="ImageButtonSelectCompanyFacility" PopupControlID="PanelSelectCompanyFacilityId" BehaviorID="PopupControlSelectCompanyFacilityId" />
                                        <asp:Panel id="PanelSelectCompanyFacilityId" runat="server" style="display:none"> 
                                        <tfc:Selector ID="Selector1" runat="server" ParentPopupControlId="PopupControlSelectCompanyFacilityId" EnableSorting="True"
                                            DisplayTargetControl="LabelCompanyFacilityDescription_Update" DisplaySourceField="NameLong" InputTargetControl="TextBoxCompanyFacilityDescription_Update" InputSourceField="Id"
                                            SelectStatement = "SELECT [Id],[NameLong],[AddressCity],[StateLongName],[AddressCountry] FROM [vw_FacilityInformation_WithStateLongName] WHERE [FacilityType] = 'C'"
                                            DefaultOrderByStatement="ORDER BY AddressCountry, StateLongName, AddressCity, NameLong" ControlHeight="200"
                                            ColumnCount="4" ColumnHeads="Country,State,City,Facility" ColumnWidths="75px,125px,125px,300px" SourceFields="AddressCountry,StateLongName,AddressCity,NameLong" Title="Select Company Facility" />
                                        </asp:Panel> 
                                        <asp:Label ID="LabelCompanyFacilityDescription_Update" runat="server" Text='<%#Eval("CompanyFacilityDescription") %>' /> 
                                        <asp:TextBox runat="server" ID="TextBoxCompanyFacilityDescription_Update" style="display:none" Text='<%#Eval("CompanyFacilityId") %>' />
                                    </div>
                                </td>
                            </tr>
                        </table>
                    <div style="margin-bottom:15px">
                        <asp:Label runat="server" ID="LabelAdvisoryMessage" Font-Size="8pt" ForeColor="Red" Font-Bold="true" Text="" />
                    </div>
                    </div>
                    </div>
            </EditItemTemplate> 
            </asp:FormView> 
           
            <asp:TextBox ID="TextBoxShowCompanyFacilitySelector" runat="server" style="display:none" />
    
    </div>

    None of the code behind to User Control #1 operates on User Control #2. This is be design to ensure that User Control #2 can be used anywhere.

    Markup for User Control #2. The control pulls data from an underlying datasource to provide a multiple column combobox-type control that is sortable and allows the user to click on a row to select it. It is the Modal Popup Extender that houses this control that is not being properly positioned when the control does a post-back. The control does a post-back when the user sorts the GridView.

    <%@ Control Language="VB" AutoEventWireup="false" CodeFile="Selector.ascx.vb" Inherits="content_WebUserControl" %>
    
    <style type="text/css">
        .SelectorRow
        {
            font-weight:normal;
            color:#000000;
            background-color:#FFFFFF
        }
        .SelectorAlternatingRow
        {   
            font-weight:normal;
            color:#000000;
            background-color:#E7E7FF
        }
        .SelectorRowHighlight
        {
            font-weight:bold;
            color:#FFFFFF;
            background-color:#000066;
            cursor:hand;
        }
        .SelectorSortOrderLinkButton
        {
            font-weight:bold;
            color:Blue
        }
        .SelectorCell
        {
            overflow-x:hidden;
            word-wrap:break-word;
            border-style:solid;
            border-width:0px 0px 1px 0px;
            border-color:#000000
        }
    </style>
    
    <asp:Panel id="PanelSelector" runat="server" style="display:block;font-family:Tahoma;font-size:8pt;border:solid 2px #000000">
    
        <div runat="server" id="SelectCompanyFacilityId" style="display:block;background-color:#000066;font-family:Tahoma;font-size:8pt;color:white">
            <div id="DivLabelSelectorTitle" runat="server" style="color:White;font-weight:bold;padding:5px"> 
                <asp:label runat="server" ID="LabelSelectorTitle" />
            </div>
            <div style="background-color:#E7E7FF;color:#000000;border:solid #000000;border-width:0px 0px 1px 0px">
                <asp:PlaceHolder runat="server" ID="PlaceHolderSelectorHead" />
            </div>
            <asp:panel runat="server" id="PanelGridViewSelectorParent" style="overyflow-x:hidden;overflow-y:scroll">
                <asp:SqlDataSource ID="SqlDataSourceSelector" runat="server" ConnectionString="<%$ ConnectionStrings:Mercury %>" OnInit="SqlDataSourceSelector_OnInit" />
                <asp:GridView runat="server" id="GridViewSelector" DataSourceID="SqlDataSourceSelector" AutoGenerateColumns="False" 
                    ShowHeader="False" CellPadding="3" CellSpacing="0" OnRowDataBound="GridViewSelector_OnRowDataBound" EnableViewState="false">
                    <RowStyle CssClass="SelectorRow" />
                    <AlternatingRowStyle CssClass="SelectorAlternatingRow" />
                </asp:GridView> 
            </asp:panel>
        </div>
    
    </asp:Panel>
    

    User Control #2 Code Behind

    Imports Microsoft.VisualBasic
    Imports System.Data
    Imports System.Data.SqlClient
    Imports System.Web.UI
    
    Partial Class content_WebUserControl
        Inherits System.Web.UI.UserControl
        Public Property SelectStatement() As String
            Get
                Return _SelectStatement
            End Get
            Set(ByVal value As String)
                _SelectStatement = value
            End Set
        End Property
        Private _SelectStatement As String
        Public Property ColumnHeads() As String
            Get
                Return _ColumnHeads
            End Get
            Set(ByVal value As String)
                _ColumnHeads = value
            End Set
        End Property
        Private _ColumnHeads As String
        Public Property SourceFields() As String
            Get
                Return _SourceFields
            End Get
            Set(ByVal value As String)
                _SourceFields = value
            End Set
        End Property
        Private _SourceFields As String
        Public Property ControlHeight() As String
            Get
                Return _ControlHeight
            End Get
            Set(ByVal value As String)
                _ControlHeight = value
            End Set
        End Property
        Private _ControlHeight As String
        Public Property ColumnWidths() As String
            Get
                Return _ColumnWidths
            End Get
            Set(ByVal value As String)
                _ColumnWidths = value
            End Set
        End Property
        Private _ColumnWidths As String
        Public Property ColumnCount() As String
            Get
                Return _ColumnCount
            End Get
            Set(ByVal value As String)
                _ColumnCount = value
            End Set
        End Property
        Private _ColumnCount As String
        Public Property Title() As String
            Get
                Return _Title
            End Get
            Set(ByVal value As String)
                _Title = value
            End Set
        End Property
        Private _Title As String
    
        Public Property DisplayTargetControl() As String
            Get
                Return _DisplayTargetControl
            End Get
            Set(ByVal value As String)
                _DisplayTargetControl = value
            End Set
        End Property
        Private _DisplayTargetControl As String
        Public Property InputTargetControl() As String
            Get
                Return _InputTargetControl
            End Get
            Set(ByVal value As String)
                _InputTargetControl = value
            End Set
        End Property
        Private _InputTargetControl As String
        Public Property DisplaySourceField() As String
            Get
                Return _DisplaySourceField
            End Get
            Set(ByVal value As String)
                _DisplaySourceField = value
            End Set
        End Property
        Private _DisplaySourceField As String
        Public Property InputSourceField() As String
            Get
                Return _InputSourceField
            End Get
            Set(ByVal value As String)
                _InputSourceField = value
            End Set
        End Property
        Private _InputSourceField As String
        Public Property ParentPopupControlId() As String
            Get
                Return _ParentPopupControlId
            End Get
            Set(ByVal value As String)
                _ParentPopupControlId = value
            End Set
        End Property
        Private _ParentPopupControlId As String
        Public Property EnableSorting() As String
            Get
                Return _EnableSorting
            End Get
            Set(ByVal value As String)
                _EnableSorting = value
            End Set
        End Property
        Private _EnableSorting As String
        Public Property DefaultOrderByStatement() As String
            Get
                Return _DefaultOrderByStatement
            End Get
            Set(ByVal value As String)
                _DefaultOrderByStatement = value
            End Set
        End Property
        Private _DefaultOrderByStatement As String
        Public Property OnSelectScript() As String
            Get
                Return _OnSelectScript
            End Get
            Set(ByVal value As String)
                _OnSelectScript = value
            End Set
        End Property
        Private _OnSelectScript As String
        Dim SQLStatement As String
        Protected Sub Page_Load() Handles Me.Load
    
            Dim ClientSideJavaScript As New StringBuilder
    
            LabelSelectorTitle.Text = Me.Title
            Call LoadData()
    
            ClientSideJavaScript.Append("/*File: Selector.aspx.vb Sub: Page_Load()*/" & Chr(10))
            ClientSideJavaScript.Append("function setValue(ParentPopup, TargetDisplayControl, NewDisplayValue, TargetTextboxControl, NewKeyValue) {" & Chr(10))
            ClientSideJavaScript.Append("document.getElementById(TargetDisplayControl).innerHTML = NewDisplayValue;" & Chr(10))
            ClientSideJavaScript.Append("document.getElementById(TargetTextboxControl).value = NewKeyValue;" & Chr(10))
            ClientSideJavaScript.Append("var popup = $find(ParentPopup);" & Chr(10))
            ClientSideJavaScript.Append("popup.hidePopup();" & Chr(10))
            If Len(Me.OnSelectScript) > 0 Then
                ClientSideJavaScript.Append(Me.OnSelectScript & ";" & Chr(10))
            End If
            ClientSideJavaScript.Append("}")
    
    
    
            Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "SelectorUserControlJavaScript", ClientSideJavaScript.ToString, True)
    
        End Sub
        Protected Sub LoadData()
    
            Dim NewTable As Table
            Dim NewRow As TableRow
            Dim NewCell As TableCell
    
            Dim NewColumn As BoundField
    
            Dim ArrayColumnHeads As Array = Split(Me.ColumnHeads, ",")
            Dim ArrayColumnWidths As Array = Split(ColumnWidths, ",")
            Dim ArrayFieldNames As Array = Split(Me.SourceFields, ",")
            Dim GridViewWidth As Integer
    
            Dim NewLinkButton As LinkButton
            Dim NewPanel As Panel
    
            Dim i As Integer
    
            'Setup the headers for the column
            NewTable = New Table
            NewRow = New TableRow
    
            NewTable.CellSpacing = 0
            NewTable.CellPadding = 3
    
            If Me.EnableSorting = "True" Then
                For i = 0 To Me.ColumnCount - 1
                    NewLinkButton = New LinkButton
                    NewLinkButton.Text = ArrayColumnHeads(i)
                    NewLinkButton.CommandName = "Sort"
                    NewLinkButton.CommandArgument = ArrayFieldNames(i)
                    NewLinkButton.CssClass = "SelectorSortOrderLinkButton"
    
                    AddHandler NewLinkButton.Command, AddressOf ChangeSortOrder
    
                    NewPanel = New Panel
                    NewPanel.Controls.Add(NewLinkButton)
                    NewPanel.Style.Add("width", CStr((CInt(Replace(ArrayColumnWidths(i), "px", "")) - 10)) & "px")
    
                    NewCell = New TableCell
                    NewCell.Controls.Add(NewPanel)
                    NewRow.Controls.Add(NewCell)
                Next
            Else
                For i = 0 To Me.ColumnCount - 1
                    NewCell = New TableCell
                    NewCell.Text = "<div style='overflow-x:hidden;word-wrap:break-word;font-weight:bold;width:" & CStr((CInt(Replace(ArrayColumnWidths(i), "px", "")) - 10)) & "px" & "'>" & ArrayColumnHeads(i) & "</div>"
                    NewRow.Controls.Add(NewCell)
                Next
            End If
    
            NewTable.Controls.Add(NewRow)
            PlaceHolderSelectorHead.Controls.Add(NewTable)
    
            'Setup the Gridview detail
            While GridViewSelector.Columns.Count > 0
                GridViewSelector.Columns.RemoveAt(0)
            End While
    
            For i = 0 To Me.ColumnCount - 1
                NewColumn = New BoundField
                NewColumn.DataField = ArrayFieldNames(i)
                NewColumn.ItemStyle.Width = CInt(Replace(ArrayColumnWidths(i), "px", "")) - 10
                NewColumn.ItemStyle.CssClass = "SelectorCell"
                GridViewWidth = GridViewWidth + CInt(Replace(ArrayColumnWidths(i), "px", ""))
                GridViewSelector.Columns.Add(NewColumn)
            Next i
    
            SelectCompanyFacilityId.Style.Add("width", CStr(GridViewWidth + 16) & "px")
            DivLabelSelectorTitle.Style.Add("width", CStr(GridViewWidth + 16) & "px")
            PanelSelector.Style.Add("width", CStr(GridViewWidth + 16) & "px")
            PanelGridViewSelectorParent.Style.Add("height", CStr(Me.ControlHeight) & "px")
            PanelGridViewSelectorParent.Style.Add("width", CStr(GridViewWidth + 16) & "px")
            GridViewSelector.Width = GridViewWidth
    
        End Sub
        Protected Sub ChangeSortOrder(ByVal sender As LinkButton, ByVal e As System.EventArgs)
    
            SqlDataSourceSelector.SelectCommand = Me.SelectStatement & " ORDER BY " & sender.CommandArgument
            GridViewSelector.DataBind()
    
            Dim ParentPopup As AjaxControlToolkit.PopupControlExtender = CType(Parent.NamingContainer.FindControl(Me.ParentPopupControlId), AjaxControlToolkit.PopupControlExtender)
    
        End Sub
    
        Protected Sub SqlDataSourceSelector_OnInit() Handles GridViewSelector.Init
    
            SqlDataSourceSelector.SelectCommand = Me.SelectStatement & " " & Me.DefaultOrderByStatement
    
        End Sub
    
        Protected Sub GridViewSelector_OnRowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
    
            If e.Row.RowType = DataControlRowType.DataRow Then
    
                'Deal with the regular items here    
                If e.Row.RowState = DataControlRowState.Normal Then
                    e.Row.CssClass = "SelectorRow"
                    e.Row.Attributes.Add("onmouseout", "this.className='SelectorRow';")
                    e.Row.Attributes.Add("onclick", "setValue('" & Me.ParentPopupControlId & "','" & Me.Parent.NamingContainer.ClientID & "_" & Me.DisplayTargetControl & "','" & e.Row.DataItem(Me.DisplaySourceField) & "','" & Me.Parent.NamingContainer.ClientID & "_" & Me.InputTargetControl & "','" & e.Row.DataItem(Me.InputSourceField) & "')")
                End If
    
                'Deal with the alternating items here    
                If e.Row.RowState = DataControlRowState.Alternate Then
                    e.Row.CssClass = "SelectorAlternatingRow"
                    e.Row.Attributes.Add("onmouseout", "this.className='SelectorAlternatingRow';")
                    e.Row.Attributes.Add("onclick", "setValue('" & Me.ParentPopupControlId & "','" & Me.Parent.NamingContainer.ClientID & "_" & Me.DisplayTargetControl & "','" & e.Row.DataItem(Me.DisplaySourceField) & "','" & Me.Parent.NamingContainer.ClientID & "_" & Me.InputTargetControl & "','" & e.Row.DataItem(Me.InputSourceField) & "')")
                End If
    
                e.Row.Attributes.Add("onmouseover", "this.className='SelectorRowHighlight';")
    
            End If
            LabelSelectorTitle.Text = LabelSelectorTitle.Text
    
        End Sub
    
    End Class






     

    Wednesday, September 8, 2010 11:28 AM
  • User-1102123764 posted

    Hi,

    Please create a UpdatePanel surround the GridView.

    Or call the CType(Me.Parent.NamingContainer.FindControl("ModalPopupControl"), AjaxControlToolkit.PopupControlExtender).Show() at the end of event in the postback button.

        Protected Sub ChangeSortOrder(ByVal sender As LinkButton, ByVal e As System.EventArgs)
    
            SqlDataSourceSelector.SelectCommand = Me.SelectStatement & " ORDER BY " & sender.CommandArgument
            GridViewSelector.DataBind()
    
            Dim ParentPopup As AjaxControlToolkit.PopupControlExtender = CType(Parent.NamingContainer.FindControl(Me.ParentPopupControlId), AjaxControlToolkit.PopupControlExtender)
            
            ParentPopup.Show()
        End Sub
    


     

    Wednesday, September 8, 2010 9:29 PM
  • User865450124 posted

    Hi,

    Please create a UpdatePanel surround the GridView.

    Or call the CType(Me.Parent.NamingContainer.FindControl("ModalPopupControl"), AjaxControlToolkit.PopupControlExtender).Show() at the end of event in the postback button.

    1. Protected Sub ChangeSortOrder(ByVal sender As LinkButton, ByVal e As System.EventArgs)   
    2.   
    3.     SqlDataSourceSelector.SelectCommand = Me.SelectStatement & " ORDER BY " & sender.CommandArgument   
    4.     GridViewSelector.DataBind()   
    5.   
    6.     Dim ParentPopup As AjaxControlToolkit.PopupControlExtender = CType(Parent.NamingContainer.FindControl(Me.ParentPopupControlId), AjaxControlToolkit.PopupControlExtender)   
    7.        
    8.     ParentPopup.Show()   
    9. End Sub  
        Protected Sub ChangeSortOrder(ByVal sender As LinkButton, ByVal e As System.EventArgs)
    
            SqlDataSourceSelector.SelectCommand = Me.SelectStatement & " ORDER BY " & sender.CommandArgument
            GridViewSelector.DataBind()
    
            Dim ParentPopup As AjaxControlToolkit.PopupControlExtender = CType(Parent.NamingContainer.FindControl(Me.ParentPopupControlId), AjaxControlToolkit.PopupControlExtender)
            
            ParentPopup.Show()
        End Sub

     

    I added the Update Panel around the GridView AND added ParentPopup.Show and neither worked. Its still being displayed in the wrong position after the postback. I did have to Dim ParentPopup as an Object as intellisense wasn't recognizing .Show() even after I Imported the AjaxToolkit library.

    Thursday, September 9, 2010 10:22 AM
  • User865450124 posted

    Nix that. I was looking at the production page and not the development page.

    Placing the GridView in an update panel didn't have any effect.

    I attemped to explicity call the .Show method, but it was still mispositioning the Popup.

    I then explicity set the OffsetX and OffsetY which seemed to address the problem somewhat.

    Thursday, September 9, 2010 10:30 AM
  • User-1102123764 posted

    Hi,

  • Protected Sub Page_Load() Handles Me.Load   
  •   
  •     If TextBoxShowCompanyFacilitySelector.Text = "-1" Then   
  •         Dim PopupControlSelectCompanyFacilityId As Object = FormViewContactDetail.FindControl("PopupControlSelectCompanyFacilityId")   
  •         PopupControlSelectCompanyFacilityId.Show()   
  •     End If   
  •   
  • End Sub  

PopupControlSelectCompanyFacilityId is PopupControlExtender, you can't define it as Object, we need to define it as PopupControlExtender.

Dim PopupControlSelectCompanyFacilityId As PopupControlExtender= FormViewContactDetail.FindControl("PopupControlSelectCompanyFacilityId")

It seem to be that you deploy the PopupControlExtender in the UserControl #1, so if you want to find the control in the user control #1 from another usercontrol, you need to find the UserControl #1 first and then find the ModalPopup extender. For example,

Protected Sub ChangeSortOrder(ByVal sender As LinkButton, ByVal e As System.EventArgs)

        SqlDataSourceSelector.SelectCommand = Me.SelectStatement & " ORDER BY " & sender.CommandArgument
        GridViewSelector.DataBind()

        Dim ParentPopup As AjaxControlToolkit.PopupControlExtender = CType(Parent.NamingContainer.FindControl("UserControl1ID").FindControl("PopupControlExtenderID"), AjaxControlToolkit.PopupControlExtender)
       
        ParentPopup.Show()
End Sub

 

Thursday, September 9, 2010 9:15 PM
  • User865450124 posted

    Its all now a moot point. I had to go with a custom Modal Popup and scrap the AJAX which in doing so eliminated this problem. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 13, 2010 1:54 PM