GridView、DetailView、FormView和DropDownList级联更新和插入(不用FindControl)

 <asp:TemplateField HeaderText="类别" SortExpression="CategoryName">
        <EditItemTemplate>
        <asp:DropDownList ID="CategoryDDL2" runat="server" Width="180px" 
                  SelectedValue='<%# Bind("CategoryID") %>'
                  DataSourceID="CategoryDS" 
                  DataTextField="CategoryName" DataValueField="CategoryID"
>
        </asp:DropDownList>                   
         </EditItemTemplate>
               <InsertItemTemplate>
                   <asp:DropDownList ID="CategoryDDL3" runat="server" Width="180px" 
                           SelectedValue='<%# Bind("CategoryID") %>'     DataSourceID="CategoryDS" 
                           DataTextField="CategoryName" DataValueField="CategoryID">

                    </asp:DropDownList>
               </InsertItemTemplate>
               <ItemTemplate>
                   <asp:Label ID="Label1" runat="server" Text='<%# Bind("CategoryName") %>'>
                   </asp:Label>
               </ItemTemplate>



          <UpdateParameters>
                <asp:Parameter Name="LessonID" Type="Int32" />
                <asp:Parameter Name="CategoryID" Type="Int32" />
                <asp:Parameter Name="LessonName" Type="String" />
            </UpdateParameters>
            <InsertParameters>
               <asp:Parameter Name="CategoryID" Type="Int32" />
                <asp:Parameter Name="LessonName" Type="String" />
             </InsertParameters>

posted on 2006-10-13 10:35  灵风  阅读(2252)  评论(4编辑  收藏  举报