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
mohan raj
NA
57
11.7k
drop down dependency for contry,state in javascript using C#
Jul 8 2013 2:42 AM
This is my javascript code
var states = new Array();
states['United States'] = new Array('Alabama', 'Alaska', 'Arizona');
states['India'] = new Array('Andhra Pradesh', 'Arunachal Pradesh', 'Assam');
var cities = new Array();
cities['United States'] = new Array();
cities['United States']['Alabama'] = new Array('Birmingham', 'Montgomery', 'Mobile', 'Huntsville');
cities['United States']['Alaska'] = new Array('Tucson', 'Anchorage');
cities['United States']['Arizona'] = new Array('Chandler', 'Phoenix', 'Mesa', 'Glendale', 'Scottsdale', 'Gilbert', 'Tempe', 'Peoria', 'Surprise');
cities['India'] = new Array();
cities['India']['Andhra Pradesh'] = new Array('Adilabad', 'Adoni', 'Amadalavalasa', 'Amalapuram', 'Ameenapuram', 'Anakapalle', 'Anantapur','Warangal', 'Yellandu', 'Yemmiganur', 'Yerraguntla', 'Zahirabad');
cities['India']['Arunachal Pradesh'] = new Array('Along', 'Bomdila', 'Itanagar*', 'Naharlagun', 'Pasighat');
cities['India']['Assam'] = new Array('Abhayapuri', 'Amguri', 'Anandnagaar', 'Barpeta', 'Barpeta Road', 'Bilasipara','Nalbari', 'North Lakhimpur', 'Rangia', 'Sibsagar', 'Silapathar', 'Silchar', 'Tezpur', 'Tinsukia');
function setStates() {
cntrySel = document.getElementById('ddlCountry');
stateList = states[cntrySel.value];
changeSelect('ddlState', stateList, stateList);
setCities();
}
function setCities() {
cntrySel = document.getElementById('ddlCountry');
stateSel = document.getElementById('ddlState');
cityList = cities[cntrySel.value][stateSel.value];
changeSelect('ddlCity', cityList, cityList);
}
function changeSelect(fieldID, newOptions, newValues) {
selectField.options.length = 0;
for (i = 0; i < newOptions.length; i++) {
selectField.options[selectField.length] = new Option(newOptions[i], newValues[i]);
}
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function () {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function () {
setStates();
});
My aspx.cs code is
user.DdlCountry = ddlCountry.Text;
and
user.DdlCountry = Request.Form["ddlCountry"];
and
user.DdlCountry = ddlCountry.SelectedItem.Text;
and
obj.Combination = ddlsubcategory.SelectedItem.Value
;
i tryed above all methode but not storing the DB
Reply
Answers (
4
)
print multiple crystal report at a time
BeginInvoke on PropertyInfo of Items property for ComboBox