actualiser checkboxlist à partir d'une dropdownlist
bonjour
bonjour,
dans une page ou j'enregistre une nouvelle intervention je doit avoir une liste deroulante me permettant d'avoir les localisations,
aprés avoir selectionné ma localisation exemple "exterieur" je doit avoir une checklistbox m'affichant uniquement les secteurs concerné par la localisation
exemple je selectionne dans ma liste deroulante la localisation extérieur,
ma checkboxlist affichera 2 checkbox,"parking, parking poid lourd" par contre si je selectionne la localisation intérieur,
ma checkboxlist affichera 4 valeur, "hall, acceuil, production, vestiare"
j'aimerai savoir comment faire pour réaliser la jointure entre ma liste deroulante et la checkboxlist pour que les données soit justes.
avant de poser la question j'ai essayé de la resoudre seul, voici le resultat j'ai une dropdownlist relié a un sqldatasourcelocalisation,
j'ai une chekboxlist qui elle aussi est relié a un sqldatasource
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
<asp:DetailsView ID="DetailsView1" runat="server" Height="28px" Width="150px"
AutoGenerateRows="False" DataKeyNames="IdLocalisation"
DataSourceID="SqlDataSourceLocalisation">
<Fields>
<asp:TemplateField
HeaderText="Localisation"
SortExpression="Localisation">
<InsertItemTemplate>
<asp:TextBox
ID="IdLocalisationTextBox"
runat="server"
Text='<%# Bind("idLocalisation") %>'
Visible="false" />
<asp:DropDownList
ID="DropDownListLocalisation"
runat="server"
AppendDataBoundItems="true"
AutoPostBack="true"
DataSourceID="SqlDataSourceLocalisation"
DataTextField="NomLocalisation"
DataValueField="idLocalisation"
OnSelectedIndexChanged="DropDownListLocalisation_SelectedIndexChanged"
Width="98%">
<asp:ListItem>
</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator1"
runat="server"
ControlToValidate="DropDownListLocalisation"
Display="Dynamic"
ErrorMessage="Champ obligatoire" />
</InsertItemTemplate>
<HeaderStyle
Width="180px" />
<ItemTemplate>
<asp:Label
ID="Label4"
runat="server"
Text='<%# Bind("NomLocalisation") %>' />
<asp:Label
ID="LabelIdLocalisation"
runat="server"
Text='<%# Bind("idLocalisation") %>'
Visible="false" />
</ItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
<asp:CheckBoxList ID="CheckBoxList1" runat="server"
DataSourceID="SqlDataSourceChekBox" DataTextField="NomSecteur"
DataValueField="IdSecteur">
</asp:CheckBoxList>
<asp:SqlDataSource ID="SqlDataSourceLocalisation" runat="server"
ConnectionString="<%$ ConnectionStrings:PDP %>"
SelectCommand="SELECT [IdLocalisation], [NomLocalisation] FROM [Localisation] ORDER BY [NomLocalisation]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSourceChekBox" runat="server"
ConnectionString="<%$ ConnectionStrings:PDP %>"
SelectCommand="select Secteur.IdSecteur,Secteur.NomSecteur From Secteur INNER JOIN InterPDP on InterPDP.IdSecteur = Secteur.IdSecteur where IdLocalisation = @IdLocalisation"
</asp:SqlDataSource> |
merci pour votre aide,
cordialement