---
title: "dropdownlist selected value"  
description: "dropdownlist selected value"  
author: "Jayden Bell"  
published: 2014-08-28  
updated: 2014-08-28  
canonical: https://www.mindstick.com/forum/2193/dropdownlist-selected-value  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 2 minutes  

---

# dropdownlist selected value

I have [asp.net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder) page [dropdownlist](https://www.mindstick.com/articles/324837/how-to-bind-dropdownlist-in-mvc-core-from-database-using-entity-framework) and button when choose my group from dropdownlist and [click button](https://www.mindstick.com/forum/34274/how-to-pass-combobox-value-from-windows-form-edirrow-to-windows-form-form1-where-click-button) then button send [selected value](https://www.mindstick.com/forum/525/get-selected-value-of-datagridviewcomboboxcolumn) via [query string](https://www.mindstick.com/articles/512/query-string-in-asp-dot-net) then page view group detail based on id in query string this happens the first time but when I change group from dropdownlist the query string still has the last id and my code

```
protected void Page_Load(object sender, EventArgs e){    if (!IsPostBack) FillList();    if (Request.QueryString["id"] != null)    {        FillData();        div_General.Visible = true;        div_Special.Visible = true;        dropdownlist1 .SelectedValue = Request.QueryString["id"];    }}protected void button1_Click(object sender, EventArgs e){    if (dropdownlist1 .SelectedIndex == 0)    {        par_ErrorMessage.InnerText = "choose group first  ...";        par_ErrorMessage.Visible = true;    }    else Response.Redirect("Authority.aspx?id=" + dropdownlist1.SelectedValue);}
```

I figured the [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) in this when I click button and suppose that new value in dropdownlist [page life cycle](https://www.mindstick.com/interview/136/page-life-cycle-in-asp-dot-net) go to [page load](https://www.mindstick.com/articles/12909/how-to-open-first-time-popup-on-page-load-in-website) first and in this code

dropdownlist1 .SelectedValue = Request.QueryString["id"];

Return selected value to the last one before read it from button1_click

my FillList Method

```
 private void FillList(){    oGroup = new Cls_Groups();    cmb_Group.DataSource = oGroup.LoadGroups();    cmb_Group.DataBind();    cmb_Group.Items.Insert(0, "-- اختر مما يلي --");}
```

## Replies

### Reply by Sumit Kesarwani

Hi jayden,

```
if (!IsPostBack) FillList();    if(Request.QueryString["id"] != null)    {        FillData();       
div_General.Visible = true;       
div_Special.Visible = true;         FillList();        dropdownlist1.SelectedValue = Request.QueryString["id"];    }
```


---

Original Source: https://www.mindstick.com/forum/2193/dropdownlist-selected-value

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
