I get below error on this line. Dim pageList
As DropDownList = CType(pagerRow.Cells(0).FindControl("PageDropDownList"), DropDownList)
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
Source="App_Web_jwbpeixv"
StackTrace:
at UnProcessedClaims.gvparts_DataBound(Object sender, EventArgs e) in C:\Inetpub\wwwroot\NaccoSRS\UnProcessedClaims.aspx.vb:line 129
at System.Web.UI.WebControls.BaseDataBoundControl.OnDataBound(EventArgs e)
at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.GridView.DataBind()
at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
Source="App_Web_jy3t8pb5"
StackTrace:
at UnProcessedClaims.gvparts_DataBound(Object sender, EventArgs e) in C:\Inetpub\wwwroot\NaccoSRS\UnProcessedClaims.aspx.vb:line 130
at System.Web.UI.WebControls.BaseDataBoundControl.OnDataBound(EventArgs e)
at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.GridView.DataBind()
at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I tried the below code with different option but still get the same error.
Sub gvparts_DataBound(ByVal sender
AsObject,
ByVal e As EventArgs)
Dim pagerRow As GridViewRow = gvparts.BottomPagerRow
'Dim pageList As DropDownList = CType(pagerRow.Cells(1).FindControl("PageDropDownList"), DropDownList)
'Dim pageList As DropDownList = CType(gvparts.BottomPagerRow.FindControl("PageDropDownList"), DropDownList)
'Dim pageLabel As Label = CType(pagerRow.Cells(0).FindControl("CurrentPageLabel"), Label)
Dim pagerRow As GridViewRow = gvparts.BottomPagerRow
bhavin78
Contributor
2697 Points
586 Posts
GridView.BottomPagerRow Property
Oct 24, 2006 07:11 PM|LINK
I am following the article http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.bottompagerrow.aspx from microsoft on GridView.BottomPagerRow Property
I get below error on this line.
Dim pageList As DropDownList = CType(pagerRow.Cells(0).FindControl("PageDropDownList"), DropDownList)
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
Source="App_Web_jwbpeixv"
StackTrace:
at UnProcessedClaims.gvparts_DataBound(Object sender, EventArgs e) in C:\Inetpub\wwwroot\NaccoSRS\UnProcessedClaims.aspx.vb:line 129
at System.Web.UI.WebControls.BaseDataBoundControl.OnDataBound(EventArgs e)
at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.GridView.DataBind()
at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
albertpascua...
All-Star
17520 Points
3475 Posts
MVP
Re: GridView.BottomPagerRow Property
Oct 24, 2006 07:15 PM|LINK
Can you post the aspx page?
Normally would be that PageDropDownList is not in the page
Al
My Blog
bhavin78
Contributor
2697 Points
586 Posts
Re: GridView.BottomPagerRow Property
Oct 24, 2006 07:43 PM|LINK
<asp:GridView ID="gvparts" runat="server" AutoGenerateColumns="False" DataSourceID="odsUnProcessedClaims" ondatabound="gvParts_DataBound" EmptyDataText="NoRecordFound" DataKeyNames="Claim_Number" AllowPaging="True">
<PagerStyle ForeColor="Blue" BackColor="LightBlue" />
<pagerstyle forecolor="Blue"backcolor="LightBlue" />
<pagertemplate>
<table width="100%">
<tr>
<td width="70%">
<asp:label id="MessageLabel" forecolor="Blue" text="Select a page:" runat="server"/>
<asp:dropdownlist id="PageDropDownList" autopostback="true" onselectedindexchanged="PageDropDownList_SelectedIndexChanged" runat="server"/>
</td>
<td width="70%" align="right">
<asp:label id="CurrentPageLabel" forecolor="Blue" runat="server"/></td></tr> </table></pagertemplate>
<Columns>
</Columns>
</asp:GridView>
mase_dawg
Member
80 Points
16 Posts
Re: GridView.BottomPagerRow Property
Oct 24, 2006 07:52 PM|LINK
Is your BottomRowPager visibility on?
Also, I would just try doing this instead of creating a row and finding the control in the row:
DropDownList ddl1 = Ctype(gvparts.BottomPagerRow.FindControl("PageDropDownList"), DropDownList)
GridView BottomPagerRow
bhavin78
Contributor
2697 Points
586 Posts
Re: GridView.BottomPagerRow Property
Oct 24, 2006 08:05 PM|LINK
I tried that code and it gives me the same error
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
Source="App_Web_jy3t8pb5"
StackTrace:
at UnProcessedClaims.gvparts_DataBound(Object sender, EventArgs e) in C:\Inetpub\wwwroot\NaccoSRS\UnProcessedClaims.aspx.vb:line 130
at System.Web.UI.WebControls.BaseDataBoundControl.OnDataBound(EventArgs e)
at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.GridView.DataBind()
at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
albertpascua...
All-Star
17520 Points
3475 Posts
MVP
Re: GridView.BottomPagerRow Property
Oct 24, 2006 10:17 PM|LINK
Actually look at your page, the dropdown is not on Cell(0) in on Cell(1) do something like this to check
for(int i=0 ; e.Cell.Count; i++)
{
DropDownList = (DropDownList )e.Cell[i].FindControl("DropDown1");
if ( DropDownList != null)
break;
}
This is in C#, this will tell you where is the dropdown
Al
My Blog
bhavin78
Contributor
2697 Points
586 Posts
Re: GridView.BottomPagerRow Property
Oct 25, 2006 02:32 PM|LINK
I tried the below code with different option but still get the same error.
Sub gvparts_DataBound(ByVal sender As Object, ByVal e As EventArgs)
Dim pagerRow As GridViewRow = gvparts.BottomPagerRow
'Dim pageList As DropDownList = CType(pagerRow.Cells(1).FindControl("PageDropDownList"), DropDownList)
'Dim pageList As DropDownList = CType(gvparts.BottomPagerRow.FindControl("PageDropDownList"), DropDownList)
'Dim pageLabel As Label = CType(pagerRow.Cells(0).FindControl("CurrentPageLabel"), Label)
Dim pagerRow As GridViewRow = gvparts.BottomPagerRow
Dim pageList As DropDownList
Dim i As Integer = 0
While pagerRow.Cells.Count
pageList = CType(pagerRow.Cells(i).FindControl("DropDown1"), DropDownList)
If Not (pageList Is Nothing) Then
Exit While
End If
System.Math.Min(System.Threading.Interlocked.Increment(i), i - 1)
End While
If Not pageList Is Nothing Then
Dim n As Integer
For n = 0 To gvparts.PageCount - 1
Dim pageNumber As Integer = i + 1
Dim item As ListItem = New ListItem(pageNumber.ToString())
If n = gvparts.PageIndex Then
item.Selected = True
End If
pageList.Items.Add(item)
Next n
End If
End Sub
mase_dawg
Member
80 Points
16 Posts
Re: GridView.BottomPagerRow Property
Oct 26, 2006 07:29 PM|LINK
Are you SURE that your BottomPagerRow.Visibility = true???? It must be visible or it will never get rendered to the browser.
Also, start the debugger and step through the process. See if pagerRow is null or if the BottomPagerRow was actually returned.
bhavin78
Contributor
2697 Points
586 Posts
Re: GridView.BottomPagerRow Property
Oct 27, 2006 03:05 PM|LINK
This is what I did and get error on that line. use the new key word to create instanse of an object.
Sub gvparts_DataBound(ByVal sender As Object, ByVal e As EventArgs)
gvparts.BottomPagerRow.Visible = True
...
end sub
Is there some other place I can configure bottompagerrow property.
bhavin78
Contributor
2697 Points
586 Posts
Re: GridView.BottomPagerRow Property
Oct 27, 2006 04:05 PM|LINK
Can I email you the file and you can check for me?