Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 941753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:09:52+00:00 2026-05-15T22:09:52+00:00

With this code I have error: Object reference not set to an instance of

  • 0

With this code I have error:

Object reference not set to an instance of an object

<% using (Html.BeginForm("XMLDevicesAddFirmware","ImportXML",FormMethod.Post)) {%>

<table class="data-table">
    <tr>
        <th>Article Number</th>
        <th>Firmware</th>
        <th>Name</th>
        <th>Order Id</th>
        <th>Software Version</th>
    </tr>

<% int rb = 1;%>

<% foreach (var item in Model) { %>
    <tr>
        <td><%= Html.Encode(item.ArticleNumber) %></td>
        <td><input id="Firmware" name="<%= Html.Encode(rb)%>" type="text" /></td>
        <td><%= Html.Encode(item.Name) %></td>
        <td><%= Html.Encode(item.OrderId) %></td>
        <td><input id="SoftwareVersion" name="<%= Html.Encode(rb)%>" type="text" /></td>
    </tr>
   <% rb = rb + 1;%>
   <% } %>

</table>
<p>
    <input type="submit" value="Finish" />
</p>
<% } %>


public ActionResult XMLDevicesAddFirmware()
{
    var dev = from i in XMLEntities.unassigneditems
              where i.DevOrAcc == true
              select i;
    return View(dev);
}



[AcceptVerbs(HttpVerbs.Post)]
public ActionResult XMLDevicesAddFirmware(FormCollection col)
{
    //....
    return View();
}

Stack Trace:

 [NullReferenceException: Object reference not set to an instance of an object.]
 ASP.views_importxml_xmldevicesaddfirmware_aspx.__RenderContent2(HtmlTextWriter __w,     Control parameterContainer) in c:\Documents and Settings\Ognjen\My Documents\Visual Studio 2008\Projects\MvcKVteam - radna verzija_18_07\MvcKVteam - radna verzija\MvcKVteam\Views\ImportXML\XMLDevicesAddFirmware.aspx:36
 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
 System.Web.UI.Control.Render(HtmlTextWriter writer) +10
 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
 ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\Documents and Settings\Ognjen\My Documents\Visual Studio 2008\Projects\MvcKVteam - radna verzija_18_07\MvcKVteam - radna verzija\MvcKVteam\Views\Shared\Site.Master:104
 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
 System.Web.UI.Control.Render(HtmlTextWriter writer) +10
 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
 System.Web.UI.Page.Render(HtmlTextWriter writer) +29
 System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +59
 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:09:54+00:00Added an answer on May 15, 2026 at 10:09 pm

    If the model is not valid and you are unable to do execute some of your code in the

    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult XMLDevicesAddFirmware(FormCollection col)
    {
        //....
        return View();
    }
    

    you need to return same model to the View()

    return View(dev);
    

    like u did with the get action,

    otherwise the view cannot display because model is null.

    when u do return View(dev); view will render fine, and if u did ModelState.AddModelError(/**/); the view will show validation errors

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Someone can explain this error? Error Creating Control - head Object reference not set
Additional information: Object reference not set to an instance of an object. I have
I mean I have this code: <script> $(document).ready( function() { $('html, body').animate({ scrollTop: $(.error).offset().top
this is my code and have a error: $('#map_canvas').mouseover(function(e){ console.log(e.offset().left+' '+e.offset().top) }) thanks i
i have an error in this code NSString *str = @above string; //load above
I have this code and I couldn't run it because i get this error:
I have this code: ie1.link(:text, /Exception:/) It is producing an error message which I
I have this code to suppress all errors. When an error occurs a blank
I have a problem with this code: (The error is below the code) public
I get this error, while I'm testing the code below: You have an error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.