locked
AJAX is not working RRS feed

  • Question

  • User-150770710 posted

    Hi

    I have a screen, which allow user to search user record.

    I have a search button and some controls used to show data placed inside updatePanel, once user click search button, callback supposed to be fired and query data from db and show it on screen. However, I am facing problem that, the AJAX is not triggered. I tried:-

    1. Added code to log to event viewer in server side click event, nothing is logged
    2. Used browser proxy tool such as httpwatch and IE Dev tool to trace the http request. Nothing is sent back to server
    3. I checked IIS log, nothing is logged as well.
    4. No javascript error is prompted / show at corner.

    However, the weird is, this screen is working fine in another server. Also, only this screen has this problem, and other screens which are using same implementation working fine.

    Any ideas? How to troubleshoot it?

    Thank you

    Thursday, October 31, 2013 10:22 PM

All replies

  • User551462331 posted

    from the details, it seems that there should not be any problem...

    but, it is difficult to guess the issue unless u can show some code (updatepanel/outside and codebehind)

    Thursday, October 31, 2013 11:03 PM
  • User-150770710 posted

    Hi

    I can attach the code here, but it is lengthy.

    ASPX

    <%@ Page Language="C#" MasterPageFile="../MasterPages/UIMaster.Master" AutoEventWireup="true" CodeBehind="UserLoginCreation.aspx.cs" Inherits="Vfs.Flexsetup.UI.Web.Forms.UserLoginCreation" Title="User Login Creation" %>
    <%@ Register assembly="DevExpress.Web.v10.1, Version=10.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPanel" tagprefix="dxp" %>
    <%@ Register assembly="DevExpress.Web.v10.1, Version=10.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dxpc" %>
    <%@ Register assembly="Vfs.Generic.UI.Web" namespace="Vfs.Generic.UI.Web" tagprefix="VfsWeb" %>
    <%@ Register assembly="Vfs.Generic.UI.Web" namespace="Vfs.Generic.UI.Web.DevEx.Controls" tagprefix="VfsWeb" %>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    
    <script type="text/javascript">
        function showHide() {
            if (rpSearchFilter.GetVisible() == true) {
                rpSearchFilter.SetVisible(false);
            }
            else {
                rpSearchFilter.SetVisible(true);
            }
        }
    
        function UserIdSelected(userId) {
            pageControl.SetActiveTab(pageControl.GetTabByName('tabPageDataEntry'));
    
            var button = document.getElementById('<%= btnClick.ClientID %>');
            var hUserId = document.getElementById('<%= hUserId.ClientID %>')
            hUserId.value = userId;
            button.click();
        }
    
        function OnUserAccountActionClick(selectedType) {
            var hUserId = document.getElementById('<%= hUserId.ClientID %>');
            hUserId.value = selectedType;
    
            if (grdvUserLogin.GetSelectedRowCount() == 0) {
                alert('No Record Selected.');
                return false; 
            }
            else {
                if (!confirm('Confirm your action?')) return false; else virtualClickButton();
            }
        }
        
        function btnUserIdSearch_Click(s, e) {
            var hIsUserInactive = document.getElementById('<%= hIsUserInactive.ClientID %>')
            hIsUserInactive.value = s.GetText();
    
            FilterIsUserInactive();
        }
    
        function btnUserIdReset_Click(s, e) {
            var hIsUserInactive = document.getElementById('<%= hIsUserInactive.ClientID %>')
            hIsUserInactive.value = s.GetText();
    
            FilterIsUserInactive();
        }
    
        function FilterIsUserInactive() {
            document.body.style.cursor = "wait";
    
            var isUserInactive = '';
            var hUserId = document.getElementById('<%= hUserId.ClientID %>');
            var hIsUserInactive = document.getElementById('<%= hIsUserInactive.ClientID %>');
    
            if (rdoListIsInactiveSearch.GetValue() == '0') {
                isUserInactive = 'False';
            }
            else if (rdoListIsInactiveSearch.GetValue() == '1') {
                isUserInactive = 'True';
            }
    
    //        if (isUserInactive == '') {
    //            OnSearchResetClick();
    //            virtualClickButton();
    //        }
    //        else {
    
    //        }
    
            if (hIsUserInactive.value == 'Search') {
                grdvUserLogin.AutoFilterByColumn(6, isUserInactive);
            }
            else if (hIsUserInactive.value == 'Reset') {
                grdvUserLogin.ClearFilter();
            }
        }
        
        function grdvUserLogin_OnEndCallback(s, e) {
            OnSearchResetClick();
            virtualClickButton();
        }
    
        function OnSearchResetClick() {
            var hUserId = document.getElementById('<%= hUserId.ClientID %>');
            var hIsUserInactive = document.getElementById('<%= hIsUserInactive.ClientID %>');
            
            if (hIsUserInactive.value == 'Search') {
                hUserId.value = 'FILL';
            }
            else if (hIsUserInactive.value == 'Reset') {
                hUserId.value = 'EMPTY';
                
                txtEmployeeNoSearch.SetText('');
                txtEmployeeNameSearch.SetText('');
                txtUserIDSearch.SetText('');
                txtUserGroupSearch.SetText('');
                rdoListIsLockedSearch.SetValue(-1);
                rdoListIsInactiveSearch.SetValue(-1);
    
                grdvUserLogin.UnselectAllRowsOnPage();
            }
        }
    
        function virtualClickButton() {
            var button = document.getElementById('<%= btnClick.ClientID %>');
            button.click();
    
            document.body.style.cursor = "default";
        }
    
        function Trim(str) {
            if (str == null) str = '';
            return str.replace(/^\s*/, "").replace(/\s*$/, "");
        }
    
        function grdvEmployeeList_OnGetRowValues(values) {
            var hEmployee = document.getElementById('<%= hEmployee.ClientID %>');
            hEmployee.value = '';
            
            if (values[1] != null) {
                txtEmployee.SetText(Trim(values[1]));
                txtUserName.SetValue(Trim(values[1]));
    
                hEmployee.value = txtEmployee.GetValue();
            }
            if (values[2] != null) {
                txtEmpName.SetValue(Trim(values[2]));
                txtFirstName.SetValue(Trim(values[2]));
                txtLastName.SetValue(Trim(values[2]));
            }
        }
    
        function grdvUserGroupList_OnGetRowValues(values) {
            var hUserRole = document.getElementById('<%= hUserRole.ClientID %>');
            var hUserGroupCode = document.getElementById('<%= hUserGroupCode.ClientID %>');
            hUserRole.value = '';
            hUserGroupCode.value = '';
            
            if (values[0] != null) {
                hUserRole.value = values[0];
            }
            if (values[1] != null) {
                txtGroup.SetText(values[1]);
                hUserGroupCode.value = txtGroup.GetValue();
            }
            if (values[2] != null) {
                txtUserGrpDesc.SetValue(values[2]);
            }
        }
    
        function OnPopupOKClickedUserGroup(s, e) {
            grdvUserGroupList.GetRowValues(grdvUserGroupList.GetFocusedRowIndex(), 'rl_pk;rl_Role;rl_Description', grdvUserGroupList_OnGetRowValues);
            popUpUserGrp.Hide();
            return false;
        }
    
        function OnPopupOKClickedEmployee(s, e) {
            grdvEmployeeList.GetRowValues(grdvEmployeeList.GetFocusedRowIndex(), 'EmployeeId;EmployeeNo;EmployeeName', grdvEmployeeList_OnGetRowValues);
            popUpEmployee.Hide();
            return false;
        }
    </script>
    
        <asp:ScriptManager ID="scriptManagerUser" runat="server">
        </asp:ScriptManager>
        
        <asp:UpdatePanel ID="updatePanelUser" runat="server">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnClick" EventName="Click" />
        </Triggers>
        <ContentTemplate>
    
        <asp:Button ID="btnClick" runat="server" onclick="lblUserId_Click" Text="Button" style="display:none" />
    
        <VfsWeb:BasePageControl ID="pageControl" ClientInstanceName="pageControl" runat="server" ActiveTabIndex="0" EnableClientSideAPI="True" Width="100%">
            <TabPages>
            
                <dxtc:TabPage Name="tabPageSearch" Text="Search" ToolTip="Search">
                    <ContentCollection>
                        <dxw:ContentControl ID="ContentControl1" runat="server">
                        
                            <VfsWeb:BaseRoundPanel ID="rpUserLogin" runat="server" HeaderText="User Login" Width="100%">
                                <PanelCollection>
                                    <dxp:PanelContent>
                                        <table width="100%">
                                            <tr>
                                                <td>
                                                    <VfsWeb:ActionSummary ID="ClickActionSummary" runat="server" Visible="false" />
                                                </td>
                                            </tr>
                                        </table>
                                        
                                        <table width="100%" align="center">
                                            <tr>
                                                <td>
                                                    <VfsWeb:BaseHyperLink ID="lnkFilter" runat="server" Text="Search / Filter" Font-Underline="true" style="cursor:pointer">
                                                        <ClientSideEvents Click="function(s,e) { return showHide(); }" />
                                                    </VfsWeb:BaseHyperLink>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <VfsWeb:BaseRoundPanel ID="rpSearchFilter" runat="server" ShowHeader="false" ClientInstanceName="rpSearchFilter" EnableClientSideAPI="True">
                                                        <PanelCollection>
                                                            <dxp:PanelContent ID="PanelContent2" runat="server">
                                                                <table width="100%" align="center">
                                                                    <tr>    
                                                                        <td>
                                                                            <VfsWeb:BaseLabel ID="lblUserIDSearchLabel" runat="server" Text="User ID"></VfsWeb:BaseLabel>
                                                                        </td>
                                                                        <td>
                                                                            <VfsWeb:BaseTextBox ID="txtUserIDSearch" runat="server" ClientInstanceName="txtUserIDSearch" EnableClientSideAPI="true" Width="200px"></VfsWeb:BaseTextBox>
                                                                        </td>
                                                                        <td>&nbsp;&nbsp;&nbsp;</td>
                                                                        <td>
                                                                            <VfsWeb:BaseLabel ID="lblUserGroupSearchLabel" runat="server" Text="User Group"></VfsWeb:BaseLabel>
                                                                        </td>
                                                                        <td>
                                                                            <VfsWeb:BaseTextBox ID="txtUserGroupSearch" runat="server" ClientInstanceName="txtUserGroupSearch" EnableClientSideAPI="true" Width="200px"></VfsWeb:BaseTextBox>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>
                                                                            <VfsWeb:BaseLabel ID="lblEmployeeNoSearchLabel" runat="server" Text="Employee No"></VfsWeb:BaseLabel>
                                                                        </td>
                                                                        <td>
                                                                            <VfsWeb:BaseTextBox ID="txtEmployeeNoSearch" runat="server" ClientInstanceName="txtEmployeeNoSearch" Width="200px"></VfsWeb:BaseTextBox>
                                                                        </td>
                                                                        <td>&nbsp;&nbsp;&nbsp;</td>
                                                                        <td>
                                                                            <VfsWeb:BaseLabel ID="lblEmployeeNameSearchLabel" runat="server" Text="Employee Name"></VfsWeb:BaseLabel>
                                                                        </td>
                                                                        <td>
                                                                            <VfsWeb:BaseTextBox ID="txtEmployeeNameSearch" runat="server" ClientInstanceName="txtEmployeeNameSearch"  Width="200px"></VfsWeb:BaseTextBox>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>
                                                                            <VfsWeb:BaseLabel ID="lblIsLockedSearchLabel" runat="server" Text="Is User Locked"></VfsWeb:BaseLabel>
                                                                        </td>
                                                                        <td>
                                                                            <VfsWeb:BaseRadioButtonList ID="rdoListIsLockedSearch" runat="server" RepeatDirection="Horizontal" ClientInstanceName="rdoListIsLockedSearch" EnableClientSideAPI="True">
                                                                                <Items>
                                                                                    <dxe:ListEditItem Text="Yes" Value="1" Selected="false"  />
                                                                                    <dxe:ListEditItem Text="No" Value="0" Selected="false"  />
                                                                                    <dxe:ListEditItem Text="Both" Value="-1" Selected="true"  />
                                                                                </Items>
                                                                            </VfsWeb:BaseRadioButtonList>
                                                                        </td>
                                                                        <td>&nbsp;&nbsp;&nbsp;</td>
                                                                        <td>
                                                                            <VfsWeb:BaseLabel ID="lblIsInavtiveSearchLabel" runat="server" Text="Is User Inactive"></VfsWeb:BaseLabel>
                                                                        </td>
                                                                        <td>
                                                                            <VfsWeb:BaseRadioButtonList ID="rdoListIsInactiveSearch" runat="server" RepeatDirection="Horizontal" ClientInstanceName="rdoListIsInactiveSearch" EnableClientSideAPI="True">
                                                                                <Items>
                                                                                    <dxe:ListEditItem Text="Yes" Value="1" Selected="false"  />
                                                                                    <dxe:ListEditItem Text="No" Value="0" Selected="false"  />
                                                                                    <dxe:ListEditItem Text="Both" Value="-1" Selected="true"  />
                                                                                </Items>
                                                                            </VfsWeb:BaseRadioButtonList>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td colspan="5">
                                                                            <table width="100%">
                                                                                <tr align="center">
                                                                                    <td align="right">
                                                                                        <VfsWeb:BaseButton ID="btnUserIdSearch" runat="server" Text="Search" ClientInstanceName="btnUserIdSearch" AutoPostBack="false" CausesValidation="False">
                                                                                            <ClientSideEvents Click="btnUserIdSearch_Click" />
                                                                                        </VfsWeb:BaseButton>
                                                                                    </td>
                                                                                    <td align="left">
                                                                                        <VfsWeb:BaseButton ID="btnUserIdReset" runat="server" Text="Reset" ClientInstanceName="btnUserIdReset" AutoPostBack="false" CausesValidation="False" >
                                                                                            <ClientSideEvents Click="btnUserIdReset_Click" />
                                                                                        </VfsWeb:BaseButton>
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </dxp:PanelContent>
                                                        </PanelCollection>
                                                    </VfsWeb:BaseRoundPanel>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <input id="hEmployee" type="hidden" runat="server" />
                                                    <input id="hUserRole" type="hidden" runat="server" />
                                                    <input id="hUserGroupCode" type="hidden" runat="server" />
                                                    
                                                    <input id="hUserId" type="hidden" runat="server" />
                                                    <input id="hIsUserInactive" type="hidden" runat="server" />
                                                    
                                                    <VfsWeb:BaseWBBS ID="wbbsUser" runat="server" BusinessObjectName="Users"></VfsWeb:BaseWBBS>
                                                    
                                                    <VfsWeb:BaseGridView  ID="grdvUserLogin" runat="server" ClientInstanceName="grdvUserLogin" ShowSelectAllCheckBox="true"
                                                    AutoCommitChanges="True" AutoGenerateColumns="False" KeyFieldName="us_pk" DataSourceID="wbbsUser"
                                                    OnHtmlRowCreated="grdvUserLogin_HtmlRowCreated" OnHtmlDataCellPrepared="grdvUserLogin_HtmlDataCellPrepared">
                                                    
                                                    <SettingEditingButtons>
                                                        <NewButton Text="New" Visible="false" />
                                                        <EditButton Text="Edit" Visible="false" />
                                                        <DeleteButton Text="Delete" />
                                                    </SettingEditingButtons>
                                                    
                                                    <Columns>
                                                        <dxwgv:GridViewDataTextColumn FieldName="us_Username" VisibleIndex="1" Caption="User ID">
                                                            <DataItemTemplate>
                                                                <VfsWeb:BaseHyperLink ID="lnkUserId" runat="server" Cursor="pointer" Font-Underline="True" Text='<%#Eval("Username")%>'>
                                                                </VfsWeb:BaseHyperLink>
                                                            </DataItemTemplate>
                                                        </dxwgv:GridViewDataTextColumn>
                                                        <dxwgv:GridViewDataTextColumn FieldName="UserGroupCode" Caption="User Group" VisibleIndex="2">
                                                        </dxwgv:GridViewDataTextColumn>
                                                        <dxwgv:GridViewDataTextColumn FieldName="EmployeeNo" Caption="Employee No" VisibleIndex="3">
                                                        </dxwgv:GridViewDataTextColumn>
                                                        <dxwgv:GridViewDataTextColumn FieldName="EmployeeName" Caption="Employee Name" VisibleIndex="4">
                                                        </dxwgv:GridViewDataTextColumn>
                                                        <dxwgv:GridViewDataTextColumn FieldName="Locked" Caption="Is User Locked" VisibleIndex="5">
                                                        </dxwgv:GridViewDataTextColumn>
                                                         <dxwgv:GridViewDataTextColumn FieldName="IsInactive" Caption="Is User Inactive" VisibleIndex="6">
                                                        </dxwgv:GridViewDataTextColumn>
                                                        <dxwgv:GridViewDataTextColumn FieldName="PwdChangeAt" Caption="Last Password Changed" VisibleIndex="7">
                                                        </dxwgv:GridViewDataTextColumn>
                                                        <dxwgv:GridViewDataTextColumn FieldName="LoginAt" Caption="Last Login" VisibleIndex="8">
                                                        </dxwgv:GridViewDataTextColumn>                                                              
                                                    </Columns>
                                                    
                                                    <SettingsBehavior AllowFocusedRow="true" AllowMultiSelection="true" AllowDragDrop="False" AllowGroup="False" />
                                                    <Settings ShowFilterRow="false" ShowFilterRowMenu="false" ShowStatusBar="Hidden" />
    
                                                    </VfsWeb:BaseGridView>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <table>
                                                        <tr>
                                                            <td>
                                                                <VfsWeb:BaseButton ID="btnResetUser" runat="server" Text="Activate User & Reset Password" AutoPostBack="false">
                                                                    <ClientSideEvents Click="function(s,e) { OnUserAccountActionClick('ResetUserPassword'); }" />
                                                                </VfsWeb:BaseButton>
                                                            </td>
                                                            <td>
                                                                <VfsWeb:BaseButton ID="btnLockUser" runat="server" Text="Lock User" AutoPostBack="false">
                                                                    <ClientSideEvents Click="function(s,e) { OnUserAccountActionClick('LockUserAccount'); }" />
                                                                </VfsWeb:BaseButton>
                                                            </td>
                                                            <td>
                                                                <VfsWeb:BaseButton ID="btnUnlockUser" runat="server" Text="Unlock User" AutoPostBack="false">
                                                                    <ClientSideEvents Click="function(s,e) { OnUserAccountActionClick('UnlockUserAccount'); }" />
                                                                </VfsWeb:BaseButton>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </dxp:PanelContent>
                                </PanelCollection>
                            </VfsWeb:BaseRoundPanel>
                        
                        </dxw:ContentControl>
                    </ContentCollection>
                </dxtc:TabPage>
                
                <dxtc:TabPage Name="tabPageDataEntry" Text="Data Entry" ToolTip="Data Entry">
                    <ContentCollection>
                        <dxw:ContentControl>
                        
                            <VfsWeb:BaseRoundPanel ID="rpToolbar" runat="server" HorizontalAlign="Left" ShowHeader="False">
                                <panelcollection>
                                    <dxp:panelcontent id="PanelContent5" runat="server">
                                        <VfsWeb:MaintenanceToolbar ID="maintenanceToolbar" runat="server" IncludeCopyButton="false">
                                        </VfsWeb:MaintenanceToolbar>
                                    </dxp:panelcontent>
                                </panelcollection>
                                <border borderstyle="Inset" />
                            </VfsWeb:BaseRoundPanel>
                            
                            <br />
                            
                            <VfsWeb:BaseRoundPanel ID="rpUserDetails" runat="server"  HeaderText="User Login Details" Width="100%">
                                <PanelCollection>
                                    <dxp:PanelContent>
                                        
                                        <table width="100%" id="tblActionSummary" runat="server">
                                            <tr>
                                                <td>
                                                    <VfsWeb:ActionSummary ID="ActionSummary" runat="server" Visible="false" />
                                                </td>
                                            </tr>
                                        </table>
                                        
                                        <table width="100%">
                                            <tr>
                                                <td width ="30%"></td>
                                                <td width ="25%"></td>
                                                <td width ="40%"></td>
                                                <td width ="5%"></td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <VfsWeb:BaseLabel ID="BaseLabel4" runat="server" Text="First Name">
                                                    </VfsWeb:BaseLabel>
                                                </td>
                                                <td colspan="2">
                                                    <VfsWeb:BaseTextBox ID="txtFirstName" ClientInstanceName="txtFirstName" runat="server" Width="100%" 
                                                        BindingField="us_FirstName" BusinessObjectName="Users">
                                                    </VfsWeb:BaseTextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <VfsWeb:BaseLabel ID="BaseLabel3" runat="server" Text="Last Name">
                                                    </VfsWeb:BaseLabel>
                                                </td>
                                                <td colspan="2">
                                                    <VfsWeb:BaseTextBox ID="txtLastName" ClientInstanceName="txtLastName" runat="server" Width="100%" 
                                                        BindingField="us_LastName" BusinessObjectName="Users">
                                                    </VfsWeb:BaseTextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <VfsWeb:BaseLabel ID="lblBaseLabel1" runat="server" Text="User ID">
                                                    </VfsWeb:BaseLabel>
                                                </td>
                                                <td colspan="2">
                                                    <VfsWeb:BaseTextBox ID="txtUserName" ClientInstanceName="txtUserName" runat="server" Width="100%" 
                                                        BindingField="us_Username" BusinessObjectName="Users">
                                                    </VfsWeb:BaseTextBox>
                                                </td>
                                            </tr>
                                            <tr style="display:none;">
                                                <td>
                                                    <VfsWeb:BaseLabel ID="lblBaseLabel2" runat="server" Text="Password">
                                                    </VfsWeb:BaseLabel>
                                                </td>
                                                <td colspan="2">
                                                    <VfsWeb:BaseTextBox ID="txtPassword" ClientInstanceName="txtPassword" runat="server" Width="100%"
                                                    Password="true" IgnoreManageUIReadOnlyState="true">
                                                    </VfsWeb:BaseTextBox> 
                                                    
                                                </td>
                                            </tr>
                                            <tr style="display:none;">
                                                <td>
                                                    <VfsWeb:BaseLabel ID="BaseLabel1" runat="server" Text="Confirm Password">
                                                    </VfsWeb:BaseLabel>
                                                </td>
                                                <td colspan="2">
                                                    <VfsWeb:BaseTextBox ID="txtConPassword" ClientInstanceName="txtConPassword" runat="server" Width="100%"
                                                    Password="true" IgnoreManageUIReadOnlyState="true">
                                                    </VfsWeb:BaseTextBox> 
                                                </td>
                                             </tr>
                                            <tr>
                                                <td>
                                                    <VfsWeb:BaseLabel ID="BaseLabel2" ClientInstanceName="BaseLabel2" runat="server" Text="Employee">
                                                    </VfsWeb:BaseLabel>
                                                </td>
                                                <td>
                                                    <VfsWeb:BaseTextBox runat="server" ID="txtEmployee" 
                                                        ClientInstanceName="txtEmployee" Width="100%" 
                                                        BindingField="EmployeeNo" BusinessObjectName="UserInfos" ReadOnly="True" EnableClientSideAPI="true"></VfsWeb:BaseTextBox> 
                                                </td>
                                                <td>
                                                    <VfsWeb:BaseTextBox runat="server" ID="txtEmpName" ClientInstanceName="txtEmpName" Width="100%" 
                                                    BindingField="EmployeeName" BusinessObjectName="UserInfos" ReadOnly="True" EnableClientSideAPI="true">
                                                    </VfsWeb:BaseTextBox>
                                                </td>
                                                    <td>
                                                        <VfsWeb:BaseImage runat="server" ID="imgEmployeeSearch" ImageUrl="../Images/Search2.png">
                                                            <ClientSideEvents Click="function(s,e) { popUpEmployee.Show(); }" />
                                                        </VfsWeb:BaseImage>
                                                    </td>
                                                </tr>
                                            <tr>
                                                <td>
                                                    <VfsWeb:BaseLabel ID="lblUserGroup" runat="server" Text="User Group">
                                                    </VfsWeb:BaseLabel>
                                                </td>
                                                <td>
                                                     <VfsWeb:BaseTextBox ID="txtGroup" ClientInstanceName="txtGroup" runat="server" Width="100%" 
                                                         BindingField="Code" BusinessObjectName="UsersXRoles" ReadOnly="true" EnableClientSideAPI="true"></VfsWeb:BaseTextBox>
                                                </td>
                                                <td>
                                                    <VfsWeb:BaseTextBox ID="txtUserGrpDesc" ClientInstanceName="txtUserGrpDesc" runat="server" Width="100%" 
                                                        BindingField="Description" BusinessObjectName="UsersXRoles" ReadOnly="true" EnableClientSideAPI="true">
                                                    </VfsWeb:BaseTextBox>
                                                </td>
                                                <td>
                                                    <VfsWeb:BaseImage runat="server" ID="imgUserGrpSearch" ImageUrl="../Images/Search2.png">
                                                        <ClientSideEvents Click="function(s,e) { grdvUserGroupList.PerformCallback(); popUpUserGrp.Show(); }" />
                                                    </VfsWeb:BaseImage> 
                                                </td>
                                            </tr>
                                            <tr>
                                                <td nowrap="nowrap">
                                                    <VfsWeb:BaseLabel ID="BaseLabel5" runat="server" Text="Last Password Changed At">
                                                    </VfsWeb:BaseLabel>
                                                </td>
                                                <td colspan="2">
                                                    <VfsWeb:BaseLabel ID="lblChangedAt" runat="server" Width="100%" Text="None"
                                                        BindingField="LastPwdChangeAt" BusinessObjectName="UserInfos">
                                                    </VfsWeb:BaseLabel>
                                                </td>    
                                            </tr>
                                            <tr>
                                                <td>
                                                    <VfsWeb:BaseLabel ID="BaseLabel7" runat="server" Text="Last Login At">
                                                    </VfsWeb:BaseLabel>
                                                </td>
                                                <td colspan="2">
                                                    <VfsWeb:BaseLabel ID="lblLoginAt" runat="server" Width="100%" Text="None"
                                                        BindingField="LastLoginAt" BusinessObjectName="UserInfos">
                                                    </VfsWeb:BaseLabel>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <VfsWeb:BaseCheckBox ID="BaseCheckBox2" runat="server" 
                                                    Text="Account is locked" BindingField="Locked" 
                                                    BusinessObjectName="UserInfos">
                                                    </VfsWeb:BaseCheckBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <VfsWeb:BaseCheckBox ID="BaseCheckBox1" runat="server" 
                                                    Text="Account is inactive" BindingField="IsInactive" 
                                                    BusinessObjectName="Users">
                                                    </VfsWeb:BaseCheckBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <VfsWeb:BaseCheckBox ID="chkDeactive" runat="server" 
                                                    Text="Deactive account after" BindingField="us_IsDeactivationTimeSet" 
                                                    BusinessObjectName="Users">
                                                    </VfsWeb:BaseCheckBox>
                                                </td>
                                                <td>  
                                                    <VfsWeb:BaseDateEdit ID="deDeactivePeriod" runat="server" 
                                                        BindingField="us_DeactivationTime" BusinessObjectName="Users">
                                                    </VfsWeb:BaseDateEdit>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2"> 
                                                    <VfsWeb:BaseCheckBox ID="chkAdmin" runat="server" Text="Administrator" 
                                                        BindingField="us_IsAdministrator" BusinessObjectName="Users">
                                                    </VfsWeb:BaseCheckBox>  
                                                </td>
                                            </tr>       
                                            <tr>
                                                <td colspan="2">
                                                    <VfsWeb:BaseCheckBox ID="ChkPwdExpiry" runat="server" 
                                                    Text="Password never expires" BindingField="us_PasswordNeverExpires" 
                                                    BusinessObjectName="Users">
                                                    </VfsWeb:BaseCheckBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <VfsWeb:BaseCheckBox ID="chkChangePwdLogin" runat="server" 
                                                    Text="User must change password next login" 
                                                    BindingField="us_UserMustChangePwNextLogin" BusinessObjectName="Users">
                                                    </VfsWeb:BaseCheckBox> 
                                                </td> 
                                            </tr>
                                            <tr style="display:none;">
                                                <td colspan="2">
                                                    <VfsWeb:BaseCheckBox ID="chkCantChangePwd" runat="server" 
                                                    Text="User cannot change password" BindingField="us_UserCannotChangePassword" 
                                                    BusinessObjectName="Users">
                                                    </VfsWeb:BaseCheckBox>  
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <VfsWeb:BaseCheckBox ID="chkWindowsAuthentication" runat="server" 
                                                    Text="Use Windows authentication for this user" 
                                                    BindingField="us_UseWindowsAuth" BusinessObjectName="Users">
                                                    </VfsWeb:BaseCheckBox>  
                                                </td>
                                            </tr>
                                            <tr style="display:none;">
                                                <td colspan="2">
                                                    <VfsWeb:BaseCheckBox ID="chkAudit" runat="server" 
                                                    Text="Always audit data events for this user" BindingField="us_AlwaysAuditData" 
                                                    BusinessObjectName="Users">
                                                    </VfsWeb:BaseCheckBox> 
                                                </td>
                                            </tr> 
                                        </table>
                                        
                                     </dxp:PanelContent>
                                </PanelCollection>
                            </VfsWeb:BaseRoundPanel>
    
                        </dxw:ContentControl>
                    </ContentCollection>
                </dxtc:TabPage>
                
            </TabPages>    
        </VfsWeb:BasePageControl>
    
        </ContentTemplate>
        </asp:UpdatePanel>
        
        <dxpc:ASPxPopupControl ID="popUpEmployee" runat="server"
        HeaderText="Employee List" AllowDragging="true" ClientInstanceName="popUpEmployee" Width="250px"
        PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
            <ContentCollection>
                <dxpc:PopupControlContentControl ID="PopupControlContentControl1" runat="server">
                    <table align="center" width="100%">
                        <tr>
                            <td Width="40%">
                                <VfsWeb:BaseLabel ID="lblEmployeeNoLabel" runat="server" Text="Employee No"  Width="100px"></VfsWeb:BaseLabel>
                            </td>
                            <td Width="50%">
                                <VfsWeb:BaseTextBox ID="txtEmployeeNoText" ClientInstanceName="txtEmployeeNoText" runat="server" Width="220px" MaxLength="15"></VfsWeb:BaseTextBox>
                            </td>                                            
                            <td Width="10%">&nbsp;</td>
                        </tr>
                        <tr>
                            <td nowrap="nowrap">
                                <VfsWeb:BaseLabel ID="lblEmployeeNameLabel" runat="server" Text="Employee Name" Width="100px"></VfsWeb:BaseLabel>
                            </td>
                            <td>
                                <VfsWeb:BaseTextBox ID="txtEmployeeNameText" ClientInstanceName="txtEmployeeNameText" runat="server" Width="220px" MaxLength="50"></VfsWeb:BaseTextBox>
                            </td>                                            
                            <td>
                                <VfsWeb:BaseButton ID="BaseButton1" runat="server" Text="Search" ClientInstanceName="btnSearch" EnableClientSideAPI="true" AutoPostBack="false">
                                    <ClientSideEvents Click="function(s,e){ grdvEmployeeList.PerformCallback('BindEmployees'); }" />
                                </VfsWeb:BaseButton>
                            </td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td colspan="3">
                                <VfsWeb:BaseWBBS ID="wbbsEmployeeList" runat="server" BusinessObjectName="UnassignedLoginEmployees"></VfsWeb:BaseWBBS>
                                
                                <VfsWeb:BaseGridView ID="grdvEmployeeList" runat="server"
                                DataSourceID="wbbsEmployeeList" ClientInstanceName="grdvEmployeeList" 
                                KeyFieldName="EmployeeId" ShowEditingButtons="false" ShowSelectAllCheckBox="false" 
                                OnCustomCallback="grdvEmployeeList_CustomCallback" Width="100%">
    
                                    <Columns>
                                        <dxwgv:GridViewDataTextColumn Caption="Employee No" FieldName="EmployeeNo" VisibleIndex="1">
                                        </dxwgv:GridViewDataTextColumn>
                                        <dxwgv:GridViewDataTextColumn Caption="Employee Name" FieldName="EmployeeName" VisibleIndex="2">
                                        </dxwgv:GridViewDataTextColumn>
                                    </Columns>
                                    
                                    <SettingsBehavior AllowFocusedRow="True" AllowMultiSelection="False" AllowDragDrop="False" AllowGroup="False" />
                                    <Settings ShowFilterRow="True" ShowFilterRowMenu="True" ShowStatusBar="Visible" />
                                    
                                </VfsWeb:BaseGridView>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3">
                                <table align="center">
                                  <tr>
                                    <td>
                                        <VfsWeb:BaseButton ID="btnOkEmployee" runat="server" Text="Ok" AutoPostBack="False">
                                        <ClientSideEvents Click="function(s,e){ OnPopupOKClickedEmployee(s,e) }" />
                                        </VfsWeb:BaseButton>
                                    </td>
                                    <td>
                                        <VfsWeb:BaseButton ID="btnCancelEmployee" runat="server" Text="Cancel" AutoPostBack="false">
                                        <ClientSideEvents Click="function(s,e) { grdvEmployeeList.PerformCallback('ClearEmployee'); popUpEmployee.Hide(); }" />
                                        </VfsWeb:BaseButton>
                                    </td>
                                  </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </dxpc:PopupControlContentControl>
            </ContentCollection>
        </dxpc:ASPxPopupControl>
    
        <dxpc:ASPxPopupControl ID="popUpUserGrp" runat="server"
        HeaderText="User Group List" AllowDragging="true" ClientInstanceName="popUpUserGrp" Width="250px"
        PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
            <ContentCollection>
                <dxpc:PopupControlContentControl ID="PopupControlContentControl2" runat="server">
            
                    <VfsWeb:BaseWBBS ID="wbbsUserGrpList" runat="server" BusinessObjectName="Roles"></VfsWeb:BaseWBBS>
                    
                    <VfsWeb:BaseGridView ID="grdvUserGroupList" runat="server"
                    DataSourceID="wbbsUserGrpList" ClientInstanceName="grdvUserGroupList" KeyFieldName="rl_pk" 
                    ShowEditingButtons="false" ShowSelectAllCheckBox="false" Width="250px">
            
                        <Columns>
                            <dxwgv:GridViewDataTextColumn Caption="Code" FieldName="rl_Role" VisibleIndex="1">
                            </dxwgv:GridViewDataTextColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Description" FieldName="rl_Description" VisibleIndex="2">
                            </dxwgv:GridViewDataTextColumn>
                        </Columns>
    
                        <SettingsBehavior AllowFocusedRow="True" AllowMultiSelection="False" AllowDragDrop="False" AllowGroup="False" />
                        <Settings ShowFilterRow="True" ShowFilterRowMenu="True" ShowStatusBar="Visible" />
            
                    </VfsWeb:BaseGridView>
    
                    <table align="center">
                        <tr>
                            <td>
                                <VfsWeb:BaseButton ID="btnOKUserGroup" runat="server" Text="Ok" AutoPostBack="False">
                                <ClientSideEvents Click="function(s,e){ OnPopupOKClickedUserGroup(s, e); }" />
                                </VfsWeb:BaseButton>
                            </td>
                            <td>
                                <VfsWeb:BaseButton ID="btnCancelUserGroup" runat="server" Text="Cancel" AutoPostBack="false">
                                <ClientSideEvents Click="function(s,e) {popUpUserGrp.Hide();}" />
                                </VfsWeb:BaseButton>
                            </td>
                        </tr>
                    </table>
        </dxpc:PopupControlContentControl>
        </ContentCollection>
        </dxpc:ASPxPopupControl>
        
    </asp:Content>
    

    Code Behind

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Collections.Generic;
    using Vfs.Generic.Business.Common;
    using Vfs.Generic.Business.BusinessObject;
    using Vfs.Generic.Business.Enums;
    using DevExpress.Web.ASPxGridView;
    using MicroFour.StrataFrame.Business;
    using Vfs.Security.Common.Interfaces;
    using Vfs.Security.Common;
    using Vfs.Security.Business.BusinessObject;
    using Vfs.Generic.Utilities;
    using MicroFour.StrataFrame.Data;
    using Vfs.Generic.Communication.Business.Enums;
    using Vfs.Workflow.Task.Libraries.Structures;
    using Vfs.Workflow.Tasks.Notifications;
    using Vfs.Generic.UI.Web.DevEx.Controls;
    using Vfs.Employee.Business.BusinessObject;
    
    namespace Vfs.Flexsetup.UI.Web.Forms
    {
        public partial class UserLoginCreation : UserLoginCreationBasePage
        {
            private const string SUMMARYTITLE = "User Login Creation";
            private string _notificationType = string.Empty;
            private IList<ResultSet> _errorResult = new List<ResultSet>();
    
            #region Page Events
    
            protected void Page_Load(object sender, EventArgs e)
            {
                this.PrimaryBusinessObjectName = "Users";
                this.ViewSecurityKey = "SetupUserLoginCreation";
    
                this.UserInfos.ParentBusinessObject = this.Users;
                this.UsersXRoles.ParentBusinessObject = this.Users;
    
                this.ClickActionSummary.Visible = false;
                this.ActionSummary.Visible = false;
    
                if (!this.IsPostBack)
                {
                    this.Roles.FillAll(0);
    
                    this.InitalOption(false);
                }
                else
                {
                    this.VerifyPassword();
                }
            }
    
            protected void Page_PreRender(object sender, EventArgs e)
            {
                this.grdvUserLogin.Settings.ShowFilterBar = GridViewStatusBarMode.Hidden;
                this.grdvUserLogin.Settings.ShowFilterRow = false;
                this.grdvUserLogin.Settings.ShowFooter = false;
    
                this.grdvEmployeeList.Settings.ShowFilterBar = GridViewStatusBarMode.Hidden;
                this.grdvEmployeeList.Settings.ShowFilterRow = false;
                this.grdvEmployeeList.Settings.ShowFooter = false;
                this.grdvEmployeeList.DataSourceForceStandardPaging = true;
            }
    
            protected void Page_Unload(object sender, EventArgs e)
            {
                if (!this.IsCallback)
                {
                    
                }
            }
    
            #endregion
    
            #region Override Events
    
            protected override void CreateChildControls()
            {
                this.PrimaryUpdatePanel = this.updatePanelUser;
                base.CreateChildControls();
            }
    
            protected override void OnNavigated(NavigatedEventArgs e)
            {
                base.OnNavigated(e);
    
                if (this.EditingState == BusinessEditingState.Idle)
                {
                    if (this.Users.Count > 0)
                    {
                        this.UserInfos.FillByParentPrimaryKey(this.Users.us_pk);
                        this.UsersXRoles.FillByParentPrimaryKey(this.Users.us_pk);
                    }
                    else
                    {
                        this.UserInfos.CurrentDataTable.Clear();
                        this.UsersXRoles.CurrentDataTable.Clear();
                    }
                }
            }
    
            protected override void OnFormEditingStateChanged(EditingStateChangedEventArgs e)
            {
                base.OnFormEditingStateChanged(e);
    
                if (this.EditingState != BusinessEditingState.Idle)
                {
                    this.InitalOption(true);
    
                    if (this.EditingState == BusinessEditingState.Editing)
                    {
                        this.hEmployee.Value = this.Users.EmployeeNo;
                        this.hUserRole.Value = this.UsersXRoles.ur_rl_pk.ToString();
                    }
                    else
                    {
                        this.UserInfos.CurrentDataTable.Clear();
                        this.UsersXRoles.CurrentDataTable.Clear();
    
                        this.UserInfos.Add(true);
                        this.UsersXRoles.Add(true);
                    }
                }
                else
                {
                    this.InitalOption(false);
                    this.hEmployee.Value = string.Empty;
                }
            }
    
            protected override void OnBeforeSave(MicroFour.StrataFrame.Data.BeforeSaveUndoByFormEventArgs e)
            {
                base.OnBeforeSave(e);
    
                this.Users.Locked = this.UserInfos.Count > 0 ? this.UserInfos.Locked : false;
            }
    
            protected override void OnAfterSave(MicroFour.StrataFrame.Data.AfterSaveUndoByFormEventArgs e)
            {
                base.OnAfterSave(e);
    
                this.InitalOption(false);
                this.grdvUserLogin.Selection.UnselectAll();
                this.grdvUserLogin.DataBind();
    
                #region Send Notifications
    
                //Save Notification Tasks Logs & Vfs.Workflow.Tasks.EmailNotification.exe will send the email
                if (this.Users.Count > 0)
                {
                    if (this.Users.us_UserMustChangePwNextLogin == true)
                    {
                        if (this._notificationType == string.Empty)
                        {
                            this._notificationType = EmailType.SecurityNotifyNewUserCreatedByOwner.ToString();
                        }
    
                        string employeeNo = this.UserInfos.Count > 0 ? this.UserInfos.EmployeeNo : this.txtEmployee.Text;
    
                        IList<RecipientInfo> recipientList = new List<RecipientInfo>();
                        recipientList = this.GetRecipientList(employeeNo, this._notificationType);
    
                        IDictionary<string, string> customField = new Dictionary<string, string>();
                        customField.Add("us_username", this.Users.us_Username);
                        customField.Add("us_data", this.Users.us_PasswordPlainText);
    
                        NotificationTask notificationTask = new NotificationTask(null, null, customField, GuidUtil.NewComb().ToString());
                        ResultSet resultSet = notificationTask.Send(recipientList, this._notificationType, customField);
    
                        this._notificationType = string.Empty;
    
                        if (!resultSet.IsValid)
                        {
                            throw new Exception("NotificationTask - Can't Create New Row for NotificationTaskLogs!");
                        }
                    }
                }
    
                #endregion
            }
    
            protected override void OnAfterUndo(MicroFour.StrataFrame.Data.AfterSaveUndoByFormEventArgs e)
            {
                base.OnAfterUndo(e);
    
                this.UserInfos.Undo(BusinessUndoType.AllRows);
                this.UsersXRoles.Undo(BusinessUndoType.AllRows);
    
                this.InitalOption(false);
                this.grdvUserLogin.Selection.UnselectAll();
                this.grdvUserLogin.DataBind();
            }
    
            protected override void OnAfterDelete(AfterDeleteEventArgs e)
            {
                base.OnAfterDelete(e);
    
                this.Users.MoveFirst();
                this.InitalOption(false);
                this.grdvUserLogin.Selection.UnselectAll();
                this.grdvUserLogin.DataBind();
            }
    
            #endregion
    
            #region Control Events
    
            protected void grdvUserLogin_HtmlRowCreated(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e)
            {
                if (e.RowType == DevExpress.Web.ASPxGridView.GridViewRowType.Data)
                {
                    BaseHyperLink lnkUserId = (BaseHyperLink)this.grdvUserLogin.FindRowCellTemplateControl(e.VisibleIndex,
                        (GridViewDataColumn)this.grdvUserLogin.Columns["us_Username"], "lnkUserId");
    
                    object[] rowValues = this.grdvUserLogin.GetRowPrimaryKeyValues(e.VisibleIndex);
    
                    lnkUserId.ClientSideEvents.Click = "function(s,e){ UserIdSelected('" + rowValues[0].ToString() + "'); }";
                }
            }
    
            protected void grdvUserLogin_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e)
            {
                if (e.DataColumn.FieldName.Equals("Locked"))
                {
                    bool isUserLocked = bool.Parse(this.grdvUserLogin.GetRowValues(e.VisibleIndex, "Locked").ToString());
    
                    if (isUserLocked)
                    {
                        e.Cell.Text = "Yes";
                    }
                    else
                    {
                        e.Cell.Text = "No";
                    }
                }
    
                if (e.DataColumn.FieldName.Equals("IsInactive"))
                {
                    bool isUserInactive = bool.Parse(this.grdvUserLogin.GetRowValues(e.VisibleIndex, "IsInactive").ToString());
    
                    if (isUserInactive)
                    {
                        e.Cell.Text = "Yes";
                    }
                    else
                    {
                        e.Cell.Text = "No";
                    }
                }
            }
    
            protected void grdvEmployeeList_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
            {
                if (e.Parameters == "BindEmployees")
                {
                    if (this.EditingState == BusinessEditingState.Adding)
                    {
                        this.BindUnassignedLoginEmployees();
                        this.RemoveSelectedUnassignedLoginEmployees(this.hEmployee.Value.ToString());
                    }
                }
                else if (e.Parameters == "ClearEmployee")
                {
                    this.UnassignedLoginEmployees.CurrentDataTable.Clear();
                }
    
                this.grdvEmployeeList.PageIndex = 0;
                this.grdvEmployeeList.DataBind();
            }
    
            #endregion
    
            #region Protected Methods
    
            protected void lblUserId_Click(object sender, EventArgs e)
            {
                System.Diagnostics.EventLog evtLog = new System.Diagnostics.EventLog();
                evtLog.Source = "ASP.NET 2.0.50727.0";
    
                evtLog.WriteEntry("Value: " + this.hUserId.Value.ToString());
    
                try
                {
                    switch (this.hUserId.Value)
                    {
                        case "EMPTY":
                            this.UnassignedLoginEmployees.CurrentDataTable.Clear();
                            this.UserInfos.CurrentDataTable.Clear();
                            this.UsersXRoles.CurrentDataTable.Clear();
                            this.Users.CurrentDataTable.Clear();
    
                            this.rdoListIsInactiveSearch.SelectedIndex = 2;
                            this.rdoListIsLockedSearch.SelectedIndex = 2;
                            this.grdvUserLogin.Selection.UnselectAll();
                            this.grdvUserLogin.PageIndex = 0;
                            break;
                        case "FILL":
                            this.Users.CurrentDataTable.Clear();
    
                            string employeeNameSearch = StringUtil.SingleQouteReplacement(this.txtEmployeeNameSearch.Text.Trim());
    
                            DataTable dt = this.Users.GetByFilteringParameters(0,
                            this.txtEmployeeNoSearch.Text, employeeNameSearch,
                            this.txtUserIDSearch.Text, this.txtUserGroupSearch.Text,
                            int.Parse(this.rdoListIsLockedSearch.Value.ToString()), false);
    
                            this.Users.MergeDataFrom(dt, MergeDataTableOptions.MergeFromDefaultView_ReplaceExistingDuplicates);
    
                            this.grdvUserLogin.Selection.UnselectAll();
    
                            evtLog.WriteEntry("User Count: " + this.Users.Count.ToString());
                            evtLog.WriteEntry("User Count: " + this.Users.Count.ToString());
    
                            break;
                        case "ResetUserPassword":
                            this.UserAccountActionClick(this.hUserId.Value);
                            break;
                        case "LockUserAccount":
                            this.UserAccountActionClick(this.hUserId.Value);
                            break;
                        case "UnlockUserAccount":
                            this.UserAccountActionClick(this.hUserId.Value);
                            break;
                        default:
                            this.grdvUserLogin.FocusedRowIndex = -1;
                            this.grdvUserLogin.Selection.UnselectAll();
                            if (this.hUserId.Value != "")
                            {
                                int userPk = int.Parse(this.hUserId.Value.ToString());
                                this.grdvUserLogin.Selection.SelectRowByKey(userPk);
                                this.grdvUserLogin.Selection.SetSelectionByKey(userPk, true);
    
                                this.Users.NavigateToPrimaryKey(userPk);
                            }
                            break;
    
                    }
                    this.hUserId.Value = "";
                    this.hIsUserInactive.Value = "";
                    this.grdvUserLogin.DataBind();
                    this.maintenanceToolbar.DataBind();
    
                    evtLog.WriteEntry("No Problem");
                }
                catch (Exception ex)
                {
                    evtLog.WriteEntry(ex.Message);
                }
                finally
                {
                    evtLog.Dispose();
                }
            }
    
            #endregion
    
            #region Private Methods
    
            private void UserAccountActionClick(string selectedType)
            {
                var selectedRows = this.grdvUserLogin.GetSelectedFieldValues(this.grdvUserLogin.KeyFieldName);
    
                if (selectedRows.Count > 0)
                {
                    foreach (object id in selectedRows)
                    {
                        this.Users.NavigateToPrimaryKey(id);
    
                        switch (selectedType)
                        {
                            case "ResetUserPassword":
                                this.ResetUserAccount();
                                break;
                            case "LockUserAccount":
                                this.LockUserAccount(true);
                                break;
                            case "UnlockUserAccount":
                                this.LockUserAccount(false);
                                break;
                        }
    
                        SaveUndoResult saveResult = this.Save(true);
    
                        if (saveResult != SaveUndoResult.Success)
                        {
                            foreach (BrokenRule brokenRule in this.Users.BrokenRules.ToArray())
                            {
                                ResultSet result = new ResultSet();
    
                                string errorMessage = "[" + brokenRule.FieldName + "] " + brokenRule.Description;
                                result.Message = errorMessage;
    
                                this._errorResult.Add(result);
                            }
                        }
                    }
    
                    if (this._errorResult.Count > 0)
                    {
                        this.ClickActionSummary.Visible = true;
                        this.ClickActionSummary.UpdateBulkActionSummary(SUMMARYTITLE, this._errorResult, selectedRows.Count - this._errorResult.Count);
                    }
                }
            }
    
            private void LockUserAccount(bool locked)
            {
                this.Users.us_ConfirmPassword = this.Users.us_PasswordPlainText;
                this.Users.Locked = this.UserInfos.Locked = locked;
            }
    
            private void ResetUserAccount()
            {
                string password = string.Empty;
                string confirmPassword = string.Empty;
    
                IPasswordGenerator passwordGenerator = new PasswordGenerator();
                password = confirmPassword = passwordGenerator.GeneratePasswordByEmployeeNo(this.UserInfos.EmployeeNo);
    
                if (!string.IsNullOrEmpty(password))
                {
                    this.Users.us_PasswordPlainText = password.Trim();
                    this.Users.us_ConfirmPassword = confirmPassword.Trim();
                    this.Users.us_UserMustChangePwNextLogin = true;
                    this.Users.us_IsInactive = false;
                    this.Users.PwdChangeAt = DateTime.Now.ToString();
                    this.UserInfos.LastPwdChangeAt = DateTime.Now;
    
                    this._notificationType = EmailType.SecurityNotifyForgotPasswordRequestByOwner.ToString();
    
                    this.Users.CheckPasswordIsNRIC(this.UserInfos.EmployeeNo);
                }
                else
                {
                    ResultSet result = new ResultSet();
    
                    string errorMessage = "[" + this.UserInfos.EmployeeNo.Trim() + "] " + "Password cannot be empty.";
                    result.Message = errorMessage;
    
                    this._errorResult.Add(result);
                }
            }
    
            private IList<RecipientInfo> GetRecipientList(string employeeNo, string notificationType)
            {
                RecipientInfo recipientInfo = new RecipientInfo();
                IList<RecipientInfo> recipientList = new List<RecipientInfo>();
    
                //Get User Email Address
                EmployeesBO employeeBO = new EmployeesBO();
                employeeBO.FillByEmployeeNo(employeeNo);
    
                recipientInfo.emailCode = notificationType;
    
                if (employeeBO.Count > 0)
                {
                    recipientInfo.emailAddress = employeeBO.Email.Trim();
                }
    
                recipientInfo.recipientEmployeeNo = employeeNo;
    
                recipientList.Add(recipientInfo);
    
                employeeBO.Clear();
                employeeBO.Dispose();
                employeeBO = null;
    
                return recipientList;
            }
    
            private void BindUnassignedLoginEmployees()
            {
                //Bind the Unassigned login Employees list
                this.UnassignedLoginEmployees.FillUnassignedLoginEmployeesByEmployeeNoByEmployeeName(this.txtEmployeeNoText.Text, this.txtEmployeeNameText.Text, DateTime.Today);
            }
    
            private void RemoveSelectedUnassignedLoginEmployees(string employeeNo)
            {
                bool found = this.UnassignedLoginEmployees.Seek("EmployeeNo='" + employeeNo + "'");
    
                if (found)
                {
                    this.UnassignedLoginEmployees.DeleteCurrentRow(true);
                }
            }
    
            private void VerifyPassword()
            {
                if (this.EditingState != BusinessEditingState.Idle)
                {
                    if (this.EditingState == BusinessEditingState.Adding ||
                       (this.EditingState == BusinessEditingState.Editing && !this.Users.EmployeeNo.Equals(this.hEmployee.Value.ToString())))
                    {
                        string password = this.SetPassword();
    
                        this.Users.EmployeeNo = this.hEmployee.Value.ToString();
                        this.Users.EmployeeName = this.txtEmpName.Text.Trim();
                        this.Users.us_ConfirmPassword = this.Users.us_PasswordPlainText = password.Trim();
                        
                        if (this.UserInfos.Count > 0)
                        {
                            this.UserInfos.LastPwdChangeAt = DateTime.Now;
                            this.UserInfos.PwdChanged = true;
                            this.UserInfos.EmployeeNo = this.hEmployee.Value.ToString();
                        }
                    }
                    else if (this.EditingState == BusinessEditingState.Editing && this.Users.EmployeeNo.Equals(this.hEmployee.Value.ToString()))
                    {
                        UsersBO tempUsers = new UsersBO();
                        UserInformationsBO tempUserInfos = new UserInformationsBO();
    
                        tempUsers.FillByPrimaryKey(this.Users.us_pk);
                        tempUserInfos.FillByParentPrimaryKey(tempUsers.us_pk);
    
                        if (tempUsers.Count > 0 && tempUserInfos.Count > 0)
                        {
                            string password = this.SetPassword();
    
                            this.Users.us_ConfirmPassword = this.Users.us_PasswordPlainText = tempUsers.us_PasswordPlainText;
                            this.UserInfos.LastPwdChangeAt = tempUserInfos.LastPwdChangeAt;
                            this.UserInfos.PwdChanged = tempUserInfos.PwdChanged;
    
                            this.Users.UserGroupCode = this.hUserGroupCode.Value.ToString();
                            this.UserInfos.EmployeeNo = string.IsNullOrEmpty(this.hEmployee.Value.ToString()) ? this.Users.EmployeeNo : this.hEmployee.Value.ToString();
                            this.UsersXRoles.ur_rl_pk = string.IsNullOrEmpty(this.hUserRole.Value.ToString()) ? this.UsersXRoles.ur_rl_pk : int.Parse(this.hUserRole.Value.ToString());
                        }
    
                        tempUsers.Dispose();
                        tempUsers = null;
                        tempUserInfos.Dispose();
                        tempUserInfos = null;
                    }
                }
            }
    
            private string SetPassword()
            {
                IPasswordGenerator passwordGenerator = new PasswordGenerator();
    
                string employeeNo = this.UserInfos.Count > 0 ? this.UserInfos.EmployeeNo : this.hEmployee.Value.ToString();
    
                string password = passwordGenerator.GeneratePasswordByEmployeeNo(employeeNo);
    
                return password;
            }
    
            private void InitalOption(bool enable)
            {
                this.pageControl.TabPages[0].ClientEnabled = !enable;
    
                this.imgUserGrpSearch.Visible = enable;
                this.imgEmployeeSearch.Visible = this.EditingState == BusinessEditingState.Adding ? true : false;
            }
    
            #endregion
        }
    }
    




    Thursday, October 31, 2013 11:07 PM
  • User551462331 posted

    what button u clicked? which event u expected to be called?

    the button btnUserIdSearch appears to have only client side event... so it is only javascript event that will be called...

    which button ur referring to?

    Thursday, October 31, 2013 11:35 PM
  • User-150770710 posted

    Hi
    Sorry for my misleading post.

    In fact, I just simplified my scenario for ease of understand.

    Once btnUserIdSearch button is click, client side function btnUserIdSearch_Click will be called. It would then call FilterIsUserInactive() which will perform grdvUserLogin.AutoFilterByColumn() callback. Once done - grdvUserLogin_OnEndCallback, program will call a virtual button - virtualClickButton() to trigger AJAX callback

    Thursday, October 31, 2013 11:53 PM