0

This is my asp code

<tr class="footer" runat="server">
    <td colspan="4" runat="server">* By WWW.Play.org
       <asp:DropDownList AutoPostBack="true" runat="server" ID="callDispositionSelector" OnSelectedIndexChanged="callDispositionChanged">
           <asp:ListItem Value="-1">Select Disposition Reason</asp:ListItem>
           <asp:ListItem Value="1">Reservation</asp:ListItem>
           <asp:ListItem Value="2">Change of Reservation</asp:ListItem>
           <asp:ListItem Value="3">Cancellation</asp:ListItem>
           <asp:ListItem Value="4">Wait List</asp:ListItem>
           <asp:ListItem Value="5">Other</asp:ListItem>
       </asp:DropDownList>
    </td>
</tr>

In code behind, I am not able to type this callDispositionSelector. In other words, visual studio doesn't recognize that id.

I tried clean, rebuild, restart visual stuidio but nothing helps.

I tried change the id to another name but still not recognizable.

I tried deleing the designer , and then regenerate it but still the same problem

i tried restart the windows but still the same problem

Note

this controller exist in Item Template in asp.ListView

Satpal
  • 132,252
  • 13
  • 159
  • 168
Marco Dinatsoli
  • 10,322
  • 37
  • 139
  • 253
  • Have you visited http://stackoverflow.com/questions/9208528/how-to-find-control-in-itemtemplate-of-the-listview-from-code-behind-of-the-user? or see http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview.itemdatabound.aspx – Satpal Mar 29 '14 at 07:26

1 Answers1

0

Find your dropdownlist control in listview's itemdatabound event like below

protected void lst_ItemDataBound(object sender, ListViewItemEventArgs e)
 {
       if (e.Item.ItemType == ListViewItemType.DataItem)
        {
            DropDownList ddl= (DropDownList)e.Item.FindControl("callDispositionSelector");
        }
 }
RGS
  • 5,131
  • 6
  • 37
  • 65