Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello Friends,

am working on asp.net, i have two pages in my project.

first page is login page
second page is retrieve data from database based on login dropdown selection.

In first page(Login Page) I have Dropdownlist(departmentList) and Textbox(password)
and a login button.

User will select the department from dropdown and then next he enters the password, and clicks on login button.
When User clicks on login button, In second page I have 3 textboxes to retrieve data from database according to dropdownlist.

In database I have Stored data with in these fields,

Dept_code,Password,Salary,TelephoneNo,ManagerName.(TableName DeptInfo)

Dept_code - IT (This will display in dropdownlist(loginPage) )
Password - This is used for login
Salary - this should display in textbox after login( it must retrieve from DB)
Telephone - this should also display in textbox after login ( it must retrieve from DB)
Manager Name - this should also display in textbox after login ( it must retrieve from DB)


Please can you help me , how to solve this.

already i have completed login page , and now am in second page with textboxes.

Please help.

THANKS.
Posted
Comments
[no name] 28-Apr-13 7:23am    
"how to solve this"... the exact same way the you have already been told.

1 solution

you can do the following:

on First Page(Login) :

you need to put your dropdown selectedValue in session to move it to the next page.

after successfull login: On second page you first need to get that values from session. and Then you the following...
XML
<pre lang="cs">
string sessValue = Conver.ToString(Session["youSessionName"]);
youConectionName.Open();
SqlCommand cmd = new SqlCommand("Select * from DeptInfo where DeptCode='" + sessValue + "'", youConectionName);

SqlDataReader dr = cmd.ExecuteReader();
        if (dr.HasRows)
        {
            Salary.Text  = rd["Salary"].ToString();
            Telephone.Text =rd["TelephoneNo"].ToString();
            Manager Name.Text=rd["ManagerName"].ToString();
        }
        else
        {
            //Code will reach here if no records found.
        }
</pre>



you can call this on page load or on button click as you want...

This will definately help you....
 
Share this answer
 

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