Click here to Skip to main content
13,050,840 members (72,976 online)
Rate this:
Please Sign up or sign in to vote.
Hello Friends,

am working on, 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.

Posted 27-Apr-13 23:52pm
ThePhantomUpvoter 28-Apr-13 7:23am
"how to solve this"... the exact same way the you have already been told.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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...
<pre lang="cs">
string sessValue = Conver.ToString(Session["youSessionName"]);
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();
            //Code will reach here if no records found.

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

This will definately help you....

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 28 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100