title: SelectedValue of a dropdown (UserControl) is not getting selected inside a GridView in asp.net
body: <p>I've created an Usercontrol (drop down) and used it inside the EditTemplate of a GridView.</p>
  
  <pre><code>&lt;EditItemTemplate&gt;
      &lt;eluc:AddrType ID="ucIssuingAuthorityEdit" runat="server" AddressType="139" AddressList='&lt;%# PhoenixRegistersAddress.ListAddress("139") %&gt;'
       AppendDataBoundItems="true" CssClass="dropdown_mandatory" SelectedAddress='&lt;%# DataBinder.Eval(Container,"DataItem.FLDISSUINGAUTHORITY") %&gt;' /&gt;
   &lt;/EditItemTemplate&gt;
  </code></pre>
  
  <p>SelectedAddress is the property which will set the SelectedValue of the dropdown. If I use the same usercontrol inside the normal aspx page it is getting selected. But inside the GridView is not getting Selected.</p>
  
  <p>The code in usercontrol for selection is:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      if (!IsPostBack)
      {
          ddlAddressType.DataSource = PhoenixRegistersAddress.ListAddress(addresstype);
          ddlAddressType.DataBind();
  
          foreach (ListItem item in ddlAddressType.Items)
          {
              if (item.Value == _selectedValue.ToString())
              {
                  item.Selected = true;
                  break;
              }   
          }           
  
      }
  }
  </code></pre>
  
  <p>Here the property SelectedAddress</p>
  
  <pre><code>public string SelectedAddress
  {
      get
      {
          return ddlAddressType.SelectedValue;
      }
      set
      {
          if (value.Trim().Equals(""))
              return;
          _selectedValue = Int32.Parse(value);
          foreach (ListItem item in ddlAddressType.Items)
          {
              if (item.Value == _selectedValue.ToString())
              {
                  item.Selected = true;
                  break;
              }
          }           
  
      }
  }
  </code></pre>
  
  <p>Can any one suggest me why it is being so.</p>
  
  <p>Thanks in advance..</p>