Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 14th, 2005, 02:55 PM
MasterChief22 MasterChief22 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 2 MasterChief22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 19 sec
Reputation Power: 0
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();
}
}

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Problem loading DropdownLists


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway