Hey guys,
I have a grid in a web user control that implements:
UltraWebGrid1.InitializeDataSource += new Infragistics.WebUI.UltraWebGrid.InitializeDataSourceEventHandler(UltraWebGrid1_InitializeDataSource);
UltraWebGrid1_InitializeDataSource queries the database, gets a datatable object and assigns it to the grid's datasource.
everything works fine.
However if I add the WebNavBar:
<ignavbar:webnavbar id="WebNavBar1" runat="server" > <Extension Visible="false" > </Extension> <Navigation Next-AutoPostBack="false" Prev-AutoPostBack= "false" End-AutoPostBack="false" Start-AutoPostBack="false" Rewind-AutoPostBack="false" FastForward-AutoPostBack="false" ></Navigation></ignavbar:webnavbar>
protected override void OnInit(EventArgs e) { UltraWebGrid1.InitializeDataSource += new Infragistics.WebUI.UltraWebGrid.InitializeDataSourceEventHandler(UltraWebGrid1_InitializeDataSource); WebNavBar1.GridID = UltraWebGrid1.UniqueID; }
and click Reverse or Forward I would get the following exception (all other buttons work just fine):
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.
[NullReferenceException: Object reference not set to an instance of an object.] Infragistics.WebUI.UltraWebGrid.RowsCollection.Infragistics.WebUI.UltraWebGrid.IXPathDataNavigable.GetFirstChild() +183 Infragistics.WebUI.UltraWebGrid.RowsCollection.Infragistics.WebUI.UltraWebGrid.IXPathDataNavigable.get_HasChildren() +32 Infragistics.WebUI.UltraWebGrid.XPathDataNavigator.OutputToStream(XPathDataNavigator xpdn, XmlTextWriter stream, HtmlTextWriter htmlWriter) +142 Infragistics.WebUI.UltraWebGrid.RenderXmlGrid.WriteBody(HtmlTextWriter writer, RowsCollection rows, Boolean topLevel) +112 Infragistics.WebUI.UltraWebGrid.RenderXmlGrid.WriteUltraWebGrid(HtmlTextWriter writer, UltraWebGrid grid, Boolean shouldWriteAll) +418 Infragistics.WebUI.UltraWebGrid.RenderXmlGrid.VisitObjects(HtmlTextWriter output) +603 Infragistics.WebUI.Shared.RendererBase.Render(HtmlTextWriter output) +36 Infragistics.WebUI.UltraWebGrid.GridRendererBase.Render(HtmlTextWriter output) +482 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.Render(HtmlTextWriter output) +336 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20 System.Web.UI.Control.Render(HtmlTextWriter writer) +7 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20 System.Web.UI.Control.Render(HtmlTextWriter writer) +7 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20 System.Web.UI.UpdatePanel.RenderChildren(HtmlTextWriter writer) +236 System.Web.UI.Control.Render(HtmlTextWriter writer) +7 System.Web.UI.UpdatePanel.Render(HtmlTextWriter writer) +32 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20 System.Web.UI.Control.Render(HtmlTextWriter writer) +7 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20 System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +59 System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +68 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121 System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +37 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20 System.Web.UI.Control.Render(HtmlTextWriter writer) +7 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20 System.Web.UI.Page.Render(HtmlTextWriter writer) +26 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2558
I had a similar problem with another grid and I solved it reassigning the datasource to the grid on these events:
onaftermovenext="WebNavBar1_Move" onaftermoveprev="WebNavBar1_Move" onaftermovetoend="WebNavBar1_Move" onaftermovetostart="WebNavBar1_Move"
I haven't had the same luck with this grid.
Can somebody help please?
Thanks !
Hi, I'm not able to reproduce the problem, I'm sending you PM with my email, please reply with the project attached including sample DB if possible.
-Nick
After spending a lot of time trying to recreate the error on a small project so later I could send it to you, as requested, I was able to find the cause.
Setting the property Browser="Xml" will throw the exception mentioned before.
I found out about this by applying the following Skin:
<igtbl:UltraWebGrid runat="server" Browser="Xml" ImageDirectory="~/App_Themes/Default/Office2007Blue/WebGrid/"> <DisplayLayout AllowColSizingDefault="Free" AllowColumnMovingDefault="OnServer" AllowDeleteDefault="Yes" AllowUpdateDefault="Yes" AllowSortingDefault="Yes" BorderCollapseDefault="Separate" CellClickActionDefault="RowSelect" CompactRendering="True" GridLinesDefault="NotSet" LoadOnDemand="Automatic" Name="ctl12xUltraWebGrid1" RowHeightDefault="20px" RowSelectorsDefault="No" SelectTypeRowDefault="Extended" StationaryMargins="Header" StationaryMarginsOutlookGroupBy="True" TableLayout="Fixed" Version="4.00" ViewType="OutlookGroupBy" HeaderClickActionDefault="SortMulti" NoDataMessage ="No records were found"> <GroupByBox> <BandLabelStyle CssClass="igwgGrpBoxBandLblBlue2k7"> </BandLabelStyle> <Style CssClass="igwgGrpBoxBlue2k7"> </Style> </GroupByBox> <GroupByRowStyleDefault CssClass="igwgGrpRowBlue2k7"></GroupByRowStyleDefault> <ActivationObject BorderColor="181, 196, 223" BorderWidth=""> <BorderDetails WidthLeft="0px" WidthRight="0px" /> </ActivationObject> <RowExpAreaStyleDefault CssClass="igwgRowExpBlue2k7"></RowExpAreaStyleDefault> <FooterStyleDefault CssClass="igwgFooterBlue2k7"></FooterStyleDefault> <SelectedGroupByRowStyleDefault CssClass="igwgGrpRowSelBlue2k7"></SelectedGroupByRowStyleDefault> <RowStyleDefault CssClass="igwgRowBlue2k7" Cursor="Hand"> <BorderDetails WidthBottom="1px" WidthTop="1px" /> <Padding Left="3px" /> </RowStyleDefault> <FilterOptionsDefault AllowRowFiltering="OnServer" FilterUIType="FilterRow" FilterComparisonType="CaseInsensitive" RowFilterMode="AllRowsInBand" > <FilterOperandDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="11px"> <Padding Left="2px" /> </FilterOperandDropDownStyle> <FilterHighlightRowStyle BackColor="#151C55" ForeColor="White"> </FilterHighlightRowStyle> <FilterDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="11px" Width="200px"> <Padding Left="2px" /> </FilterDropDownStyle> </FilterOptionsDefault> <RowSelectorStyleDefault CssClass="igwgRowSlctrBlue2k7"></RowSelectorStyleDefault> <FixedHeaderStyleDefault CssClass="igwgHdrFxdBlue2k7"></FixedHeaderStyleDefault> <SelectedRowStyleDefault CssClass="igwgRowSelBlue2k7"></SelectedRowStyleDefault> <HeaderStyleDefault CssClass="igwgHdrBlue2k7" Height="23px"></HeaderStyleDefault> <RowAlternateStyleDefault CssClass="igwgRowAltBlue2k7"></RowAlternateStyleDefault> <Images ImageDirectory="~/App_Themes/Default/Office2007Blue/WebGrid/"> </Images> <SelectedHeaderStyleDefault CssClass="igwgHdrSelBlue2k7"></SelectedHeaderStyleDefault> <FormulaErrorStyleDefault CssClass="igwgFormulaErrBlue2k7"></FormulaErrorStyleDefault> <EditCellStyleDefault CssClass="igwgCellEdtBlue2k7"></EditCellStyleDefault> <FrameStyle CssClass="igwgFrameBlue2k7" Width="100%" Height="300px"></FrameStyle> <FixedCellStyleDefault CssClass="igwgCellFxdBlue2k7"></FixedCellStyleDefault> <FixedFooterStyleDefault CssClass="igwgFtrFxdBlue2k7"></FixedFooterStyleDefault> <Pager AllowPaging="True" PageSize="100" StyleMode="PrevNext" > <Style CssClass="igwgPgrBlue2k7"></Style> </Pager> <AddNewBox Hidden="False" Prompt="Add" View="Compact" > <ButtonStyle CssClass="igwgAddNewBtnBlue2k7"></ButtonStyle> <Style CssClass="igwgAddNewBoxBlue2k7"></Style> </AddNewBox> </DisplayLayout></igtbl:UltraWebGrid>
Let me know if you still need me to send you the project.
THANKS !
void WebNavBar1_AfterMoveBackward(object sender, Infragistics.WebUI.WebNavBar.AfterNavigateEventArgs args){ UWGrdProjects.DataBind();}
void WebNavBar1_AfterMoveForward(object sender, Infragistics.WebUI.WebNavBar.AfterNavigateEventArgs args){ UWGrdProjects.DataBind();}
Hope that helps.
Best,Nick
hey thanks !, now it seems to work better, I thought I did this before.... weird.
Anyway, there is still something.
After adding your code and running the application If you change the page using the Forward or the Reverse button and then click the Next or the Previous button, it won't change the active row, or at least it won't select it, even if I add:
protected void WebNavBar1_ChangeActiveRow(object sender, Infragistics.WebUI.WebNavBar.AfterNavigateEventArgs args) { UWGrdProjects.DisplayLayout.ActiveRow.Selected = true; }
OnAfterMoveNext="WebNavBar1_ChangeActiveRow" OnAfterMovePrev="WebNavBar1_ChangeActiveRow"
UPDATE: Clicking the Forward and the Reverse buttons will change the page. but for some reason when I click the Next or Previous buttons it will highlight the row in the previous page, I found out this by going back to the previous page after clicking the Next or Previous buttons.
any ideas?
thanks again for your help !!
ureyes84 said:changing the value of Browser from "Xml" to "Auto" will "fix" it. However, it makes the grid look weird the first time it loads
I noticed this keeps the app from crashing when clicking the WebNavBar, however, as stated above, the grid will render differently when the page is refreshed.
This is an email I got from Nick, which fixed my problem, so I hope this helps someone else.
--------------------------------------
Hm, this seems to be a bug in the Grid, here is an easy workaround:
<igtbl:UltraWebGrid ID="UWGrdProjects" runat="server" Width="100%" Height="140px" Browser="Auto">
<DisplayLayout LoadOnDemand="Xml" SelectTypeRowDefault="Single">
<HeaderStyleDefault
CssClass=""
Font-Names="Verdana, Arial, Helvetica, sans-serif"
Font-Size="11px"
BackColor="#D4D7DB"
BackgroundImage="App_Themes/Default/Office2007Blue/WebGrid/igwgHeader.jpg">
<Padding Left="10px" Right="10px" />
</HeaderStyleDefault>
<Pager AllowPaging="true" PageSize="5" ></Pager>
</DisplayLayout>
</igtbl:UltraWebGrid>
The idea is to put a HeaderStyleDefault section below DisplayLayout and set its CssClass to Empty, then set Font, BackGround, Padding etc. however you like.
thanks Nick.
The page where my grid is contains multiple UpdatePanel controls. I noticed after removing them, the grid was keeping the active row selected. I'm still getting the exception when:
Browser="Xml" LoadOnDemand="Xml"
So any help would be appreciated.
Ok now I'm getting the exception again.
Setting
will make the app crash , even with the DataBind on the OnAfterMoveBackward
changing the value of Browser from "Xml" to "Auto" will "fix" it. However, it makes the grid look weird the first time it loads
So is this a bug? or is it just that these settings are incompatible with the navbar?