Please help when i add SelectedIndexChanged and rowcommand i get the error below
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30456: 'Studentgrid_SelectedIndexChanged' is not a member of 'forms_casestudents_aspx'.
Source Error:
Line 87: <tr>
Line 88: <td>
Line 89: <asp:GridView ID="Studentgrid" runat="server" ItemStyle-Width="Auto" AutoGenerateColumns="False" OnSelectedIndexChanged="Studentgrid_SelectedIndexChanged" OnRowCommand="Studentgrid_RowCommand" >
Line 90: <Columns>
Line 91: <asp:ButtonField HeaderText="Edit Record" Text="Select" />
Source File: C:\Users\Makumbi\source\repos\INTERVIEWSVB\INTERVIEWSVB\Forms\Casestudents.aspx Line: 89
Show Detailed Compiler Output:
Show Complete Compilation Source:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4465.0
Public Class Casestudents
Inherits System.Web.UI.Page
Dim conString As String = ConfigurationManager.ConnectionStrings("INTERVIEWSConnectionString").ConnectionString
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Studentgrid.DataBind()
End If
End Sub
Private Sub Studentgrid_SelectedIndexChanged(sender As Object, e As EventArgs) Handles Studentgrid.SelectedIndexChanged
Try
Dim index As Integer = Studentgrid.SelectedIndex
Dim gvRow As GridViewRow = Studentgrid.Rows(index)
Dim named As String = Studentgrid.SelectedRow.Cells(1).Text
Dim namesd As String = Studentgrid.SelectedRow.Cells(2).Text
Dim commandName As String = sender.ToString()
If String.IsNullOrEmpty(Studentgrid.SelectedRow.Cells(8).Text.Trim().Replace(" ", String.Empty)) Then
Response.Redirect(String.Format("~/Forms/casedata2.aspx?account={0}&Names={1}", named, namesd))
Else
Dim comments As String = Studentgrid.SelectedRow.Cells(8).Text
Response.Redirect(String.Format("~/Forms/casedata2.aspx?account={0}&Names={1}&comment={2}", named, namesd, comments))
End If
Catch ex As Exception
End Try
End Sub
Private Sub Studentgrid_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles Studentgrid.RowCommand
If e.CommandName = "View Document" Then
Dim named As String = Studentgrid.SelectedRow.Cells(1).Text
Dim namesd As String = Studentgrid.SelectedRow.Cells(2).Text
Response.Redirect(String.Format("~/Forms/docdetails.aspx?account={0}&Names={1}", named, namesd))
End If
End Sub
Private Sub Studentgrid_SelectedIndexChanging(sender As Object, e As GridViewSelectEventArgs) Handles Studentgrid.SelectedIndexChanging
End Sub
End Class