Display FormView based on GridView selected row

arob45

New Member
I'm trying to display FormView1 when GridView1 selected index is changed. It works fine with one control parameter in the ObjectDataSource of FormView1, but not with two parameters. I get the exception "ObjectDataSource 'Formview1_ds' could not find a non-generic method 'Formview1_Select' that has parameters: Name, Number."\[code\] <asp:ObjectDataSource ID="Formview1_ds" runat="server" SelectMethod="Formview1_Select" TypeName="SqlFile"> <SelectParameters> <asp:ControlParameter ControlID="GridView1" Name="Name" PropertyName="SelectedDataKey.Values[Name]" DefaultValue="http://stackoverflow.com/questions/12750485/abc" /> <asp:ControlParameter ControlID="GridView1" Name="Number" PropertyName="SelectedDataKey.Values[Number]" DefaultValue="http://stackoverflow.com/questions/12750485/0" /> </SelectParameters></asp:ObjectDataSource>\[/code\]SQLFile\[code\]Shared Function FormView1_Select(ByVal Name, ByVal Number) As SqlClient.SqlDataReaderDim connection As New SqlClient.SqlConnection(System.Configuration.ConfigurationManager.AppSettings.Get("myConnection")) Dim connectionString As String connectionString = "SELECT * FROM table WHERE Name = '" & Name & "' AND Number = '" & Number & "'" Dim command As New SqlClient.SqlCommand(connectionString, connection) connection.Open() Return command.ExecuteReader(CommandBehavior.CloseConnection)End Function\[/code\]
 
Back
Top