Solved

Unable to fire event in asp.ne controls page in tab strip contrl.

Posted on 2004-09-06
3
620 Views
Last Modified: 2008-01-09
Please give me solution.

Error :--
Server Error in '/' Application.
--------------------------------------------------------------------------------

The viewstate is invalid for this page and might be corrupted.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The viewstate is invalid for this page and might be corrupted.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[HttpException (0x80004005): The viewstate is invalid for this page and might be corrupted.]
   System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +140
   System.Web.UI.Page.LoadPageViewState() +17
   System.Web.UI.Page.ProcessRequestMain() +423

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573





I have 6 pages one is for tab strip control rest of pages for tabs. All tabs are custom controls. But when i click button error occured(the button is located in custom controls).

The files are:----
1.EmployeeMaster.aspx(no codebehind). // This is tabstrip contrl page.
2. EmployeeGeneral.ascx(codebehind is EmployeeGeneralCodeBehind.cs) // This is for tab.
3.EmployeeAddress .........

i attaching 3 files they are.. employeemastre.aspx,employeegeneral.ascx,employeecodebehind.cs.

1:-----
EmployeeMaster.aspx :

<%@ Page Language="C#" %>
<%@ Register TagPrefix="mytab" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="emp" TagName="general" Src="EmployeeGeneral.ascx" %>
<%@ Register TagPrefix="emp" TagName="address" Src="EmployeeAddress.ascx" %>
<%@ Register TagPrefix="emp" TagName="joining" Src="EmployeeJoining.ascx" %>
<%@ Register TagPrefix="emp" TagName="paystructure" Src="EmployeePayStructure.ascx" %>
<%@ Register TagPrefix="emp" TagName="grade" Src="EmployeeGrade.ascx" %>
<%@ Register TagPrefix="emp" TagName="designation" Src="EmployeeDesignation.ascx" %>
<%@ Register TagPrefix="emp" TagName="costcenter" Src="EmployeeCostCenter.ascx" %>
<html>
<head>
    <title>Employee Master Entry Form</title>
    <link href="style/style1.css" type="text/css" rel="stylesheet" />
    <script language="javascript" src="java_script/EmployeeGeneral.js"></script>
</head>
<body>
    <form id="master" runat="server">
        <center>
            <mytab:TabStrip id="tsHoriz" style="FONT-WEIGHT: bold" runat="server" TabSelectedStyle="border:solid 1px black;border-bottom:none;background:white;padding-left:5px;padding-right:5px;" TabHoverStyle="color:red" TabDefaultStyle="border:solid 1px black;background:#dddddd;padding-left:5px;padding-right:5px;" TargetID="mpHoriz" SepDefaultStyle="border-bottom:solid 1px #000000;" Width="750px">
                <mytab:Tab Text="General"></mytab:Tab>
                <mytab:TabSeparator></mytab:TabSeparator>
                <mytab:Tab Text="Address"></mytab:Tab>
                <mytab:TabSeparator></mytab:TabSeparator>
                <mytab:Tab Text="Joining"></mytab:Tab>
                <mytab:TabSeparator></mytab:TabSeparator>
                <mytab:Tab Text="Pay Structure"></mytab:Tab>
                <mytab:TabSeparator></mytab:TabSeparator>
                <mytab:Tab Text="Grade"></mytab:Tab>
                <mytab:TabSeparator></mytab:TabSeparator>
                <mytab:Tab Text="Designation"></mytab:Tab>
                <mytab:TabSeparator></mytab:TabSeparator>
                <mytab:Tab Text="Cost Center"></mytab:Tab>
                <mytab:TabSeparator DefaultStyle="width:100%;"></mytab:TabSeparator>
            </mytab:TabStrip>
            <mytab:MultiPage id="mpHoriz" style="BORDER-RIGHT: #000000 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: medium none; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #000000 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #000000 1px solid" runat="server" Width="750px" Height="400px" align="center">
                <mytab:PageView>
                    <br />
                    <emp:general id="emp_general" runat="server" />
                </mytab:PageView>
                <mytab:PageView>
                    <br />
                    <emp:address id="emp_address" runat="server" />
                </mytab:PageView>
                <mytab:PageView>
                    <br />
                    <emp:joining id="emp_joining" runat="server" />
                </mytab:PageView>
                <mytab:PageView>
                    <br />
                    <emp:paystructure id="emp_paystructure" runat="server" />
                </mytab:PageView>
                <mytab:PageView>
                    <br />
                    <emp:grade id="emp_grade" runat="server" />
                </mytab:PageView>
                <mytab:PageView>
                    <br />
                    <emp:designation id="emp_designation" runat="server" />
                </mytab:PageView>
                <mytab:PageView>
                    <br />
                    <emp:costcenter id="emp_costcenter" runat="server" />
                </mytab:PageView>
            </mytab:MultiPage>
        </center>
    </form>
