Hi, I have created a second gridview when customer clicks on select link with
this code:
Protected Sub GridView1_RowCo mmand(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Grid ViewCommandEven tArgs) Handles
GridView1.RowCo mmand
Select Case e.CommandName
Case "Select"
GridView1.Selec tedIndex = e.CommandArgume nt
Dim index As Integer = Convert.ToInt32 (e.CommandArgum ent)
' 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.HtmlDeco de(row.Cells(1) .Text)
HiddenField1.Va lue = mival
TabContainer1.V isible = True
Dim sqlConn As System.Data.Sql Client.SqlConne ction
Dim sqlCmd As System.Data.Sql Client.SqlComma nd
Dim strConnection As String
strConnection =
ConfigurationMa nager.Connectio nStrings("SIPCo nnectionString" ).ConnectionStr ing
sqlConn = New
System.Data.Sql Client.SqlConne ction(strConnec tion)
sqlCmd = New System.Data.Sql Client.SqlComma nd("SELECT
responsableprop uesta.respgrupo as IDRespGrupo, tb1.nombre as RespGrupo,
responsableprop uesta.resppropu esta as IDRespProp, tb2.nombre as RespPropuesta
FROM responsableprop uesta INNER JOIN usuario tb1 ON tb1.idusuario =
responsableprop uesta.respgrupo INNER JOIN usuario tb2 ON tb2.idusuario =
responsableprop uesta.resppropu esta where idpropuesta='" & mival & "'",
sqlConn)
sqlConn.Open()
GridView2.DataS ource = sqlCmd.ExecuteR eader()
GridView2.DataB ind()
sqlConn.Close()
End Select
End Sub
And when users tries to clicks on Edit link, runs this code:
Protected Sub GridView2_RowCo mmand(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Grid ViewCommandEven tArgs) Handles
GridView2.RowCo mmand
Select Case e.CommandName
Case "Edit"
GridView2.Selec tedIndex = e.CommandArgume nt
Dim index As Integer = Convert.ToInt32 (e.CommandArgum ent)
' 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.Http Exception: 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.W ebControls.Grid View.OnRowEditi ng(GridViewEdit EventArgs e)
+324
System.Web.UI.W ebControls.Grid View.HandleEdit (Int32 rowIndex) +60
System.Web.UI.W ebControls.Grid View.HandleEven t(EventArgs e, Boolean
causesValidatio n, String validationGroup ) +679
System.Web.UI.W ebControls.Grid View.RaisePostB ackEvent(String
eventArgument) +213
System.Web.UI.W ebControls.Grid View.System.Web .UI.IPostBackEv entHandler.Rais ePostBackEvent( String eventArgument) +31
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument) +32
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +242
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +3822
How can I solve this?
this code:
Protected Sub GridView1_RowCo mmand(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Grid ViewCommandEven tArgs) Handles
GridView1.RowCo mmand
Select Case e.CommandName
Case "Select"
GridView1.Selec tedIndex = e.CommandArgume nt
Dim index As Integer = Convert.ToInt32 (e.CommandArgum ent)
' 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.HtmlDeco de(row.Cells(1) .Text)
HiddenField1.Va lue = mival
TabContainer1.V isible = True
Dim sqlConn As System.Data.Sql Client.SqlConne ction
Dim sqlCmd As System.Data.Sql Client.SqlComma nd
Dim strConnection As String
strConnection =
ConfigurationMa nager.Connectio nStrings("SIPCo nnectionString" ).ConnectionStr ing
sqlConn = New
System.Data.Sql Client.SqlConne ction(strConnec tion)
sqlCmd = New System.Data.Sql Client.SqlComma nd("SELECT
responsableprop uesta.respgrupo as IDRespGrupo, tb1.nombre as RespGrupo,
responsableprop uesta.resppropu esta as IDRespProp, tb2.nombre as RespPropuesta
FROM responsableprop uesta INNER JOIN usuario tb1 ON tb1.idusuario =
responsableprop uesta.respgrupo INNER JOIN usuario tb2 ON tb2.idusuario =
responsableprop uesta.resppropu esta where idpropuesta='" & mival & "'",
sqlConn)
sqlConn.Open()
GridView2.DataS ource = sqlCmd.ExecuteR eader()
GridView2.DataB ind()
sqlConn.Close()
End Select
End Sub
And when users tries to clicks on Edit link, runs this code:
Protected Sub GridView2_RowCo mmand(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Grid ViewCommandEven tArgs) Handles
GridView2.RowCo mmand
Select Case e.CommandName
Case "Edit"
GridView2.Selec tedIndex = e.CommandArgume nt
Dim index As Integer = Convert.ToInt32 (e.CommandArgum ent)
' 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.Http Exception: 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.W ebControls.Grid View.OnRowEditi ng(GridViewEdit EventArgs e)
+324
System.Web.UI.W ebControls.Grid View.HandleEdit (Int32 rowIndex) +60
System.Web.UI.W ebControls.Grid View.HandleEven t(EventArgs e, Boolean
causesValidatio n, String validationGroup ) +679
System.Web.UI.W ebControls.Grid View.RaisePostB ackEvent(String
eventArgument) +213
System.Web.UI.W ebControls.Grid View.System.Web .UI.IPostBackEv entHandler.Rais ePostBackEvent( String eventArgument) +31
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument) +32
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +242
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +3822
How can I solve this?