0

我有实体数据源,我想添加一个 where参数以过滤信息。我有一个带有项目列表的网格视图,在选中复选框并点击编辑按钮时,它会将您发送到另一个视图,其中有一个具有实体数据源的详细信息视图,因为它是 DS。现在我想添加一个 where 参数的实体数据源。这是我到目前为止..

        <asp:EntityDataSource ID="EntityDataSource2" runat="server" ConnectionString="name=sspEntities" DefaultContainerName="sspEntities" 
            EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True"
             EntitySetName="Salary_Increase_Type" AutoGenerateWhereClause="True">
        </asp:EntityDataSource>




  Protected Sub ImageButton3_Click(sender As Object, e As ImageClickEventArgs) Handles ImageButton3.Click
        For Each dr As GridViewRow In GridView1.Rows
            If ((TryCast(dr.FindControl("checkbox1"), CheckBox)).Checked = True) Then
                Dim id As Integer = GridView1.DataKeys(dr.RowIndex).Value
                EntityDataSource2.WhereParameters.Clear()

                EntityDataSource2.WhereParameters.Add(id, "id")
                MultiView1.ActiveViewIndex = 1
                DetailsView1.ChangeMode(DetailsViewMode.Edit)



            End If
        Next
    End Sub
4

1 回答 1

0

EntityDataSource2.WhereParameters.Clear() EntityDataSource2.WhereParameters.Add(name:="Id", dbType:=DbType.Int32, value:=id)

于 2013-06-06T20:20:41.530 回答