</body>
</html>


2:---
EmployeeGeneral.ascx :

<%@ Control Language="C#" autoeventwireup="true" codebehind="EmployeeGeneralCodeBehind.cs" Inherits="AppNew.EmployeeGeneralCodeBehind" %>
<script runat="server">

    // Insert user control code here
    //

</script>
<!-- Insert content here -->
<table id="general" style="WIDTH: 700px; HEIGHT: 54px" cellspacing="1" cellpadding="3" rules="none" border="1">
    <tbody>
        <tr>
            <td width="13%">
                <font color="darkblue"><b>Employee Id</b> </font></td>
            <td width="10%">
                <asp:textbox id="General_TxtEmpIdSearch" runat="server" name="General_TxtEmpIdSearch" size="14" maxlength="6"></asp:textbox>
            </td>
            <td>
                <input language="javascript" id="General_CmdEmpidLookup" style="BACKGROUND-IMAGE: url(img/find.gif); WIDTH: 25px; HEIGHT: 25px" onclick="return CmdEmpidLookup_onclick()" type="button" name="General_CmdEmpidLookup" />
            </td>
            <td align="right">
                <input language="javascript" id="General_cmdAdd" style="WIDTH: 84px; HEIGHT: 25px" onclick="return cmdAdd_onclick()" type="button" value="Add  " name="General_cmdAdd"  />
                <input language="javascript" id="General_cmdMod" style="WIDTH: 84px; HEIGHT: 25px" onclick="return cmdMod_onclick()" type="button" value="Modify" name="General_cmdMod"  />
                <input id="General_cmdDelete" style="WIDTH: 84px; HEIGHT: 25px" onclick="General_cmdDelete_click" type="button" value="Delete "  runat="server"  />
                <asp:button id="General_cmdView" onclick="General_cmdView_click" type="button" style="WIDTH: 84px; HEIGHT: 25px" value="Details"  runat="server"  />
            </td>
        </tr>
    </tbody>
