Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET MVC
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 2-Apr-13 21:54pm

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

  Print Answers RSS
0 OriginalGriff 7,853
1 Sergey Alexandrovich Kryukov 7,107
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,790


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 3 Apr 2013
Copyright © CodeProject, 1999-2014
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