TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bineesh Viswanath
NA
1k
780.2k
Fill ComboBox only when other comboBox is filled in ADO.NET
Nov 14 2013 12:43 AM
Sir, I need your help.
I have three comboBoxes - cmbCountry, cmbState and cmbDistrict.
I called cmbCountry filling in Form_Load and sets its Index to zero.
I called cmbState comboBox fill in SelectedValueChanged event of cmbCountry. Its index sets to -1.
The core area of my problem is from here.
Currently, cmbDistrict comboBox is invisible. Only when I select a state, I want to fill and visible the cmbDistrict .
Here my code:-
private void cmbCountry_SelectedValueChanged(object sender, EventArgs e)
{
try
{
if (cmbCountry.SelectedIndex > -1 && cmbCountry.SelectedValue.ToString() != "System.Data.DataRowView")
{
StateComboFill();
}
}
catch (Exception)
{
throw;
}
}
private void cmbState_SelectedValueChanged(object sender, EventArgs e)
{
try
{
if (cmbState.SelectedIndex>-1 && cmbState.Text != "System.Data.DataRowView")
{
lblDistrict.Visible = true;
cmbDistrict.Visible = true;
FillDistrict();
}
}
catch (Exception)
{
throw;
}
}
private void cmbDistrict._SelectedValueChanged(object sender, EventArgs e)
{
try
{
if (cmbDistrict..SelectedValue.ToString() != null && cmbDistrict..SelectedValue.ToString() != "System.Data.DataRowView" &&cmbDistrict.SelectedIndex != -1)
{
FillGridCorrespondingToDistrict();
}
}
}
}
catch (Exception)
{
throw;
}
}
my current prblem is when i select a country, cmbDistrict combo is visible and data filled into it.
Reply
Answers (
5
)
Convert C Code into C# Code
Implementing a Multi-column dropdown list using C#, ASP.NET