L
loga123
Hi All,
I am using Link Button for DELETE on the gridview. When I click on
DELETE link, I get the ArgumentOutOfRangeException. But...it deletes
the record from table in the database.
On Gridview_rowdatabound, I am dynamically building hyperlink control
based on the values in the other fields. Here is my code for
Gridview_rowdatabound. It does work sometimes though.
Protected Sub dgQuestions_RowDataBound(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.GridViewRowEventArgs) Handles
dgQuestions.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim hLnk As HyperLink = CType(e.Row.Cells(3).Controls(0),
HyperLink)
Dim iCID As String
iCID = drpClasses.SelectedValue
Dim iQSeq As Integer
iQ = cint(e.Row.Cells(1).Text)
hLnk.NavigateUrl = "ShowDetails.aspx?CID=" & iCID
End If
End Sub
Please, see Stack Trace below. Any ideas anyone?
Stack Trace:
[ArgumentOutOfRangeException: Specified argument was out of the range
of valid values.
Parameter name: value]
System.Web.UI.WebControls.GridView.set_SelectedIndex(Int32 value)
+1454311
System.Web.UI.WebControls.GridView.HandleDeleteCallback(Int32
affectedRows, Exception ex) +354
System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary
oldValues, DataSourceViewOperationCallback callback) +123
System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row,
Int32 rowIndex) +927
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) +1155
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source,
EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args) +35
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source,
EventArgs e) +117
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args) +35
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
+115
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
eventArgument) +163
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+174
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+5102
I am using Link Button for DELETE on the gridview. When I click on
DELETE link, I get the ArgumentOutOfRangeException. But...it deletes
the record from table in the database.
On Gridview_rowdatabound, I am dynamically building hyperlink control
based on the values in the other fields. Here is my code for
Gridview_rowdatabound. It does work sometimes though.
Protected Sub dgQuestions_RowDataBound(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.GridViewRowEventArgs) Handles
dgQuestions.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim hLnk As HyperLink = CType(e.Row.Cells(3).Controls(0),
HyperLink)
Dim iCID As String
iCID = drpClasses.SelectedValue
Dim iQSeq As Integer
iQ = cint(e.Row.Cells(1).Text)
hLnk.NavigateUrl = "ShowDetails.aspx?CID=" & iCID
End If
End Sub
Please, see Stack Trace below. Any ideas anyone?
Stack Trace:
[ArgumentOutOfRangeException: Specified argument was out of the range
of valid values.
Parameter name: value]
System.Web.UI.WebControls.GridView.set_SelectedIndex(Int32 value)
+1454311
System.Web.UI.WebControls.GridView.HandleDeleteCallback(Int32
affectedRows, Exception ex) +354
System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary
oldValues, DataSourceViewOperationCallback callback) +123
System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row,
Int32 rowIndex) +927
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) +1155
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source,
EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args) +35
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source,
EventArgs e) +117
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args) +35
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
+115
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
eventArgument) +163
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+174
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+5102