Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mario Bagnara on Jun 15, 2007 16:45
open dhtmlx forum
Error as execute response.End on a page with masterPage (VS2005)

Im trying to implement your grid in VS2005, and it seems to work fine. The page is not part of a master page. The same code placed on a page using MasterPage does not work. I get the following error:

{Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}

The errors triggers when executed the sentence Response.End int the code below.

Any help would be greatly appreciated!!


protected void createXmlForGrid(System.Xml.XPath.XPathNavigator nav)
{
Response.AddHeader("Content-type", "text/xml");

Int16 index = 1;
XmlWriter wr = XmlWriter.Create(Response.OutputStream);
XPathExpression exp;
XPathNodeIterator iterator;
exp = nav.Compile("rows/item");
iterator = nav.Select(exp);

wr.WriteStartElement("rows");

while (iterator.MoveNext())
{

//-- Número de fila
wr.WriteStartElement("row");
wr.WriteStartAttribute("id");
wr.WriteString(index.ToString());
wr.WriteEndAttribute();

//-- registros de la fila
wr.WriteStartElement("cell");
wr.WriteString(index.ToString());
wr.WriteEndElement();

createNewNode(iterator, wr, "@idproduct")
createNewNode(iterator, wr, "@idorigin")
createNewNode(iterator, wr, "@deliverydate")

//-- Numero de fila
wr.WriteEndElement();

index += 1;
}

wr.WriteEndElement();
wr.Close();

Response.End();


}

private void createNewNode(XPathNodeIterator iterator, XmlWriter wr, string xmlField)
{
if ((iterator.Current.SelectSingleNode(xmlField) != null))
{
wr.WriteStartElement("cell");
wr.WriteString(iterator.Current.SelectSingleNode(xmlField).InnerXml);
wr.WriteEndElement();
}
}

Answer posted on Jun 18, 2007 15:35
I'm not sure, but it seems that your code generates data XML and sends it back, while it fully correct it can't be included as part of default HTML form, because they generate fully separated content, that is why .NET show described error.

The problem is outside of component, so unfortunately I can't help you ( it seems for me that such pages, which generates non-html content must not be included as parts of other pages, but my knowledge in .Net area are far from perfect )
Answer posted by radyno (Support) on Dec 06, 2014 08:22

Not much can be said in addition to the reply above, but you also can check asp.net event calendar application and javascript for tab control and find out what we have probably missed in our explanation.