</table>
<!-- Data Table Begins here. Begin FONT as Tahoma which will end when table ends-->
<table style="WIDTH: 700px; HEIGHT: 200px" cellspacing="1" cellpadding="3" rules="none" border="1">
    <tbody>
        <tr>
            <td width="13%">
                Employee Id
            </td>
            <td>
                <asp:Textbox id="General_TxtEmpId" runat="server" name="General_TxtEmpId" size="14" type="text"></asp:Textbox>
            </td>
            <td>
                Alternate Id
            </td>
            <td>
                <asp:Textbox id="General_TxtAlternateId" runat="server" name="General_TxtAlternateId" size="25" maxlength="10" type="text"></asp:Textbox>
            </td>
        </tr>
        <tr>
            <td>
                First Name
            </td>
            <td>
                <asp:Textbox id="General_TxtName" runat="server" name="General_TxtName" size="25" maxlength="75"></asp:Textbox>
            </td>
            <td>
                Last Name
            </td>
            <td>
                <asp:Textbox id="General_TxtLName" runat="server" name="General_TxtLName" size="25" maxlength="25"></asp:Textbox>
            </td>
        </tr>
        <tr>
            <td>
                Date of birth &nbsp;
            </td>
            <td height="10">
                <input onkeypress="return TxtDobday_onkeypress()" id="General_TxtDobday" maxlength="2" size="2" name="General_TxtDobday" />
                <input onkeypress="return Txtdobmonth_onkeypress()" id="General_Txtdobmonth" maxlength="2" size="2" name="General_Txtdobmonth" />
                <input onkeypress="return Txtdobyear_onkeypress()" id="General_Txtdobyear" maxlength="4" size="4" name="General_Txtdobyear" />
            </td>
            <td>
                Marital Status
            </td>
            <td>
                <asp:DropDownList id="General_cmbStatus" runat="server" name="General_cmbStatus" size="1" AutoPostBack="false"></asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                Sex
            </td>
            <td>
                <input id="General_radio1" type="radio" value="Male" name="General_optSex" />&nbsp;
                Male &nbsp;&nbsp;
                <input id="General_radio2" type="radio" value="Female" name="General_optSex" />&nbsp;
                Female
            </td>
            <td>
                Confirmed On
            </td>
            <td>
                <input onkeypress="return TxtConformationday_onkeypress()" id="General_TxtConformationday" maxlength="2" size="2" name="General_TxtConformationday" />
                <input onkeypress="return TxtConformationmonth_onkeypress()" id="General_TxtConformationmonth" maxlength="2" size="2" name="General_TxtConformationmonth" />
                <input onkeypress="return TxtConformationyear_onkeypress()" id="General_TxtConformationyear" maxlength="4" size="4" name="General_TxtConformationyear" />
            </td>
        </tr>
        <tr>
            <td>
                Email Id
            </td>
            <td>
                <asp:Textbox id="TextBox1" runat="server" name="General_txtEmailId" size="25" maxlength="35"></asp:Textbox>
            </td>
            <td>
                Alternate Email Id
            </td>
            <td>
                <asp:Textbox id="TextBox2" runat="server" name="General_txtAltEmailId" size="25" maxlength="35"></asp:Textbox>
            </td>
        </tr>
        <tr>
            <td>
                Qualification
            </td>
            <td>
                <asp:DropDownList id="General_CmbQualifications" runat="server" name="General_CmbQualifications" size="1" AutoPostBack="false"></asp:DropDownList>
            </td>
            <td>
                Additional Qualification
            </td>
            <td>
                <asp:Textbox id="General_TxtAdditionalQual" runat="server" name="General_TxtAdditionalQual" size="25" maxlength="50"></asp:Textbox>
            </td>
        </tr>
        <tr>
            <td>
                Religion
            </td>
            <td>
                <asp:DropDownList id="General_txtReligion" runat="server" name="General_txtReligion" size="1" AutoPostBack="false"></asp:DropDownList>
            </td>
            <td>
                Nationality
            </td>
            <td>
                <asp:DropDownList id="General_txtNationality" runat="server" name="General_txtNationality" size="1" AutoPostBack="false"></asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                Bank Name
            </td>
            <td>
                <asp:DropDownList id="General_cmbBankname" WIDTH="260px" runat="server" name="General_cmbBankname" AutoPostBack="false"></asp:DropDownList>
            </td>
            <td>
                Bank Account No.
            </td>
            <td>
                <asp:Textbox id="General_txtBankAccountno" runat="server" name="General_txtBankAccountno" size="25" maxlength="20"></asp:Textbox>
            </td>
        </tr>
        <tr>
            <td>
                HRMS ID
            </td>
            <td>
                <input onkeypress="return NumericCheck(FrmEmpmaster.txtHRMSID,event.keyCode)" id="General_txtHRMSID" maxlength="6" size="25" name="General_txtHRMSID" />
            </td>
        </tr>
        <tr>
            <td colspan="4">
                &nbsp;
            </td>
        </tr>
    </tbody>
</table>
<!-- Data Table ends here -->
<table style="WIDTH: 700px; HEIGHT: 54px" cellspacing="1" cellpadding="1" rules="none" border="1">
    <tbody>
        <tr>
            <td align="middle">
                <input id="General_cmdSave" style="WIDTH: 84px; HEIGHT: 25px" onclick="General_cmdSave_click" type="button" value="Save" name="General_cmdSave" runat="server" />
                <input id="General_cmdCancel" style="WIDTH: 84px; HEIGHT: 25px" onclick="General_cmdCancel_click" type="button" value="Cancel" name="General_cmdCancel" runat="server" />
                <input id="General_cmdBack" style="WIDTH: 84px; HEIGHT: 25px" onclick="General_cmdBack_click" type="button" value="Back" name="General_cmdBack" runat="server" />
            </td>
        </tr>
    </tbody>
