Note that there are some explanatory texts on larger screens.

plurals
  1. POIssues with Asp.net Gridview Paging
    text
    copied!<p>I have used the Gridview_PageIndexChanging event in asp.net.i have used the code like this:</p> <pre><code>gridFileDetails.PageIndex = e.NewPageIndex </code></pre> <p>During the run time when i clicked the next page,it generates an error:</p> <blockquote> <p>An exception of type 'System.InvalidCastException' occurred in FFK.DLL but was not handled in user code</p> <p>Additional information: Unable to cast object of type 'System.Web.UI.WebControls.ContentPlaceHolder' to type 'System.Web.UI.WebControls.GridViewRow'.</p> </blockquote> <p>in the RowCommand event,</p> <p>I have used the following RowCommand event:</p> <pre><code>Protected Sub gridFileDetails_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gridFileDetails.RowCommand Dim row As GridViewRow = CType(CType(e.CommandSource, Control).NamingContainer, GridViewRow) Dim rowkey As DataKey = Me.gridFileDetails.DataKeys(row.DataItemIndex) Dim key As String = rowkey(0).ToString() If e.CommandName = "FileStatus" And e.CommandArgument &lt;= 0 Then Response.Redirect("FFKFile.aspx?FileId=" + key) ElseIf e.CommandName = "TradexStatus" And e.CommandArgument &lt;= 0 Then Response.Redirect("TradeX.aspx?FileId=" + key) ElseIf e.CommandName = "BondStatus" And e.CommandArgument &lt;= 0 Then Response.Redirect("BondMaster.aspx?FileId=" + key) ElseIf e.CommandName = "FDStatus" And e.CommandArgument &lt;= 0 Then Response.Redirect("FrmFileDocument.aspx?FileId=" + key) ElseIf e.CommandName = "InvoiceStatus" And e.CommandArgument &lt;= 0 Then Response.Redirect("InvoiceMaster.aspx?FileId=" + key) ElseIf e.CommandName = "PDStatus" And e.CommandArgument &lt;= 0 Then Response.Redirect("PackagingDetails.aspx?FileId=" + key) End If End Sub </code></pre> <p>can you resolve this problem? i am getting the error in the first line in RowCommand event ,ie.,</p> <pre><code>Dim row As GridViewRow = CType(CType(e.CommandSource, Control).NamingContainer, GridViewRow) </code></pre> <p>In the PageIndexChanging event i have written as follows:</p> <p>Protected Sub gridFileDetails_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gridFileDetails.PageIndexChanging gridFileDetails.PageIndex = e.NewPageIndex End Sub</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload