У меня есть два раскрывающихся списка в подробном обзоре asp.net «PlantingHatchery» и «CatalogNames». Результаты первого определяют значения во втором. Первый отлично подходит, но не второй. Я просмотрел несколько предложений, но ни один из них не работает для меня. Где я ошибаюсь?
Вот соответствующий код:
<asp:DetailsView ID="dvSMasterCurrentYear" runat="server" AutoGenerateRows="False" align="center" DataKeyNames="SMasterid" DataSourceID="SqlDataSource1"
Height="50px" Width="437px" AutoGenerateInsertButton="True" AllowPaging="True" insertcommand =" Insert Into [SMasterCurrentYear}
([HatcheryCodePlant],[CatalogNo],[DataPlant],[TimePlant],[SpeciesCode],[BroodYear],[SizeCode],[MethodCode],[Length], [PoundFish],[NumberPlanted],[NumberPerLB],[HaulMort],
[License], [ActSites], [HatcheryCodeRear],[Comments],[H20Temp],[ConsOfficer],[TankTemp],[Marks],[Raceway])
Values (@HatcheryCodePlant, @CatalogNum, @DataPlant, @TimePlant, @SpeciesCode, @BroodYear, @SizeCode, @MethodCode, @Length, @PoundFish, @NumberPlanted, @NumberPerLB,
@HaulMort, @License, @ActSites, @HatcheryCodeRear, @Comments, @H20Temp, @ConsOfficer, @TankTemp, @Marks, @Raceway) " Font-Bold="True" BackColor="#FFCC99" Font-Size="Medium" DefaultMode="Insert">
<AlternatingRowStyle BackColor="#99FFCC" />
enter code here
<asp:TemplateField HeaderText="Planting Hatchery">
<ItemTemplate>
<asp:Label ID="lblPlantHatch" runat="server" Text='<%# Eval("HatcheryCodePlant")%>' Visible = "true"></asp:Label>
</ItemTemplate>
<insertItemTemplate>
<asp:DropDownList ID="ddPlantingHatchery" runat="server" DataSource='<%# GetPlantingHatchery()%>'
DataTextField="HatcheryNamePlant" DataValueField="HatcheryCodePlant" width= "150" AppendDataBoundItems="true">
<asp:ListItem Text="Select" Value="" />
</asp:DropDownList>
</insertItemTemplate>
<asp:TemplateField HeaderText="Water Body Name">
<ItemTemplate>
<asp:Label ID="lblStreamName" runat="server" Text='<%# Eval("CatalogNo")%>' Visible = "true"></asp:Label>
</ItemTemplate>
<insertItemTemplate>
<asp:DropDownList ID="ddCatalogName" runat="server" DataSource='<%# GetCatalogNames()%>'
DataTextField="StreamName" DataValueField="CatalogNo" AppendDataBoundItems="true">
<asp:ListItem Text="Select" Value="" />
</asp:DropDownList>
<asp:ObjectDataSource ID="dsWaterBody" runat="server" TypeName="StreamName"
SelectMethod="GetCatalogNames">
<SelectParameters>
<%--<asp:Parameter Name="HatcheryCodetName" Type="string" />--%>
<asp:ControlParameter Name="HatcheryCodePlant" Type="Int32" ControlID="ddPlantingHatchery" PropertyName="SelectedValue"/>
</SelectParameters>
</asp:ObjectDataSource>
</insertItemTemplate>enter code here
Код позади:
Private Sub DetailsView1_ItemInserting (отправитель как объект, e As DetailsViewInsertEventArgs) Обрабатывает dvSMasterCurrentYear.ItemInserting
Dim ddPlantHatch As DropDownList = TryCast (view.FindControl ("ddPlantingHatchery"), DropDownList) e.Values.Add ("HatcheryCodePlant", ddPlantHatch.SelectedValue)
Dim ddCatNum As DropDownList = TryCast (view.FindControl ("ddCatalogName"), DropDownList) e.Values ("HatcheryCodePlant") = DirectCast (DirectCast (отправитель, DetailsView). DropControl ("ddPlantingHatcheryListue"),.
Спасибо