I have an asp.net dropdown like this
<asp:DropDownList width="95%" ID="RessourceComposantes" runat="server"
DataSourceID="Composantes"
DataTextField="Description" DataValueField="ComposanteID">
</asp:DropDownList>
<asp:SqlDataSource ID="RessourceComposantes" runat="server"
ConnectionString="<%$ ConnectionStrings:OraEntities %>"
SelectCommand="SELECT [Blabla], [blablabla] FROM [blablablaa]
ORDER BY [blablablabla]">
</asp:SqlDataSource>
Is it normal that when I do dd_ressource_composante.selectedvalue on the server side I have no value. It’s always “”.
the source looks like this :
<select name="ctl00$Tab$dd_ressource_composante" id="ctl00_Tab_dd_ressource_composante" style="width:95%;">
<option value="1">Composante</option>
<option value="3">DGAG</option>
<option value="2">DSF</option>
<option value="5">Test</option>
<option value="6">Tous</option>
<option value="4">VMD</option>
</select>
I just tried to fill my dropdown in vb.net and I have the same result. The dropdown is full but when I do a postback I have no selected value
Actualy on the server side when I put a breakpoint on the dropdown, the item count is 0. I don’t understand why… It’s like the 8th dropdown list in this project and everything is the same but this one doesn’t work.
I don’t do any binding on the page load. it’s all in the aspx file
well it works ONLY when I add autopostback=”true” SelectedIndexChanged=”dd_ressource_composante_SelectedIndexChanged” for the dropdown.
And theres no code in dd_ressource_composante_SelectedIndexChanged
It’s vb.net for the server side
Thank you
Well that’s weird. That control was in a table and I added a row like this
and I changed it for
I don’t understand quite well why it was a problem but it works now.
Thank you everyone!