protected void lbDownloadQuiz_Click(object sender, EventArgs e) { LinkButton linkUpdate = sender as LinkButton; GridViewRow grid = (GridViewRow)linkUpdate.NamingContainer; string tempID = gvViewQuiz.DataKeys[grid.RowIndex].Value.ToString(); ViewState["tempId"] = tempID; RenderXML RX = new RenderXML(); DataSet ds = RX.XMLContent(tempID); XmlDoc.LoadXml(ds.Tables[0].Rows[0]["XmlFile"].ToString()); //string QuizTitle = gvViewQuiz.SelectedRow.Cells[3].Text; string filePath = Server.MapPath(DateTime.Now.ToString("yyyyMMddHHmmss") + ".xqz"); XmlDoc.Save(filePath); string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".xqz"; Response.AppendHeader("content-disposition", "attachment; filename=" + fileName); string type = ""; if (type != "") { Response.ContentType = type; } Response.WriteFile(filePath); Response.End(); XmlDoc.Save(Response.OutputStream); }
protected void lbViewQuiz_Click(object sender, EventArgs e) { LinkButton linkUpdate = sender as LinkButton; GridViewRow grid = (GridViewRow)linkUpdate.NamingContainer; string tempID = gvIssuedQuizes.DataKeys[grid.RowIndex].Value.ToString(); ViewState["tempId"] = tempID; RenderXML RX = new RenderXML(); DataSet ds = RX.XMLContent(tempID); XmlDoc.LoadXml(ds.Tables[0].Rows[0]["XmlFile"].ToString()); ns = new XmlNamespaceManager(XmlDoc.NameTable); ns.AddNamespace("ns", "urn:Question-Schema"); string xpath = "/ns:Quiz"; XmlNodeList QuizNode = XmlDoc.SelectNodes(xpath, ns); DLExamDemo.DataSource = QuizNode; DLExamDemo.DataBind(); DLExamDemoFillBlanks.DataSource = QuizNode; DLExamDemoFillBlanks.DataBind(); DLExamDemoTrueFalse.DataSource = QuizNode; DLExamDemoTrueFalse.DataBind(); MPE1.Show(); }
private void ViewQuizPopUp() { RenderXML RX = new RenderXML(); DataSet ds = RX.XMLContent(ddlVersion.SelectedValue.ToString()); XmlDoc.LoadXml(ds.Tables[0].Rows[0]["XmlFile"].ToString()); ns = new XmlNamespaceManager(XmlDoc.NameTable); ns.AddNamespace("ns", "urn:Question-Schema"); string xpath = "/ns:Quiz"; XmlNodeList QuizNode = XmlDoc.SelectNodes(xpath, ns); //string x= XmlDoc.InnerXml; //DataSet ds1 = new DataSet(); //ds1.ReadXml(new StringReader(x)); // string serverPath = Server.MapPath(".") + "\\XSLT_Files\\"; // XmlDataSource xmlDS = new XmlDataSource(); // xmlDS.Data = XmlDoc.OuterXml; //xmlDS.TransformFile = serverPath + "QuestionX.xslt"; // xmlDS.XPath = "Quiz"; DLExamDemo.DataSource = QuizNode; DLExamDemo.DataBind(); DLExamDemoFillBlanks.DataSource = QuizNode; DLExamDemoFillBlanks.DataBind(); DLExamDemoTrueFalse.DataSource = QuizNode; DLExamDemoTrueFalse.DataBind(); MPE1.Show(); }