需要为详细信息视图中的DropDown分配DataSource

时间:2013-10-15 10:14:45

标签: detailsview

我有两个下拉列表1 - 部件号,2 - 详细信息视图中的序列号 两者都是来自db1的数据源,而Details View本身是在db2中插入/添加数据 我的需求是,当我在一个列表中选择partno时,第二个下拉列表应该只显示与第一个中选择的partnp相关联的序列号

显示代码: -

                    <asp:TemplateField HeaderText=" PART NO " SortExpression="PARTNO">
                        <EditItemTemplate>
                            <asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True" 
                                DataSourceID="web_partno" DataTextField="PART_NO" DataValueField="PART_NO" 
                              SelectedValue='<%# Bind("PARTNO") %>' Width="217px">
                            </asp:DropDownList>
                            <asp:ListSearchExtender ID="DropDownList3_ListSearchExtender" runat="server" 
                                Enabled="True" TargetControlID="DropDownList3">
                            </asp:ListSearchExtender>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True" 
                                DataSourceID="web_partno" DataTextField="PART_NO" DataValueField="PART_NO" 
                                 SelectedValue='<%# Bind("PARTNO") %>' Width="217px">
                            </asp:DropDownList>
                            <asp:ListSearchExtender ID="DropDownList3_ListSearchExtender" runat="server" 
                                Enabled="True" TargetControlID="DropDownList3">
                            </asp:ListSearchExtender>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label3" runat="server" Text='<%# Bind("PARTNO") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText=" SERIAL NO " SortExpression="SERIAL_NO">
                        <EditItemTemplate>
                            <asp:DropDownList ID="DropDownList4" runat="server" DataSourceID="web_serialno" 
                                DataTextField="PART_SLNO" DataValueField="PART_SLNO"  
                                SelectedValue='<%# Bind("SERIAL_NO") %>' Width="259px">
                            </asp:DropDownList>
                            <asp:ListSearchExtender ID="DropDownList4_ListSearchExtender" runat="server" 
                                Enabled="True" TargetControlID="DropDownList4">
                            </asp:ListSearchExtender>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:DropDownList ID="DropDownList4" runat="server" DataSourceID="web_serialno" 
                                DataTextField="PART_SLNO" DataValueField="PART_SLNO" 
                                SelectedValue='<%# Bind("SERIAL_NO") %>' Width="259px">
                            </asp:DropDownList>
                            <asp:ListSearchExtender ID="DropDownList4_ListSearchExtender" runat="server" 
                                Enabled="True" TargetControlID="DropDownList4">
                            </asp:ListSearchExtender>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label4" runat="server" Text='<%# Bind("SERIAL_NO") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>

0 个答案:

没有答案