Click here to Skip to main content
15,914,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi 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

Like

[HttpPost]
public ActionResult xyz()
{
XElement xml = XElement.Load(Server.MapPath("~/XmlMaster/CompanyLocation.xml"));
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath("~/XmlMaster/CompanyLocation.xml"));
XmlElement root = xmlDoc.DocumentElement;
TempData["xml"] = xml;
TempData["xmlDoc"] = xmlDoc;
Session["FileName"] = "CompanyLocation.xml";
FirmographicInformation();
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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900