Welcome to Vortx Community Forum, where you can ask questions and receive answers from the staff at Vortx and other members of the community.

If you had a user account on our previous forums website, you will need to register a new account here.

Learn more about...


PromotionEditor error - Object reference not set to an instance of an object

After you add a Promotion and then go back in to Edit the promotion, you will get the error

Object reference not set to an instance of an object

Line 52 of PromotionEditor.aspx.cs

50    protected void gridPromotions_SelectedIndexChanged(Object sender, EventArgs e)
51    {
52        Int32 id = (Int32)gridPromotions.SelectedPersistedDataKey.Value;
53        EditForm(id);
54    }


System.NullReferenceException was unhandled by user code
  Message=Object reference not set to an instance of an object.
       at _PromotionEditor.gridPromotions_SelectedIndexChanged(Object sender, EventArgs e) in e:\web\tfs\storefronts - live\store\After Dark - 125538\Web\sadmin\PromotionEditor.aspx.cs:line 52
       at System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup)
       at System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e)
       at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)



asked Sep 26, 2013 in MultiStore by Mikecali (1,525 points)
retagged Oct 16, 2013 by Mikecali

2 Answers

0 votes
Hi Mike,

Are you running the site under .NET 4.0? I have noted this error as well when doing so, and it works correctly under 3.5SP1

This is a ticket in our internal development queue for consideration.
answered Sep 27, 2013 by Vortx Erik (3,670 points)
yes. I thought 9.4 was ready for .net 4

think i could get a fix? i don't really want to move from 4. (is Matt around?...*smile*)
This is a brand new bug discovered this week, so no development effort has been expended yet. At this time we don't have a fix.
A potential workaround though would be to reset the site to use 3.5 (just save your 4.0 web.config and replace with the stock 3.5 version, updated for other changes you may have, and set the app pool to v2.0 Classic), then edit your promos, and switch the site back to 4.0 when ready.

if you keep it on .NET 4.0 and modify the site (right click website in VS and choose Property Pages) to "Target Framework" = .NET Framework 3.5
it works

i tried to find a solution for it, but I couldn't
0 votes

figured it out!!

in the PromotionEditor.aspx

add EnablePersistedSelection="true"

to the line 26

            <asp:GridView ID="gridPromotions" runat="server" DataSourceID="PromotionDataSource" EnablePersistedSelection="true"
                DataKeyNames="Id" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true"
                PageSize="10" OnPageIndexChanged="gridPromotions_PageChanged" OnSelectedIndexChanged="gridPromotions_SelectedIndexChanged" CellPadding="5"
                CellSpacing="0" AlternatingRowStyle-BackColor="#E2E8FA" AlternatingRowStyle-CssClass="promoGridAltRow" 
                RowStyle-CssClass="promoGridRow" BorderWidth="1" CssClass="promoGridTable">
answered Oct 16, 2013 by Mikecali (1,525 points)
Thanks for posting this solution - it resolved the issue I had perfectly.