I have an ASP.NET webform that has a databound dropdownlist that is used to populate a SQL Server based detailsview control.The detailsview (dv1) updates as expected when I change the dropdown box value. I also have a second detailsview (dv2) that I would like to hide when the status field in dv1 is a 1. The problem I am having is that the update to dv2 doesn't happen until I change the dropdown field a second time.

Here's the timeline: Open the page, dv1 displays. Its status is 2 so dv2 displays. Change the dropdown to item 2 (which has a status of 1). dv1 updates, dv2 does not. Change the dropdown to item 3 (which has a status of 2). dv1 updates, dv2 now is hidden (since item 2 had a status of 1).

The code behind that I am using on the dropdownlist is:

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
        if (Convert.ToInt32(DetailsView1.Rows[3].Cells[1].Text) == 1)
        {
            DetailsView2.Visible = false;
        }
        else
        {
            DetailsView2.Visible = true;
        }
    }

Does anyone have any ideas on how I can get dv2 to update based on a cell in dv1 at the same time that dv1 updates?

Thanks,

Les Z

Related posts

Recent Viewed