Click here to Skip to main content
13,090,446 members (41,942 online)
Rate this:
Please Sign up or sign in to vote.
See more:
currently I am working on one project this project in ASP.NETMVC based .
so need some assistance about bellow details

I have designed 1 View , and that view contains 3 html dropdown

these 3 dorpdown fill based one first dopdown option selection
like if i select 1st dropdown option then fill 2nd dropdown same as third dropdown.

my problem is that

when i am selecting third drop-down option then have called to XYZ controller method


public ActionResult xyz()
XElement xml = XElement.Load(Server.MapPath("~/XmlMaster/CompanyLocation.xml"));
XmlDocument xmlDoc = new XmlDocument();
XmlElement root = xmlDoc.DocumentElement;
TempData["xml"] = xml;
TempData["xmlDoc"] = xmlDoc;
Session["FileName"] = "CompanyLocation.xml";
return View("FirmographicInformation");//"FirmographicInformation"
xyz method call to Index Method
public ActionResult Index()
if (Session["FileName"] != null && Session["FileName"].ToString().Trim() != "")
string filename = Session["FileName"].ToString().Trim();
XElement xml = XElement.Load(Server.MapPath("~/XmlMaster/" +filename));
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath("~/XmlMaster/" +filename));
XmlElement root = xmlDoc.DocumentElement;
TempData["xml"] = xml;
TempData["xmlDoc"] = xmlDoc;
Session["FileName"] = null;
return View();

then after disply view
here i have designed one html table with dynamically generated control based on XMl file

for eg

<% var listItems_Prefix = new List<SelectListItem>();
SelectList selectList = new SelectList(listItems_Prefix, "Value", "Text");
XElement xml = (XElement)TempData["xml"];
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc = (System.Xml.XmlDocument)TempData["xmlDoc"]; %>

if (xmlDoc != null)
System.Xml.XmlElement root = xmlDoc.DocumentElement;
System.Xml.XmlNodeList controls = root.ChildNodes;

for (int i = 0; i < controls.Count; i++)

<%:Html.TextBox(controls[i].Attributes["id"].Value.ToString().Trim(), "")%>


now my problem is that
after return on view this code not executed and dynamic controls not adding on view page, and if i refresh page then my Index controller method will recall and display my expected result

so please help me regarding on that

Thank You...
Posted 2-Apr-13 20:54pm

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 |
Web02 | 2.8.170813.1 | Last Updated 3 Apr 2013
Copyright © CodeProject, 1999-2017
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