</table>

3:---

EmployeeGeneralCodeBehind.cs :-

// EmployeeGeneralCodeBehind.cs
//

namespace AppNew {
    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls ;
    using System.Web.SessionState;
    using System.Data;

    using AppsComponent ;

    /// <summary>
    /// Summary description for EmployeeGeneralCodeBehind.
    /// </summary>
    public class EmployeeGeneralCodeBehind : UserControl {

        /// Declaration Section.

        private EmployeeGeneral general ;

        // Html Buttons.
        protected HtmlInputButton General_cmdDelete,General_cmdSave,General_cmdCancel,General_cmdBack ;
        protected Button General_cmdView ;

        // asp Deop Down Lists.
        protected DropDownList General_cmbBankname,General_cmbStatus,General_CmbQualifications,General_txtReligion,General_txtNationality ;

        // asp text boxes
        protected TextBox General_TxtEmpIdSearch,General_TxtEmpId,General_TxtAlternateId,General_TxtName,General_TxtLName;
        protected TextBox General_txtEmailId,General_txtAltEmailId,General_TxtAdditionalQual,General_txtBankAccountno ;

        protected string ERROR_MESSAGE = "" ;
        //protected string General_TxtDobday,General_Txtdobmonth,General_Txtdobyear,General_optSex,General_optSex,
        //General_TxtConformationday,General_TxtConformationmonth,General_TxtConformationyear
        //,General_TxtAdditionalQual,General_txtReligion,General_txtNationality,General_txtHRMSID


        public EmployeeGeneralCodeBehind() { }

        protected void Page_Load(Object sender,EventArgs e)
        {
            general = new EmployeeGeneral() ;
            if(!IsPostBack)
            {
                AssignValuesToDrop() ;
            }

        }

        private void AssignValuesToDrop() {

            string[] General_cmbStatus_text = {"Married","Unmarried","Widow","Divorcee","Separated","Single"} ;
            string[] General_CmbQualifications_text = {"Under Graduate","Graduate","Post Graduate"} ;
            string[] General_txtReligion_text = {"HINDU","CHRISTIAN","MUSLIM","SIKH","OTHERS"} ;
            string[] General_txtNationality_text = {"INDIAN","OTHERS"} ;

            // fill the data into all drop down lists.
            General_cmbStatus.DataSource = General_cmbStatus_text ;
            General_cmbStatus.DataBind() ;

            General_CmbQualifications.DataSource = General_CmbQualifications_text ;
            General_CmbQualifications.DataBind() ;

            General_txtReligion.DataSource = General_txtReligion_text ;
            General_txtReligion.DataBind() ;

            General_txtNationality.DataSource = General_txtNationality_text ;
            General_txtNationality.DataBind() ;

            string ctuuser = Session["CTUUSER"].ToString() ;

            DataSet ds = general.GetBanks(ctuuser);
            General_cmbBankname.DataSource = ds.Tables[0];
            General_cmbBankname.DataTextField = "BANKNAME";
            General_cmbBankname.DataValueField = "BANKID";
            General_cmbBankname.DataBind() ;
        }

        protected void General_cmdView_click(object sender,EventArgs e) {
            string empid = General_TxtEmpIdSearch.Text ;
            string domain = Session["DOMAIN"].ToString();
            DataSet empDataSet = general.GetSelfData(domain,empid) ;

            if(empDataSet != null && empDataSet.Tables[0].Rows.Count > 1) {

            }else {
                ERROR_MESSAGE = "Employee Id <FONT COLOR=RED>" + empid + "</FONT> Does not Exists or He does not belongs to <FONT COLOR=RED>" + Session["UNITNAME"].ToString() + "</FONT>" ;
            }
            empDataSet.Dispose() ;
        }

