|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem loading DropdownLists
Hi All,
I've been trying to debug a problem but have had no luck. I have several dropdownlists on a web page. And I populate the values in the dropdownlists from the database when the page is loaded. Everything loads fine. But afterwards, if i try to repopulate the dropdownlists with new values from the database, the browser says "Page cannot be displayed". I have an event that is triggered when the index of one of the dropdownlists is changed. In the "Index_Changed" method I repopulate the dropdownlists. The "AutoPost" property of that dropdownlist is set to True. If anyone can offer any help, it would be greatly appreciated. Here's how the code looks like: public partial class OrderView : System.Web.UI.Page { private DbOracle dbAccess = new DbOracle(); protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { InitializeRangeList(); InitializeLists(); } } private void InitializeLists() { String fromDate = GetFromDate(); String toDate = GetToDate(); // Populate lists according to the selected date range } private void InitializeRangeList() { int curYear = DateTime.Today.Year; for (int i = curYear; i > 2000; i--) { String range = "" + (i - 1) + "-" + i; Range_List.Items.Add(range); } } private String GetFromDate() { String sel = Range_List.SelectedValue; String first = sel.Remove(sel.IndexOf("-")); int year = int.Parse(first); String date = "'01/01/" + year + " 12:00:00 AM', 'dd-MM-yyyy HH:MI:SS AM'"; return date; } private String GetToDate() { String sel = Range_List.SelectedValue; String second = sel.Substring(sel.IndexOf("-")+1); int year = int.Parse(second); String date = "'31/12/" + year + " 11:59:00 PM', 'dd-MM-yyyy HH:MI:SS PM'"; return date; } public void Range_List_SelectedIndexChanged(object sender, EventArgs e) { InitializeLists(); } } |
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > Problem loading DropdownLists |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|