Click here to Skip to main content
13,557,915 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi members,

I have question.

How to fetch the data in text boxes (fields) which is already stored data in XML file by clicking uploaded button control in the form by using MVC or jQuery?

For example design:-

there are three textboxes(fields)

Name:here textbox(<input type="text" /> it is in html control)

Company: textbox
City: textbox

here buttons under these textboxes

submit uploadfile

When I click on the uploadfile then what the XML file has data then I would like to fetch the data in text box fields.

example of XML file:--

<FAddress id="1">
<Name> Fedex</Name>
<City> Hyderabad</City>

so please give me reply as soon as possible

Thank you

What I have tried:

public FromAddress GetLoad(string strpath)

            FromAddress ad = new FromAddress();
            XmlDocument objdoc = new XmlDocument();
            //str = @"C:\Users\E461\Documents\Visual Studio 2015\Projects\XCarrierMVC\XCarrierDAL\XCarrier.xml";
            XmlNodeList xlist = objdoc.GetElementsByTagName("FAddress");
            foreach (XmlNode node in xlist)

                ad.Name = node.ChildNodes[0].InnerText;
                ad.Company = node.ChildNodes[1].InnerText;
                ad.City = node.ChildNodes[2].InnerText;
            return ad;
Posted 21-Apr-17 3:13am
Updated 21-Apr-17 6:11am
NotPolitcallyCorrect 21-Apr-17 9:52am
"please give me reply as soon as possible", a reply to what? A reply to this code that you didn't describe a problem with?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


public ActionResult GetData() {
            var data = GetLoad("path");
               return Json(data);


<script src="~/Scripts/jquery-1.8.2.js"></script>
        type: "POST",
        url: '@Url.Action("GetData", "YourControllerName")',
        contentType: "application/json; charset=utf-8",        
        dataType: "json",
        success: function (data) {
            if (data) {
        error: function (a, b, c) {
            alert("error:", a, b, c);

<input type="text" id="txtName" />
<input type="text" id="txtCity" />
<input type="text" id="txtCompany"  />

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.180515.1 | Last Updated 21 Apr 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100