Hi Experts,
I have deployed one site before six month.
It is working fine till the date.
in this, the login page load completely at first time.
and it contain parent-child combo box controll.
So when i select one value from first combo box, it will fill second combo box.
then i can able to login in this site.
but now, my first combo filled successfully, but when i select one option from it, page can not post back and not load second combo box.
even i am not able to click login button.
How it is possible and how can i resolve this problem.
any hell will be appreciate.
thanks in advance
This is my Code
Login.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LogIn.aspx.cs" Inherits="LogIn"
Culture="auto" meta:resourcekey="PageResource1" UICulture="auto" EnableTheming="false" %>
<%@ Register Assembly="DevExpress.Web.v10.1" Namespace="DevExpress.Web.ASPxLoadingPanel"
TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.1" Namespace="DevExpress.Web.ASPxCallback"
TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.1" Namespace="DevExpress.Web.ASPxEditors"
TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Payroll :: Login</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link type="text/css" rel="Stylesheet" href="../HttpCombiner.ashx?s=Set_Css_login&t=text/css&v=2.1" />
<link rel="FAVICON ICON" type="image/gif" href="../images/Favicon.gif" />
</head>
<body>
<script type="text/javascript" src="../HttpCombiner.ashx?s=Set_Javascript&t=type/javascript&v=2">
</script>
<script language="javascript" type="text/javascript">
</script>
<form id="form1" runat="server" defaultbutton="btnLogin1">
<script language="javascript" type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(prm_InitializeRequest);
prm.add_endRequest(prm_EndRequest);
function prm_InitializeRequest(sender, args) {
document.getElementById('CheckJScript').style.visibility = 'hidden';
hideWaiting();
}
function prm_EndRequest(sender, args) {
document.getElementById('CheckJScript').style.visibility = 'hidden';
hideWaiting();
}
</script>
<div id="divwrape" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="waiting" style="position: absolute; left: 0px; top: 0px; background-color: white;
height: 100%; width: 100%;">
<center>
<table width="100%" style="padding-removed 150px;">
<tr id="CheckJScript" runat="server" style="visibility: visible;">
<td align="center" style="color: Red;">
<h4>
Java Script is disable.
<br />
Please Enabled JavaScript and Reload Page.
</h4>
</td>
</tr>
<tr>
<td align="center">
<img src="../images/processing.gif" alt=" " />
</td>
</tr>
</table>
</center>
</div>
<script language="javascript" type="text/javascript">
document.getElementById('CheckJScript').style.visibility = 'hidden';
</script>
<dx:ASPxCallback ID="ASPxCallback1" runat="server" ClientInstanceName="Callback">
<ClientSideEvents CallbackComplete="function(s, e) { LoadingPanel.Hide(); }" />
</dx:ASPxCallback>
<dx:ASPxLoadingPanel ID="LoadingPanel" runat="server" ClientInstanceName="LoadingPanel"
Modal="True" Text="Processing...">
</dx:ASPxLoadingPanel>
<div class="login-main">
<div class="login-header-bg">
<div class="login-logo-space">
<div class="login-logo">
</div>
</div>
<div class="login-title-space">
<div>
Member Login</div>
</div>
</div>
<div class="login-content">
<div class="login-page-center-content">
<div class="login-page-center">
<div class="login-raw">
<div class="login-raw-a">
<div class="login-name-space">
</div>
<div class="login-input-space" style="height: 15px">
<asp:Label ID="lblError" runat="server" ForeColor="Red" Font-Bold="True" meta:resourcekey="lblErrorResource1"></asp:Label>
</div>
</div>
<div class="login-raw-a">
<div class="login-name-space">
Company</div>
<div class="login-input-space">
<dx:ASPxComboBox ID="ddlCompanyName" runat="server" Width="280px" AutoPostBack="True"
önSelectedIndexChanged="ddlCompanyName_SelectedIndexChanged" TabIndex="0" ClientInstanceName="ddlCompanyName">
</dx:ASPxComboBox>
</div>
</div>
<div class="login-raw-a">
<div class="login-name-space">
Branch</div>
<div class="login-input-space">
<dx:ASPxComboBox ID="ddlBranchName" runat="server" Width="280px" AutoPostBack="True"
önSelectedIndexChanged="ddlBranchName_SelectedIndexChanged" TabIndex="0" ClientInstanceName="ddlBranchName">
</dx:ASPxComboBox>
</div>
</div>
<div class="login-raw-a">
<div class="login-name-space">
Current Year</div>
<div class="login-input-space">
<dx:ASPxComboBox ID="ddlCurrentYear" runat="server" Width="280px" TabIndex="0" ClientInstanceName="ddlCurrentYear">
</dx:ASPxComboBox>
</div>
</div>
<div class="login-raw-a">
<div class="login-name-space">
User Name</div>
<div class="login-input-space">
<asp:TextBox ID="txtUserName" runat="server" Width="276px" TabIndex="0"></asp:TextBox>
</div>
</div>
<div class="login-raw-a">
<div class="login-name-space">
Password</div>
<div class="login-input-space">
<asp:TextBox ID="txtPassword" runat="server" TextMode="Password" Width="276px" TabIndex="0"></asp:TextBox>
</div>
</div>
<div class="login-raw-a">
<div class="login-name-space">
<div class="login-input-space">
<asp:TextBox ID="txtTockenNumber" runat="server" AutoComplete="Off" Width="276px"
TabIndex="0" Text="a" Visible="false"></asp:TextBox>
</div>
</div>
<div class="login-raw-a">
<div class="login-name-space">
</div>
<div class="login-input-space">
<div class="login-name-space">
<div class="login-button">
<%----%>
<asp:Button ID="btnLogin1" runat="server" Text="Login" OnClick="btnLogin_Click" CssClass="login-button"
Visible="false" />
<asp:LinkButton ID="btnLogin" runat="server" OnClick="btnLogin_Click" ValidationGroup="save">Login</asp:LinkButton>
</div>
</div>
<div class="login-name-space">
<div class="login-button">
<%----%>
<asp:LinkButton ID="btnCancel" runat="server" OnClick="btnCancel_Click" TabIndex="0">Cancel</asp:LinkButton>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="login-page-bottom">
</div>
</div>
</div>
</div>
<div id="login-footer">
<div class="login-footer-mantra">
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
<script language="javascript" type="text/javascript">
function checkValidLogin(txtUserName, txtPassword, txtTockenNumber, td) {
if (!chkComboSelectionTD(ddlBranchName.GetValue(), 'Branch.', td)) {
ddlBranchName.Focus();
return false;
}
if (!chkComboSelectionTD(ddlCurrentYear.GetValue(), 'Current Year.', td)) {
ddlCurrentYear.Focus();
return false;
}
if (!chkBlankFieldTD(txtUserName, 'User Name.', td)) {
return false;
}
if (!chkBlankFieldTD(txtPassword, 'Password.', td)) {
return false;
}
return true;
}
function txtPasswordKeyPress(tdError, event) {
ClearTdTextNoImg(tdError);
Check_CapsLock_Key(tdError, event);
}
function btnLoginClick(txtUserName, txtPassword, txtTockenNumber, td) {
if (!checkValidLogin(txtUserName, txtPassword, txtTockenNumber, td)) {
return false;
}
Callback.PerformCallback();
LoadingPanel.Show();
return true;
}
function callbcakon() { Callback.PerformCallback(); LoadingPanel.Show(); }
setTimeout('hideWaiting()', 1000);
function hideWaiting() {
document.getElementById('waiting').style.visibility = 'hidden';
}
</script>
</body>
</html>
Login.aspx.cs
using System;
using System.Data;
using PayrollClassLibrary;
using PayrollStaticClasses;
using System.Web;
using System.Web.Security;
using ASP;
public partial class LogIn : System.Web.UI.Page
{
#region "Variables"
BALLogIn objBALLogIn = new BALLogIn();
protected string msUserID = "";
protected string msUserVal = "";
protected string msSessionCacheValue = "";
protected string msSessionClientIPCacheValue = "";
#endregion
#region "Events"
protected void Page_Load(object sender, EventArgs e)
{
lblError.Text = "";
msUserID = txtUserName.Text.ToString().Trim();
msUserVal = Context.Request.ServerVariables["REMOTE_ADDR"].ToString() + "@" + Request.Browser.Browser.ToString() + Request.UserAgent.ToString();
msSessionCacheValue = "";
try
{
if (!IsPostBack)
{
clearData();
if (Session["test"] != null && Session["CurrentUser"] != null)
{
HttpContext.Current.Cache.Remove("SessionTimeOut" + Session["test"].ToString());
HttpContext.Current.Cache.Remove(Session["CurrentUser"] + Session["test"].ToString());
}
try
{
string RollCacheKey = "LoginValue," + Session["BranchCode"].ToString() + "," + Session["CompanyCode"].ToString() + "," + Session["RollCode"].ToString();
HttpContext.Current.Cache.Remove(RollCacheKey);
}
catch
{ }
jScriptInit();
Session.Abandon();
fillddlCompany();
fillddlBranchName(Convert.ToString(Convert.ToString(ddlCompanyName.Value)));
if (Session["unAuthorised"] != null)
{
lblError.Text = "You are not assigned any Role.";
}
ddlCompanyName.Focus();
}
}
catch (Exception ex)
{
}
}
public bool ProcessPage()
{
msSessionCacheValue = ((global_asax)Context.ApplicationInstance).GetSessionCacheItem("SessionTimeOut", msUserID);
if (msSessionCacheValue.ToString() == txtUserName.Text.ToString().Trim())
{
return false;
}
((global_asax)Context.ApplicationInstance).InsertSessionCacheItem("SessionTimeOut", msUserID, msUserID);
((global_asax)Context.ApplicationInstance).InsertSessionCacheItem("CurrentUser", msUserID, msUserVal);
return true;
}
protected void ddlCompanyName_SelectedIndexChanged(object sender, EventArgs e)
{
fillddlBranchName(Convert.ToString(ddlCompanyName.SelectedItem.Value));
ddlBranchName.Focus();
}
public bool validLogin()
{
try
{
if (ddlCompanyName.SelectedIndex == 0)
{
lblError.Text = "Please Select Company.";
return false;
}
if (ddlBranchName.SelectedIndex == 0)
{
lblError.Text = "Please Select Branch.";
return false;
}
if (ddlCurrentYear.SelectedIndex == 0)
{
lblError.Text = "Please Select Current Year.";
return false;
}
if (txtUserName.Text.Trim() == "")
{
lblError.Text = "Please Enter User Name.";
return false;
}
if (txtPassword.Text.Trim() == "")
{
lblError.Text = "Please Enter Password.";
return false;
}
return true;
}
catch (Exception ex)
{
return false;
}
}
protected void btnLogin_Click(object sender, EventArgs e)
{
try
{
if (validLogin())
{
objBALLogIn.CompanyId = int.Parse(ddlCompanyName.SelectedItem.Value.ToString());
objBALLogIn.BranchId = int.Parse(ddlBranchName.SelectedItem.Value.ToString());
objBALLogIn.CurrentYear = Convert.ToString(ddlCurrentYear.SelectedItem.Text.ToString());
objBALLogIn.MastName = txtUserName.Text;
objBALLogIn.Password = txtPassword.Text;
objBALLogIn.TicketNo = "a";
objBALLogIn.IPAddress = Context.Request.ServerVariables["REMOTE_ADDR"].ToString();
objBALLogIn.GetById();
if (objBALLogIn.MastCode == 0)
{
lblError.Text = "Wrong User Name, Password Or Token Number.";
}
else
{
if (objBALLogIn.RoleId == 0)
{
lblError.Text = "You are not assigned any Role.";
}
else
{
lblError.Text = "";
Session["RollCode"] = objBALLogIn.RoleId;
Session["BranchCode"] = objBALLogIn.BranchId;
Session["CompanyCode"] = objBALLogIn.CompanyId;
Session["UserId"] = objBALLogIn.MastCode;
Session["UserName"] = Convert.ToString(txtUserName.Text);
Session["Year"] = objBALLogIn.CurrentYear;
Session["CurrentYear"] = Convert.ToString(ddlCurrentYear.SelectedItem.Text);
DataSet DS = new DataSet();
DataTable dt = new DataTable();
DS = objBALLogIn.GetCompBrInfo();
dt = DS.Tables[0];
if (dt != null && dt.Rows.Count > 0)
{
Session["CompName"] = Convert.ToString(dt.Rows[0]["CompanyName"]);
Session["CompAddress"] = Convert.ToString(dt.Rows[0]["compAddress"]);
Session["BrName"] = Convert.ToString(dt.Rows[0]["BranchName"]);
Session["BrAddress"] = Convert.ToString(dt.Rows[0]["BranchAddress"]);
Session["SMTPIP"] = Convert.ToString(dt.Rows[0]["SMTPIP"]);
Session["SMTPEmail"] = Convert.ToString(dt.Rows[0]["SMTPEmail"]);
string uniqueSessionKey = "";
uniqueSessionKey = uniqueSessionKey + DateTime.Now.Millisecond.ToString();
uniqueSessionKey = uniqueSessionKey + DateTime.Now.Day.ToString();
uniqueSessionKey = uniqueSessionKey + DateTime.Now.Hour.ToString();
uniqueSessionKey = uniqueSessionKey + ((DateTime.Now.Second) + 100).ToString();
Session["uniqueSessionKey"] = uniqueSessionKey;
}
Response.Redirect("../Forms/HomePage.aspx", false);
}
}
}
}
catch (Exception ex)
{
lblError.Text = ex.Message;
}
}
protected void btnCancel_Click(object sender, EventArgs e)
{
clearData();
}
protected void ddlBranchName_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
fillddlCurrentYear(ddlCompanyName.SelectedItem.Value.ToString(), ddlBranchName.SelectedItem.Value.ToString());
ddlBranchName.Focus();
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region "My Functions"
private void clearData()
{
ddlCompanyName.SelectedIndex = 0;
ddlBranchName.SelectedIndex = 0;
ddlCompanyName.Focus();
txtUserName.Text = "";
txtPassword.Text = "";
lblError.Text = "";
txtTockenNumber.Text = "a";
ddlCurrentYear.Items.Clear();
ddlCurrentYear.SelectedIndex = -1;
}
protected void fillddlCurrentYear(string CompanyId, string BranchId)
{
try
{
if (ddlBranchName.SelectedIndex != 0)
{
DataSet ds = new DataSet();
AskInfo objComboData = new AskInfo();
ds = objComboData.GetComboDetails("ComboFill_SPTblYearMaster", Convert.ToInt16(CompanyId), Convert.ToInt16(BranchId));
ddlCurrentYear.DataSource = ds.Tables[0];
ddlCurrentYear.TextField = "MastName";
ddlCurrentYear.ValueField = "MastCode";
ddlCurrentYear.DataBind();
ddlCurrentYear.SelectedIndex = 0;
}
else
{
ddlCurrentYear.Items.Clear();
ddlCurrentYear.Text = "";
}
}
catch (Exception ex)
{
throw ex;
}
}
protected void fillddlCompany()
{
try
{
DataSet ds = new DataSet();
AskInfo objComboData = new AskInfo();
ds = objComboData.GetComboDetails("ComboFill_SPTblCompanyMaster", 0, 0);
ddlCompanyName.DataSource = ds.Tables[0];
ddlCompanyName.TextField = "MastName";
ddlCompanyName.ValueField = "MastCode";
ddlCompanyName.DataBind();
ddlCompanyName.SelectedIndex = 0;
}
catch (Exception ex)
{
throw ex;
}
}
protected void fillddlBranchName(string companyid)
{
try
{
if (ddlCompanyName.SelectedIndex != 0)
{
DataSet ds = new DataSet();
AskInfo objComboData = new AskInfo();
ds = objComboData.GetComboDetails("ComboFill_SPTblBranMaster", Convert.ToInt16(companyid), 0);
ddlBranchName.DataSource = ds.Tables[0];
ddlBranchName.TextField = "MastName";
ddlBranchName.ValueField = "MastCode";
ddlBranchName.DataBind();
ddlBranchName.SelectedIndex = 0;
}
else
{
ddlBranchName.Items.Clear();
ddlCurrentYear.Items.Clear();
ddlBranchName.Text = "";
ddlCurrentYear.Text = "";
}
}
catch (Exception ex)
{
lblError.Text = ex.Message;
}
}
public void jScriptInit()
{
txtUserName.Attributes.Add("OnKeyPress", "ClearTdTextNoImg('" + lblError.ClientID + "');");
txtPassword.Attributes.Add("OnKeyPress", "txtPasswordKeyPress('" + lblError.ClientID + "',event);");
txtTockenNumber.Attributes.Add("OnKeyPress", "ClearTdTextNoImg('" + lblError.ClientID + "');");
btnLogin.Attributes.Add("OnClick", "return btnLoginClick('" + txtUserName.ClientID + "','" + txtPassword.ClientID + "','" + txtTockenNumber.ClientID + "','" + lblError.ClientID + "');");
btnLogin1.Attributes.Add("OnClick", "return btnLoginClick('" + txtUserName.ClientID + "','" + txtPassword.ClientID + "','" + txtTockenNumber.ClientID + "','" + lblError.ClientID + "');");
}
#endregion
}