        private void DisplayValues(DataSet ds) {

            // SET VELUES TO TEXTFIELDS
            General_TxtEmpId.Text = ds.Tables[0].Rows[0]["ID"].ToString();
            General_TxtAlternateId.Text = ds.Tables[0].Rows[0]["ALTID"].ToString();
            General_TxtName.Text = ds.Tables[0].Rows[0]["FNAME"].ToString();
            try {
                General_TxtLName.Text = ds.Tables[0].Rows[0]["LNAME"].ToString();
            }catch(Exception ) {
                General_TxtLName.Text = "" ;
            }
            General_txtEmailId.Text = ds.Tables[0].Rows[0]["EMAILID"].ToString();
            try {
                General_txtAltEmailId.Text = ds.Tables[0].Rows[0]["ALTMAILID"].ToString();
            }catch(Exception ) {
                General_txtAltEmailId.Text = "" ;
            }
            try {
                General_TxtAdditionalQual.Text = ds.Tables[0].Rows[0]["AQUALFN"].ToString();
            }catch(Exception ) {
                General_TxtAdditionalQual.Text = "" ;
            }
            General_txtBankAccountno.Text = ds.Tables[0].Rows[0]["ACCOUNT"].ToString();

            // SET VALUES TO DROP DOWN LIST
            try {
                General_cmbStatus.SelectedValue = ds.Tables[0].Rows[0]["MARSTAT"].ToString();
            }catch(Exception ) {
                General_cmbStatus.SelectedValue = "Single" ;
            }
            try {
                General_CmbQualifications.SelectedValue = ds.Tables[0].Rows[0]["QUALFN"].ToString();
            }catch(Exception ) {
                General_CmbQualifications.SelectedValue = "Graduate" ;
            }

            General_txtReligion.SelectedValue = ds.Tables[0].Rows[0]["RELIGION"].ToString();
            General_cmbBankname.SelectedValue = ds.Tables[0].Rows[0]["BANKID"].ToString();


            General_txtNationality.SelectedValue =  ds.Tables[0].Rows[0]["NATIONALITY"].ToString();

      /*      m_birthdate=RstEmployeeRecset.Fields("BIRTHDATE").Value
            If ISNULL(RstEmployeeRecset.Fields("JOINDATE").Value) Then
                  m_JoinedDate=""
                  m_JoinedDay=""
                  m_JoinedMon=""
                  m_JoinedYR=""
            Else
                  m_JoinedDate=RstEmployeeRecset.Fields("JOINDATE").Value
                  m_JoinedDay=formatDates(m_JoinedDate,"DD")
                  m_JoinedMon=formatDates(m_JoinedDate,"MN")
                  m_JoinedYR=formatDates(m_JoinedDate,"YR")
            End If
            If UCASE(TRIM(m_sex))="M" and UCASE(TRIM(m_sex))<> "" then
                  m_malechecked="CHECKED"
            Else
                  m_malechecked=""
            End If
            If UCASE(TRIM(m_sex))="F" and UCASE(TRIM(m_sex))<> "" then
                  m_Femalechecked="CHECKED"
            Else
                  m_Femalechecked=""
            End If */

            //m_address=RstEmployeeRecset.Fields("ADDRESS").Value
            //m_city=RstEmployeeRecset.Fields("CITY").Value
            //m_state=RstEmployeeRecset.Fields("STATE").Value
            //m_phone=RstEmployeeRecset.Fields("PHONE").Value
            //m_pin=RstEmployeeRecset.Fields("PINCODE").Value


            //n_HRMSID = RstEmployeeRecset.Fields("HRMSID").Value

        }

        protected void General_cmdDelete_click(object sender,EventArgs e) {
        }

        protected void General_cmdSave_click(object sender,EventArgs e) {
        }

        protected void General_cmdCancel_click(object sender,EventArgs e) {
        }

        protected void General_cmdBack_click(object sender,EventArgs e) {
        }
    }
}

0
Comment
Question by:naidu_ramesh
3 Comments
 
LVL 7

Accepted Solution

by:
vnvk earned 50 total points
ID: 11994388
a search in google

http://www.google.com/search?sourceid=navclient&gfns=1&ie=UTF-8&q=HttpException+80004005

coming to your code, try to add the code for handles clause for every button and it should work.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now