Click here to Skip to main content
16,007,885 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

Lets say you have the following DB tables:

DB Tables:
tblCompany (Id, Name)
tblDepartment (Id, CompanyId, Name)
tblEmployee (Id, DepartmentId, FirstName, LastName)


Now, lets say you have a ASP form to add an employee:

ASP Form
Company: [DropDownListCompany]
Department: [DropDownListDepartment] (Enabled = False)
Employee Name: [TextBoxEmployeeName] (Enabled = False)

Now, the user must first select the Company, which then allows the fetching of the departments within that specific company and enables the Department dropdownlist.

After the user selects the department, then the textboxes enables.

So the problem is this: The user must select a company, and only then can the application fetch the appropriate departments.

I have found a solution - but it generates a lost of PostBack events. Is there another way?

Thanks in advance
Jeann
Posted
Comments
Ajay_Saini 13-Oct-13 7:32am    
can you provide the exact error message?
J van Rooyen 13-Oct-13 8:05am    
It's not an error - rather a design concept. I'll get you some code to work with...

You can use update panel in your form for avoiding full post back of your form(even though it postbacks end user won't be able to know) or you can use Ajax Script for populating drop downs based on your conditions.
 
Share this answer
 
v2
Hi Madhu,

Update panel works great! And I've found the ViewState to work wonders as well for variables and non-control stuff that doesn't go on update panels!

I'm from Silverlight, Windows Forms and WPF background - and fairly new to ASP.Net and JavaScript, etc. but I'm finding it more easy as I go along.

Regards,

Jeann
 
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