0

I have and entity datasource and i would like to add a where parameter so as to filter information. I have a gridview with a list of items and on checking a checkbox and hitting edit button, it sends you to a different view where there is a detailsview that has entitydatasource as it's DS. Now the entity datasource i want to add a where parameter. this is what i have so far..

        <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
Dineshp
  • 31
  • 1
  • 11
  • I figure it out guys. for those that want to know this: – Dineshp Jun 06 '13 at 16:01
  • EntityDataSource2.WhereParameters.Clear() EntityDataSource2.WhereParameters.Add(name:="Id", dbType:=DbType.Int32, value:=id) – Dineshp Jun 06 '13 at 16:02
  • Feel free to post your solution as an answer, or just delete your question with the "delete" link (directly below the question). – Josh Darnell Jun 06 '13 at 18:02

1 Answers1

0

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

Dineshp
  • 31
  • 1
  • 11