Hi
below is my table in database
Id
City
Region
1
Paris
2
3
4
Italy
5
I define 2 DropDownList 1-DDLCirty 2- DDlRegion in show.aspx page and I define that when page is loading it just bind DDLcity I mean in DDLCIty shows (Paris and Italy) but in DDLregion doesn't show any thing and when users select Item from DDLcity according to their selected Item from DDLcity it bind DDLRegion i.e if they select Paris in DDlregion shows (1-2-3) and if they select Italy it shows(1-2)
now I want when page is loading in default in DDLcity shows Paris and In DDLregion Shows (1-2-3)
How I can do it?
Best Regards
Neda
Hi neda its because the ddlCity is just bound, but no item is selected, and you are accessing the selected Item,
To resolve this error you needs to select any item by code
ddl1.Items[1].Selected = true;
Thanks and Regards,
Rk_Hirpara
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.