+ Reply to Thread
Results 1 to 8 of 8

Thread: ModalPopupExtender.Hide() - Weird

  1. #1
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    ModalPopupExtender.Hide() - Weird

    Hi guys

    I have managed to open my ModalPopupExtender from code behind using:
    Code:
    ModalPopupExtender.Show()
    
    But I cannot use:
    Code:
    ModalPopupExtender.Hide()
    
    But I can use it in the same Sub where I use:
    Code:
    ModalPopupExtender.Show()
    
    makes no sense to me??

  2. #2
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    this is my Sub that opens the ModalPopupExtender:
    Code:
    Public Sub Populate_ModalPopup(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
            Dim mySuppliers As Suppliers = New Suppliers
    
            'loop over all the items in rpActiveList repeater
            Dim hdn_idkey As String = sender.CommandArgument
            mySuppliers.Idkey = CInt(hdn_idkey)
            mySuppliers = SuppliersManager.GetItem(mySuppliers.Idkey)
    
            hdn_sID.Value = mySuppliers.Idkey
    
            txtName.Text = mySuppliers.Name
            txtContact.Text = mySuppliers.Contact
            txtMobile.Text = mySuppliers.Mobile
            txtEmail.Text = mySuppliers.Email
    
            txtTel.Text = mySuppliers.Tel
            txtFax.Text = mySuppliers.Fax
            txtWeb.Text = mySuppliers.Web
    
            txtPhysical.Text = mySuppliers.Physical
            txtPostal.Text = mySuppliers.Postal
    
            ModalPopupExtender1.Show()
        End Sub
    
    and here's my aspx page, relevent code only:
    Code:
    <asp:Repeater ID="rpActiveList" runat="server" OnItemDataBound="rpActive_OnItemDataBound" OnItemCommand="rpActive_OnItemCommand">
                                    <ItemTemplate>
                                        <asp:HiddenField ID="hdn_idkey" runat="server" Value='<%#Eval("Idkey")%>' />
                                        <tr>
                                            <td><%#Eval("Name")%></td>
                                            <td><%#Eval("Contact")%></td>
                                            <td><%#Eval("Mobile")%></td>
                                            <td><%#Eval("Tel")%></td>
                                            <td><%#Eval("Web")%></td>
                                            <td align="right">
                                                <asp:ImageButton ID="btnEdit" ImageUrl="../Icons/edit.png" runat="server" OnClick="Populate_ModalPopup" CommandArgument='<%#Eval("Idkey")%>' />
                                                <asp:ImageButton ID="btnDeactivate" runat="server" CommandName="Deactivate" CommandArgument='<%#Eval("Idkey")%>' ImageUrl="../Icons/delete.png" />
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                    <AlternatingItemTemplate>
                                        <asp:HiddenField ID="hdn_idkey" runat="server" Value='<%#Eval("Idkey")%>' />
                                        <tr class="tableAlternateData">
                                            <td><%#Eval("Name")%></td>
                                            <td><%#Eval("Contact")%></td>
                                            <td><%#Eval("Mobile")%></td>
                                            <td><%#Eval("Tel")%></td>
                                            <td><%#Eval("Web")%></td>
                                            <td align="right">
                                                <asp:ImageButton ID="btnEdit" ImageUrl="../Icons/edit.png" runat="server" OnClick="Populate_ModalPopup" CommandArgument='<%#Eval("Idkey")%>' />
                                                <asp:ImageButton ID="btnDeactivate" runat="server" CommandName="Deactivate" CommandArgument='<%#Eval("Idkey")%>' ImageUrl="../Icons/delete.png" />
                                            </td>
                                        </tr>
                                    </AlternatingItemTemplate>
                                </asp:Repeater>
                            </asp:Panel>
                        </table>
                    </div>
                </asp:Panel>
                
                <!-- ==============| Update Moodal Window |============== -->
                <asp:Panel ID="pnlUpdateContent" runat="server" CssClass="modalPopup" style="display:none;">
                    <table width="100%" border="0" cellspacing="0" cellpadding="1px">
                        <tr>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtName" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtContact" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtMobile" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtEmail" runat="server"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtTel" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtFax" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtWeb" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"></td>
                        </tr>
                        <tr>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtPhysical" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtPostal" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"></td>
                            <td class="generalPadding" style="width:25%;"></td>
                        </tr>
                        <tr>
                            <td class="generalPadding" colspan="4">
                                <asp:HiddenField ID="hdn_sID" runat="server" />
                                <asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="update_details" />
                                <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <asp:Button ID="btn_hiddenModal" runat="server" Style="display: none" /> 
                <asp:Button ID="btn_closeModal" runat="server" Style="display: none" /> 
                <ajaxtoolkit:ModalPopupExtender 
                 ID="ModalPopupExtender1" 
                 BackgroundCssClass="progressBackgroundFilter" 
                 BehaviorID="ModalPopupExtender1"  
                 PopupControlID="pnlUpdateContent"
                 TargetControlID="btn_hiddenModal" 
                 CancelControlID="btn_closeModal" 
                 DropShadow="false" 
                 runat="server">
                </ajaxtoolkit:ModalPopupExtender>
                <!-- ==============| END Update Moodal Window |============== -->
    

  3. #3
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Shem,

    Remove this:
    Code:
    <asp:Button ID="btn_closeModal" runat="server" Style="display: none" />
    
    You should have one button for closing the modalpopup and it should be inside the ContentTemplate of the UpdatePanel. I think I might have done that incorrectly in my first example in your other thread.

    Code:
    <asp:UpdatePanel ID="pnlUpdateContent" UpdateMode="Conditional" runat="server">
        <ContentTemplate>
            <asp:Button ID="btn_closeModal" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
    
    The ModalPopupExtender.Hide() method should be called from the click event of btn_closeModal AND from your save event.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  4. #4
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    here's my almost full aspx page, everything is in my UpdatePanel:
    Code:
    <asp:Content ID="Suppliers" ContentPlaceHolderID="ContentContainer" Runat="Server">
        <asp:UpdateProgress ID="updateProgress" runat="server">
            <ProgressTemplate>
                <asp:Panel ID="backgroundFilter" runat="server" CssClass="progressBackgroundFilter">
                </asp:Panel>
                
                <asp:Panel ID="Message" runat="server" CssClass="processMessage">
                    <center>
                        <asp:Image ID="loader" runat="server" ImageAlign="AbsMiddle" ImageUrl="~/images/ajax-loader.gif" />
                        Updating ...
                    </center>
                </asp:Panel>
            </ProgressTemplate>
        </asp:UpdateProgress>
    
        <asp:UpdatePanel ID="UpdatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
            
                <!-- ==============| Add Suppliers |============== -->
                <ajaxToolkit:CollapsiblePanelExtender 
                    ID="AddProjectsCollapsibleControl" 
                    runat="Server" 
                    TargetControlID="pnlAddContent"
                    ExpandControlID="pnlAddTitle" 
                    CollapseControlID="pnlAddTitle" 
                    TextLabelID="lblAddTitleDisplay" 
                    ExpandedText="(Hide Details...)" 
                    CollapsedText="(Show Details...)"
                    Collapsed="False"
                    SuppressPostBack="true" 
                    CollapsedSize="-1">
                </ajaxToolkit:CollapsiblePanelExtender>
                
                <asp:Panel ID="pnlAddTitle" runat="server" CssClass="collapsePanelHeader" >
                    <asp:Label ID="lblAddTitleText" runat="server" Text="Label" Font-Bold="true">Add Suppliers&nbsp;&nbsp;</asp:Label>
                    <asp:Label ID="lblAddTitleDisplay" runat="server">(Show Details...)</asp:Label>
                </asp:Panel>
                
                <asp:Panel ID="pnlAddContent" runat="server" CssClass="collapsePanel">
                    <div class="content_container">
                        <table width="100%" border="0" cellspacing="0" cellpadding="1px">
                            <tr>
                                <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtSvName" runat="server" Text="Company Name"></asp:TextBox></td>
                                <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtSvContact" runat="server" Text="Contact"></asp:TextBox></td>
                                <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtSvMobile" runat="server" Text="Mobile"></asp:TextBox></td>
                                <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtSvEmail" runat="server" Text="Email"></asp:TextBox></td>
                            </tr>
                            <tr>
                                <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtSvTel" runat="server" Text="Tel"></asp:TextBox></td>
                                <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtSvFax" runat="server" Text="Fax"></asp:TextBox></td>
                                <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtSvWeb" runat="server" Text="Website"></asp:TextBox></td>
                                <td class="generalPadding" style="width:25%;"></td>
                            </tr>
                            <tr>
                                <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtSvPhysical" Text="Physical Address" runat="server"></asp:TextBox></td>
                                <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtSvPostal" Text="Postal Address" runat="server"></asp:TextBox></td>
                                <td class="generalPadding" style="width:25%;"></td>
                                <td class="generalPadding" style="width:25%;"></td>
                            </tr>
                            <tr>
                                <td class="generalPadding" colspan="4"><asp:Button ID="btnSave" runat="server" Text="Save" /></td>
                            </tr>
                        </table>
                    </div>
                </asp:Panel>
                
                <!-- ==============| Edit Active Categories |============== -->
                <ajaxToolkit:CollapsiblePanelExtender 
                    ID="ActiveProjectsCollapsibleControl" 
                    runat="Server" 
                    TargetControlID="pnlActiveContent"
                    ExpandControlID="pnlActiveTitle" 
                    CollapseControlID="pnlActiveTitle" 
                    Collapsed="True"
                    TextLabelID="lblActiveProjects" 
                    ExpandedText="(Hide Details...)" 
                    CollapsedText="(Show Details...)"
                    SuppressPostBack="true" 
                    CollapsedSize="-1">
                </ajaxToolkit:CollapsiblePanelExtender>
                
                <asp:Panel ID="pnlActiveTitle" runat="server" CssClass="collapsePanelHeader">
                   <asp:Label ID="lblActiveTitleText" runat="server" Text="Label" Font-Bold="true">Active Suppliers&nbsp;&nbsp;</asp:Label>
                   <asp:Label ID="lblActiveProjects" runat="server">(Show Details...)</asp:Label>
                </asp:Panel>
                
                <asp:Panel ID="pnlActiveContent" runat="server" CssClass="collapsePanel">
                    <div class="content_container">
                        <table width="100%" border="0" cellspacing="2px" cellpadding="1px">
                            <tr>
                                <td align="left" colspan="3">
                                    <asp:LinkButton id="btnPrev" OnClick="Prev_Click"  runat="server" />
                                    <asp:LinkButton id="btnNext" OnClick="Next_Click"  runat="server" />
                                    <asp:Label ID="lblActivePagingPages" runat="server"></asp:Label>
                                </td>
                                <td align="right" colspan="2">
                                    <asp:ImageButton ID="imgbtnActiveSearch" runat="server" ImageUrl="../Icons/search.png" visible="false" />&nbsp;<asp:TextBox ID="txtActiveSearch" runat="server" visible="false"></asp:TextBox>
                                </td>
                            </tr>
                            <asp:Panel ID="pnlActiveSubContent" runat="server">
                                <tr class="tableHeader">
                                    <td>
                                        <asp:LinkButton ID="lbtnActiveName" runat="server" OnClick="ActiveSortbuttons_OnClick" CommandName="name" CommandArgument="desc">
                                            Name
                                        </asp:LinkButton>
                                    </td>
                                    <td>
                                        <asp:LinkButton ID="lbtnActiveContact" runat="server" OnClick="ActiveSortbuttons_OnClick" CommandName="contact" CommandArgument="asc">
                                            Contact
                                        </asp:LinkButton>
                                    </td>
                                    <td>
                                        <asp:LinkButton ID="lbtnActiveMobile" runat="server" OnClick="ActiveSortbuttons_OnClick" CommandName="mobile" CommandArgument="asc">
                                            Mobile
                                        </asp:LinkButton>
                                    </td>
                                    <td>
                                        <asp:LinkButton ID="lbtnActiveTel" runat="server" OnClick="ActiveSortbuttons_OnClick" CommandName="tel" CommandArgument="asc">
                                            Tel
                                        </asp:LinkButton>
                                    </td>
                                    <td colspan="2">
                                         <asp:LinkButton ID="lbtnActiveWeb" runat="server" OnClick="ActiveSortbuttons_OnClick" CommandName="web" CommandArgument="asc">
                                            Website
                                        </asp:LinkButton>
                                    </td>
                                </tr>
                                <asp:Repeater ID="rpActiveList" runat="server" OnItemDataBound="rpActive_OnItemDataBound" OnItemCommand="rpActive_OnItemCommand">
                                    <ItemTemplate>
                                        <asp:HiddenField ID="hdn_idkey" runat="server" Value='<%#Eval("Idkey")%>' />
                                        <tr>
                                            <td><%#Eval("Name")%></td>
                                            <td><%#Eval("Contact")%></td>
                                            <td><%#Eval("Mobile")%></td>
                                            <td><%#Eval("Tel")%></td>
                                            <td><%#Eval("Web")%></td>
                                            <td align="right">
                                                <asp:ImageButton ID="btnEdit" ImageUrl="../Icons/edit.png" runat="server" OnClick="Populate_ModalPopup" CommandArgument='<%#Eval("Idkey")%>' />
                                                <asp:ImageButton ID="btnDeactivate" runat="server" CommandName="Deactivate" CommandArgument='<%#Eval("Idkey")%>' ImageUrl="../Icons/delete.png" />
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                    <AlternatingItemTemplate>
                                        <asp:HiddenField ID="hdn_idkey" runat="server" Value='<%#Eval("Idkey")%>' />
                                        <tr class="tableAlternateData">
                                            <td><%#Eval("Name")%></td>
                                            <td><%#Eval("Contact")%></td>
                                            <td><%#Eval("Mobile")%></td>
                                            <td><%#Eval("Tel")%></td>
                                            <td><%#Eval("Web")%></td>
                                            <td align="right">
                                                <asp:ImageButton ID="btnEdit" ImageUrl="../Icons/edit.png" runat="server" OnClick="Populate_ModalPopup" CommandArgument='<%#Eval("Idkey")%>' />
                                                <asp:ImageButton ID="btnDeactivate" runat="server" CommandName="Deactivate" CommandArgument='<%#Eval("Idkey")%>' ImageUrl="../Icons/delete.png" />
                                            </td>
                                        </tr>
                                    </AlternatingItemTemplate>
                                </asp:Repeater>
                            </asp:Panel>
                        </table>
                    </div>
                </asp:Panel>
                
                <!-- ==============| Update Moodal Window |============== -->
                <asp:Panel ID="pnlUpdateContent" runat="server" CssClass="modalPopup" style="display:none;">
                    <table width="100%" border="0" cellspacing="0" cellpadding="1px">
                        <tr>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtName" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtContact" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtMobile" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtEmail" runat="server"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtTel" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtFax" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtWeb" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"></td>
                        </tr>
                        <tr>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtPhysical" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"><asp:TextBox ID="txtPostal" runat="server"></asp:TextBox></td>
                            <td class="generalPadding" style="width:25%;"></td>
                            <td class="generalPadding" style="width:25%;"></td>
                        </tr>
                        <tr>
                            <td class="generalPadding" colspan="4">
                                <asp:HiddenField ID="hdn_sID" runat="server" />
                                <asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="update_details" />
                                <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <asp:Button ID="btn_hiddenModal" runat="server" Style="display: none" /> 
                <ajaxtoolkit:ModalPopupExtender 
                 ID="ModalPopupExtender1" 
                 BackgroundCssClass="progressBackgroundFilter" 
                 BehaviorID="ModalPopupExtender1"  
                 PopupControlID="pnlUpdateContent"
                 TargetControlID="btn_hiddenModal" 
                 DropShadow="false" 
                 runat="server">
                </ajaxtoolkit:ModalPopupExtender>
                <!-- ==============| END Update Moodal Window |============== -->            
                
            </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Content>
    
    [CODE]
    Last edited by Shem; August 15th, 2008 at 10:14 AM.

  5. #5
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    my full aspx.vb:
    Code:
    and my full aspx.vb
    Imports Keith.ProjectManager.Bll
    Imports Keith.ProjectManager.BO
    Imports System.Web.UI.WebControls
    Imports System.Data
    Imports System.Data.SqlClient
    Imports MySql.Data.MySqlClient
    
    Partial Class views_suppliers
        Inherits System.Web.UI.Page
    
        Private CommandNames As String = String.Empty
        'create instance of params
        Private myParams As New Params
        Dim ActivePagedData As New PagedDataSource()
        Dim InActivePagedData As New PagedDataSource()
    
    #Region "Page_Load"
        '=============================================================================================
        'handles page load events
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            'add textboxes that need to be cleared by onFocus
            txtSvName.Attributes.Add("onFocus", "Clear(this)")
            txtSvContact.Attributes.Add("onFocus", "Clear(this)")
            txtSvEmail.Attributes.Add("onFocus", "Clear(this)")
            txtSvFax.Attributes.Add("onFocus", "Clear(this)")
            txtSvMobile.Attributes.Add("onFocus", "Clear(this)")
            txtSvPhysical.Attributes.Add("onFocus", "Clear(this)")
            txtSvPostal.Attributes.Add("onFocus", "Clear(this)")
            txtSvTel.Attributes.Add("onFocus", "Clear(this)")
            txtSvWeb.Attributes.Add("onFocus", "Clear(this)")
    
            txtSvPhysical.TextMode = TextBoxMode.MultiLine
            txtSvPostal.TextMode = TextBoxMode.MultiLine
    
            'just for testing updateprogress control
            System.Threading.Thread.Sleep("1000")
    
            'populate datasource's only if it's not a pastback
            If Not IsPostBack Then
                myParams.OrderBy = String.Empty
                myParams.Search = String.Empty
                myParams.Activated = String.Empty
                myParams.ActivatedPage = 0
                myParams.DeactivatedPage = 0
    
                Populate_rpActive(myParams)
                Populate_rpInActive(myParams)
            End If
        End Sub
    #End Region
    
    #Region "Populate Datasources"
        '=============================================================================================
        'populate and bind rpProjectList datasource
        Sub Populate_rpActive(ByVal myParams As Params)
            'Dim CategoryList As New CategoryList
    
            'set activated to true to bring up the activated results
            myParams.Activated = "true"
            myParams.Search = String.Empty
    
            'populate the datasource
            ActivePagedData.DataSource = SuppliersManager.GetList(myParams)
    
            'set datasource parameters
            ActivePagedData.AllowPaging = True
            ActivePagedData.PageSize = 10
    
            If myParams.ActivatedPage = 0 Then
                myParams.ActivatedPage = 0
                ActivePagedData.CurrentPageIndex = 0
            Else
                ActivePagedData.CurrentPageIndex = myParams.ActivatedPage
            End If
    
            myParams.PageCount = ActivePagedData.PageCount
            btnPrev.Text = "&lt;&nbsp;Previous"
            btnPrev.Visible = (Not ActivePagedData.IsFirstPage)
    
            btnNext.Text = "Next&nbsp;&gt;"
            btnNext.Visible = (Not ActivePagedData.IsLastPage)
    
            lblActivePagingPages.Text = "Page " & ActivePagedData.CurrentPageIndex + 1 & " of " & ActivePagedData.PageCount
            lblActivePagingPages.CssClass = "PageNumbers"
    
            'for paging
            If ActivePagedData.PageCount = 0 Then
                lblActivePagingPages.Visible = False
                btnNext.Visible = False
                btnPrev.Visible = False
            Else
                lblActivePagingPages.Visible = True
            End If
    
            'for sorting
            If ActivePagedData.Count <= 1 Then
                lbtnActiveName.Enabled = False
                lbtnActiveContact.Enabled = False
                lbtnActiveMobile.Enabled = False
                lbtnActiveTel.Enabled = False
                lbtnActiveWeb.Enabled = False
            Else
                lbtnActiveName.Enabled = True
                lbtnActiveContact.Enabled = True
                lbtnActiveMobile.Enabled = True
                lbtnActiveTel.Enabled = True
                lbtnActiveWeb.Enabled = True
            End If
    
            'only bind data if there is data
            If ActivePagedData.PageCount > 0 Then
                rpActiveList.DataSource = ActivePagedData
                rpActiveList.DataBind()
            End If
        End Sub
    
        '=============================================================================================
        'populate and bind rpDeactivatedProjects datasource
    
        Sub Populate_rpInActive(ByVal myParams As Params)
            'Dim CategoryList As New CategoryList
    
            'set activated to true to bring up the activated results
            myParams.Activated = "false"
            myParams.Search = String.Empty
    
            'populate the datasource
            InActivePagedData.DataSource = SuppliersManager.GetList(myParams)
    
            'set datasource parameters
            InActivePagedData.AllowPaging = True
            InActivePagedData.PageSize = 10
    
            If myParams.DeactivatedPage = 0 Then
                myParams.DeactivatedPage = 0
                InActivePagedData.CurrentPageIndex = 0
            Else
                InActivePagedData.CurrentPageIndex = myParams.DeactivatedPage
            End If
    
            myParams.PageCount = InActivePagedData.PageCount
            btnInActivePrev.Text = "&lt;&nbsp;Previous"
            btnInActivePrev.Visible = (Not InActivePagedData.IsFirstPage)
    
            btnInActiveNext.Text = "Next&nbsp;&gt;"
            btnInActiveNext.Visible = (Not InActivePagedData.IsLastPage)
    
            lblInActivePagingPages.Text = "Page " & InActivePagedData.CurrentPageIndex + 1 & " of " & InActivePagedData.PageCount
            lblInActivePagingPages.CssClass = "PageNumbers"
    
            'for paging
            If InActivePagedData.PageCount = 0 Then
                lblInActivePagingPages.Visible = False
                btnInActiveNext.Visible = False
                btnInActivePrev.Visible = False
            Else
                lblInActivePagingPages.Visible = True
            End If
    
            'for sorting
            If InActivePagedData.Count <= 1 Then
                lbtnInActiveName.Enabled = False
                lbtnInActiveContact.Enabled = False
                lbtnInActiveMobile.Enabled = False
                lbtnInActiveTel.Enabled = False
                lbtnInActiveWeb.Enabled = False
            Else
                lbtnInActiveName.Enabled = True
                lbtnInActiveContact.Enabled = True
                lbtnInActiveMobile.Enabled = True
                lbtnInActiveTel.Enabled = True
                lbtnInActiveWeb.Enabled = True
            End If
    
            'only bind data if there is data
            If InActivePagedData.PageCount > 0 Then
                rpInActiveList.DataSource = InActivePagedData
                rpInActiveList.DataBind()
            End If
        End Sub
    
        '=============================================================================================
        'run validations/operations on rpProjectList
        Protected Sub rpActive_OnItemDataBound(ByVal s As Object, ByVal e As RepeaterItemEventArgs)
            If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
    
                'declare my controls and create an instance of Projects
                Dim Suppliers As Suppliers = e.Item.DataItem
    
                'if an empty result is retuurned then only show the ddl to select a project
                If Suppliers.Idkey = 0 Then
                    pnlActiveSubContent.Visible = False
                ElseIf Suppliers.Idkey <> 0 Then
                    pnlActiveSubContent.Visible = True
                End If
    
            End If
        End Sub
    
        '=============================================================================================
        'run validations/operations on rpDeactivatedProjects
        Protected Sub rpInActive_OnItemDataBound(ByVal s As Object, ByVal e As RepeaterItemEventArgs)
            If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
    
                'declare my controls and create an instance of Projects
                Dim imgbtnDelete As ImageButton = e.Item.FindControl("imgbtnDelete")
                Dim Suppliers As Suppliers = e.Item.DataItem
    
                'image button
                imgbtnDelete.ImageUrl = "../Icons/trashfull.png"
    
                'if an empty result is retuurned then only show the ddl to select a project
                If Suppliers.Idkey = 0 Then
                    pnlInActiveSubContent.Visible = False
                ElseIf Suppliers.Idkey <> 0 Then
                    pnlInActiveSubContent.Visible = True
                End If
            End If
        End Sub
    #End Region
    
    #Region "Update,Save,Delete,Activate,Deactivate"
        '=============================================================================================
        'put code in here that needs to be run on the btnSave event
        Protected Sub btnSave_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
            'populate Projects and save new data
            Dim mySuppliers As Suppliers = New Suppliers
            mySuppliers.Name = txtSvName.Text
            mySuppliers.Contact = txtSvContact.Text
            mySuppliers.Email = txtSvEmail.Text
            mySuppliers.Fax = txtSvFax.Text
            mySuppliers.Mobile = txtSvMobile.Text
            mySuppliers.Physical = txtSvPhysical.Text
            mySuppliers.Postal = txtSvPostal.Text
            mySuppliers.Tel = txtSvTel.Text
            mySuppliers.Web = txtSvWeb.Text
    
            'set values manually
            mySuppliers.CreatedDate = Now()
            mySuppliers.EditedDate = Now()
            mySuppliers.CreatedBy = HttpContext.Current.Session("UserID")
            mySuppliers.EditedBy = 0
            mySuppliers.Idkey = 0
            SuppliersManager.Save(mySuppliers)
    
            'set params back to default
            myParams.OrderBy = String.Empty
            myParams.Search = String.Empty
            myParams.Activated = String.Empty
            myParams.ActivatedPage = 0
            myParams.DeactivatedPage = 0
    
            'bind the datasource to repeater to show updated results
            Populate_rpActive(myParams)
    
            're-set the textboxes
            txtSvName.Text = "Company Name"
            txtSvContact.Text = "Contact"
            txtSvEmail.Text = "Email"
            txtSvFax.Text = "Fax"
            txtSvMobile.Text = "Mobile"
            txtSvTel.Text = "Tel"
            txtSvWeb.Text = "Website"
            'txtSvPhysical.Text = "Physical"
            'txtSvPostal.Text = "Postal"
        End Sub
    
        '=============================================================================================
        'repeater OnItemCommand event, handles all actions ie. buttons inside the repeater
        Protected Sub rpActive_OnItemCommand(ByVal source As Object, ByVal e As RepeaterCommandEventArgs) Handles rpActiveList.ItemCommand
            CommandNames = e.CommandName
            Dim mySupplier As Suppliers = New Suppliers
            Select Case CommandNames
                Case "Delete"
                    'populate Projects with the idkey that must be deleted and pass it to ProjectsManager.Delete
                    mySupplier.Idkey = CType(e.CommandArgument, Integer)
                    SuppliersManager.Delete(mySupplier)
    
                    'bind the datasource to repeater to show updated results
                    Populate_rpActive(myParams)
                    Populate_rpInActive(myParams)
    
                Case "Deactivate"
                    'populate Projects with the idkey that must be deactivated and pass it to ProjectsManager.Deactivate
                    mySupplier.Idkey = CType(e.CommandArgument, Integer)
                    mySupplier.EditedBy = HttpContext.Current.Session("UserID")
                    SuppliersManager.Deactivate(mySupplier)
    
                    'bind the datasource to repeater to show updated results
                    Populate_rpActive(myParams)
                    Populate_rpInActive(myParams)
    
                Case "Activate"
                    'populate Projects with the idkey that must be activated and pass it to ProjectsManager.Deactivate
                    mySupplier.Idkey = CType(e.CommandArgument, Integer)
                    mySupplier.EditedBy = HttpContext.Current.Session("UserID")
                    SuppliersManager.Activate(mySupplier)
    
                    'bind the datasource to repeater to show updated results
                    Populate_rpActive(myParams)
                    Populate_rpInActive(myParams)
            End Select
        End Sub
    
        Protected Sub update_details(ByVal s As Object, ByVal e As System.EventArgs)
            Dim mySuppliers As Suppliers
            Dim fieldlist As New ArrayList
    
            'populate Suppliers BO with the database record from the form hidden idkey
            mySuppliers = New Suppliers
            mySuppliers.Idkey = CInt(hdn_sID.Value)
            mySuppliers = SuppliersManager.GetItem(mySuppliers.Idkey)
            mySuppliers.Idkey = hdn_sID.Value
    
            If Not txtName.Text = mySuppliers.Name Then
                fieldlist.Add("name")
                mySuppliers.Name = txtName.Text
            End If
            If Not txtMobile.Text = mySuppliers.Mobile Then
                fieldlist.Add("mobile")
                mySuppliers.Mobile = txtMobile.Text
            End If
            If Not txtContact.Text = mySuppliers.Contact Then
                fieldlist.Add("contact")
                mySuppliers.Contact = txtContact.Text
            End If
            If Not txtEmail.Text = mySuppliers.Email Then
                fieldlist.Add("email")
                mySuppliers.Email = txtEmail.Text
            End If
            If Not txtTel.Text = mySuppliers.Tel Then
                fieldlist.Add("tel")
                mySuppliers.Tel = txtTel.Text
            End If
            If Not txtFax.Text = mySuppliers.Fax Then
                fieldlist.Add("fax")
                mySuppliers.Email = txtEmail.Text
            End If
            If Not txtWeb.Text = mySuppliers.Web Then
                fieldlist.Add("web")
                mySuppliers.Web = txtWeb.Text
            End If
            If Not txtPhysical.Text = mySuppliers.Physical Then
                fieldlist.Add("physical")
                mySuppliers.Physical = txtPhysical.Text
            End If
            If Not txtPostal.Text = mySuppliers.Postal Then
                fieldlist.Add("postal")
                mySuppliers.Postal = txtPostal.Text
            End If
    
            'check to see if any records need to be updated, if so, update them
            If Not fieldlist.Count = 0 Then
                SuppliersManager.Update(mySuppliers)
                fieldlist.RemoveRange(0, fieldlist.Count)
            End If
    
            CloseModalPopup(s, e)
        End Sub
    #End Region
    
    #Region "Paging"
        Public Sub Prev_Click(ByVal obj As Object, ByVal e As EventArgs)
            myParams.ActivatedPage = myParams.ActivatedPage - 1
            Populate_rpActive(myParams)
        End Sub
    
        Public Sub Next_Click(ByVal obj As Object, ByVal e As EventArgs)
            myParams.ActivatedPage = myParams.ActivatedPage + 1
            Populate_rpActive(myParams)
        End Sub
    
        Public Sub InActivePrev_Click(ByVal obj As Object, ByVal e As EventArgs)
            myParams.DeactivatedPage = myParams.DeactivatedPage - 1
            Populate_rpInActive(myParams)
        End Sub
    
        Public Sub InActiveNext_Click(ByVal obj As Object, ByVal e As EventArgs)
            myParams.DeactivatedPage = myParams.DeactivatedPage + 1
            Populate_rpInActive(myParams)
        End Sub
    #End Region
    
        Public Sub Populate_ModalPopup(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
            Dim mySuppliers As Suppliers = New Suppliers
    
            'loop over all the items in rpActiveList repeater
            Dim hdn_idkey As String = sender.CommandArgument
            mySuppliers.Idkey = CInt(hdn_idkey)
            mySuppliers = SuppliersManager.GetItem(mySuppliers.Idkey)
    
            hdn_sID.Value = mySuppliers.Idkey
    
            txtName.Text = mySuppliers.Name
            txtContact.Text = mySuppliers.Contact
            txtMobile.Text = mySuppliers.Mobile
            txtEmail.Text = mySuppliers.Email
    
            txtTel.Text = mySuppliers.Tel
            txtFax.Text = mySuppliers.Fax
            txtWeb.Text = mySuppliers.Web
    
            txtPhysical.Text = mySuppliers.Physical
            txtPostal.Text = mySuppliers.Postal
    
            ModalPopupExtender1.Show()
        End Sub
    
        Public Sub CloseModalPopup(ByVal sender As Object, ByVal e As EventArgs)
            ModalPopupExtender1.Hide()
        End Sub
    End Class
    
    It still does not work

  6. #6
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    What happens if you remove:

    Code:
    CloseModalPopup(s, e)
    
    and just put:

    Code:
    ModalPopupExtender1.Hide() 
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  7. #7
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    nothing..

    weird huh? i've googled every piece of literature out there and everyone
    says just call .Hide()

    but for some reason it doesn't work, except if i use it in the same sub as my
    .Show()

  8. #8
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    That makes no sense...the Show() and Hide() methods do not rely on eachother. What I suggest to you is to get a very basic test page setup and working. That is the best way to troubleshoot this, IMO. Right now you have a lot of extra code that makes it difficult to pinpoint the exact problem.

    I also noticed you have this: BehaviorID="ModalPopupExtender1"

    My example doesn't use that and neither does the example on the ASP.net AJAX web site. Another suggestion, go to the AJAX site and click the link to watch the video on the bottom of the page: ModalPopup Sample

    See if you can follow along and get a very basic sample working.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


+ Reply to Thread

Similar Threads

  1. ModalPopupExtender inside of UpdatePanel
    By Shem in forum .NET Development
    Replies: 12
    Last Post: August 13th, 2008, 09:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO