The GridView 'GridView2' fired event RowEditing which wasn't handl

E

egsdar

Hi, I have created a second gridview when customer clicks on select link with
this code:



Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs) Handles
GridView1.RowCommand

Select Case e.CommandName

Case "Select"

GridView1.SelectedIndex = e.CommandArgument
Dim index As Integer = Convert.ToInt32(e.CommandArgument)

' Retrieve the row that contains the button clicked
' by the user from the Rows collection.
Dim row As GridViewRow = GridView1.Rows(index)
Dim mival = Server.HtmlDecode(row.Cells(1).Text)
HiddenField1.Value = mival
TabContainer1.Visible = True
Dim sqlConn As System.Data.SqlClient.SqlConnection
Dim sqlCmd As System.Data.SqlClient.SqlCommand
Dim strConnection As String
strConnection =
ConfigurationManager.ConnectionStrings("SIPConnectionString").ConnectionString
sqlConn = New
System.Data.SqlClient.SqlConnection(strConnection)
sqlCmd = New System.Data.SqlClient.SqlCommand("SELECT
responsablepropuesta.respgrupo as IDRespGrupo, tb1.nombre as RespGrupo,
responsablepropuesta.resppropuesta as IDRespProp, tb2.nombre as RespPropuesta
FROM responsablepropuesta INNER JOIN usuario tb1 ON tb1.idusuario =
responsablepropuesta.respgrupo INNER JOIN usuario tb2 ON tb2.idusuario =
responsablepropuesta.resppropuesta where idpropuesta='" & mival & "'",
sqlConn)

sqlConn.Open()
GridView2.DataSource = sqlCmd.ExecuteReader()
GridView2.DataBind()
sqlConn.Close()
End Select

End Sub


And when users tries to clicks on Edit link, runs this code:



Protected Sub GridView2_RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs) Handles
GridView2.RowCommand
Select Case e.CommandName

Case "Edit"

GridView2.SelectedIndex = e.CommandArgument
Dim index As Integer = Convert.ToInt32(e.CommandArgument)

' Retrieve the row that contains the button clicked
' by the user from the Rows collection.
Dim row As GridViewRow = GridView2.Rows(index)
Panel1.Visible = False
Panel2.Visible = True

End Select
End Sub



But when it finish this part, it displays an error:

The GridView 'GridView2' fired event RowEditing which wasn't handled.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.Web.HttpException: The GridView 'GridView2' fired
event RowEditing which wasn't handled.

Source Error:



An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.



Stack Trace:



[HttpException (0x80004005): The GridView 'GridView2' fired event RowEditing
which wasn't handled.]
System.Web.UI.WebControls.GridView.OnRowEditing(GridViewEditEventArgs e)
+324
System.Web.UI.WebControls.GridView.HandleEdit(Int32 rowIndex) +60
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) +679
System.Web.UI.WebControls.GridView.RaisePostBackEvent(String
eventArgument) +213

System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +242
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3822






How can I solve this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top