|
-
Dropdown Box troubles
ok, here's what i've got. I have this internal phonedirectory page that i'm developing, and one of the options (to select the office) is done with a dropdown box, and when an office is selected that has sub offices, a second dropdown box's visibility is set to true so that you can select from that DDB to. Now, i'm querying all the data for the second dropdown box from a SQL database (i'm probably going to convert the first drop down to be pulled from a db soon) but the problem comes when i do a submit on the form. All the data stays, but the second ddb resets the select to the defualt (top) item. The second drop down box initially has no items and the script that adds data to the box is as follows
.
.
.
if(OfficeInput.SelectedValue.Equals("")
{
.
.
.
}
else
{
.
.
OfficeInputSecond.Items.Clear();
phoneConn.Open();
SqlDataReader read = phoneComm.ExecuteReader();
while(read.Read())
{
if(read[0].ToString().Equals(OfficeInput.SelectedValue))
{
if(OfficeInputSecond.Items.Count>0)
{
OfficeInputSecond.Items.Add(read[1].ToString());
}
else
{
OfficeInputSecond.Items.Add("");
OfficeInputSecond.Items.Add(read[1].ToString());
}
}
}
phoneConn.Close();
.
.
}
So, is it a postback issue? or how can i force the drop down to not change on submit?
thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks