Bonjour
Voilà en quoi consiste mon problème :
J'ai un gridView. Quand j'édite mon gridView, j'ai 2 controles dropDownList. Quand je change d'index sur la première, l'autre devrait prendre les nouvelles valeurs.
Voilà comment je procède :
<!-- Ici, je défini ma 1ère dropDownList avec comme choix act ou cnd -->
<
asp:TemplateFieldHeaderText="Type"SortExpression="Type">
<EditItemTemplate>
<asp:DropDownListID="CmdType"runat="server"AutoPostBack="True"AppendDataBoundItems="true"selectedValue='<%# Bind("Type") %>'>
<asp:ListItem>act</asp:ListItem>
<asp:ListItem>cnd</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
...
</asp:TemplateField>
<!-- Ici, je défini ma 2ème dropDownList qui prend les valeurs en fonction du paramètre défini dans la SqlDataSource, a savoir la dropDownList définie juste ci-dessus-->
<asp:TemplateFieldHeaderText="Command Name"SortExpression="CommandName">
<EditItemTemplate>
<asp:DropDownListAutoPostBack="True"ID="editDropDownCommand"runat="server"DataSourceID="SqlDataGetCommand"
DataTextField="commandName"DataValueField="idCommand"selectedValue='<%# Bind("idCommand") %>'>
</asp:DropDownList>
<!-- Datasource qui contient une procédure Stockée comme "select command" -->
<asp:SqlDataSourceID="SqlDataGetCommand"runat="server"ConnectionString="<%$ ConnectionStrings:AAAConnectionStr %>"
ProviderName="<%$ ConnectionStrings:AAAConnectionStr.ProviderName %>"SelectCommand="AAA_getCommand;1" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameterControlID="cmdType"Name="type"PropertyName="SelectedValue"Type="String"/>
</SelectParameters>
</asp:SqlDataSource>
</EditItemTemplate>Or, quand j'execute cette source, j'obtient l'erreur suivante :
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound controlEt je dois avouer que je ne comprend pas bien ou se situe le problème.
En tout les cas, je vous remercie d'avance pour votre aide.
Bonne journée de programmation

ElpenS
