Click here to Skip to main content
15,918,303 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi to all

I am developing an intranet portal. i am using ajax pop up extender to make Login page on panel.

I am developing login page (some other pages also) under another project.
now i am copying login panel from another project to intranet portal master page.

on intranet portal master page login controls are shown on master page design as well as cs file.

but on that control a blue line(error line) shown as TextBox1 does not exit in current context.

SqlCommand cmd = new SqlCommand();
        cmd.CommandText = "hod_login";
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Connection = Db.GetConnection();
        cmd.Parameters.AddWithValue("@LoginID", TextBox1.Text);
        cmd.Parameters.AddWithValue("@Password", TextBox2.Text);
        cmd.Parameters.AddWithValue("@UserType", DropDownList1.Text);
        SqlDataReader dr = cmd.ExecuteReader();
        if (dr.Read())
            if (dr[2].ToString() == "Commercial" && DropDownList1.Text == "HOD")
                Session["userid"] = TextBox1.Text;
                Session["tag"] = DropDownList1.Text;
                Session["deptt"] = "Commercial";
                //ViewState["deptt"] = "Commercial";
            Response.Write("Invalid User");

bold controls are showing errors
What is the problem,i can not understatndinhg.
please help me.
Updated 11-Aug-11 0:16am

This happens sometimes, when you copy the the aspx contents and paste it on some other page. Open the designer.cs file of the web page and make sure that there is an entry for TextBox1, TextBox2 and DropDownList1. It may be missing there even if it there in .aspx page. If designer.cs is missing the entry for these controls then do it manually as

Protected global :: TextBox TextBox1 and so on.

This should solve your problem.
Also check whether your aspx page is referring to the same .cs file that you are working in. You can check it in the first line of .aspx page (Code Behind attribute).

Hope this helps.
All the best.
Share this answer
uspatel 11-Aug-11 6:53am    
where should i find designer.cs file in
The code you shared there declaration of TextBox1 is not there.
That is causing the problem.

The same will happen to TextBox2 and DropDownList1 also.
Share this answer
uspatel 11-Aug-11 6:28am    
It is an website.
i have already take the ID of these controls in aspx page.
uspatel 11-Aug-11 6:29am    
these controls are shown in suggestions in visual studio.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900