xml_newbie
07-14-2010, 05:27 AM
Hi there, very new to asp/vb, please see the code below it keeps writing the response.output to the top of the page is there any way of getting it to output to a specific div, or area on the page?
aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<asp:Content>
<head>
</head>
<body>
<form id="form1" name="form1" method="post" runat="server" action="">
<br />
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile= "App_Data/jobRoles.xml"></asp:XmlDataSource>
</asp:XmlDataSource>
Please select your Job Role from the drop down list :
<p>
<asp:DropDownList ID="ddlRoles" runat="server" AutoPostBack="True">
<asp:ListItem>Please select...</asp:ListItem>
<asp:ListItem>Doctor</asp:ListItem>
<asp:ListItem>Nurse</asp:ListItem>
</asp:DropDownList>
</p>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
</asp:UpdatePanel>
</form>
<div>
</div>
</form>
</body>
</asp:Content>
aspx.vb
Imports System
Imports System.IO
Imports System.Xml
Imports System.Xml.XPath
Imports System.Xml.Xsl
Imports System.Xml.XmlDocument
Imports System.Xml.Xsl.XslCompiledTransform
Imports System.Xml.Xsl.XsltArgumentList
Partial Class _Default
Inherits System.Web.UI.Page
Dim RoleName As String
Private xslDoc As New XslCompiledTransform()
Private args As New XsltArgumentList()
Private doc As New XPathDocument(Server.MapPath("App_Data/jobs2.xml"))
Public Sub ddlRoles_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRoles.SelectedIndexChanged, UpdatePanel1.DataBinding
RoleName = ddlRoles.SelectedValue
xslStuff()
End Sub
Public Sub xslStuff()
xslDoc.Load(Server.MapPath("App_Data/jobs2.xsl"))
args.AddParam("JobSelected", "", RoleName)
xslDoc.Transform(doc, args, Response.Output)
End Sub
End Class
aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<asp:Content>
<head>
</head>
<body>
<form id="form1" name="form1" method="post" runat="server" action="">
<br />
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile= "App_Data/jobRoles.xml"></asp:XmlDataSource>
</asp:XmlDataSource>
Please select your Job Role from the drop down list :
<p>
<asp:DropDownList ID="ddlRoles" runat="server" AutoPostBack="True">
<asp:ListItem>Please select...</asp:ListItem>
<asp:ListItem>Doctor</asp:ListItem>
<asp:ListItem>Nurse</asp:ListItem>
</asp:DropDownList>
</p>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
</asp:UpdatePanel>
</form>
<div>
</div>
</form>
</body>
</asp:Content>
aspx.vb
Imports System
Imports System.IO
Imports System.Xml
Imports System.Xml.XPath
Imports System.Xml.Xsl
Imports System.Xml.XmlDocument
Imports System.Xml.Xsl.XslCompiledTransform
Imports System.Xml.Xsl.XsltArgumentList
Partial Class _Default
Inherits System.Web.UI.Page
Dim RoleName As String
Private xslDoc As New XslCompiledTransform()
Private args As New XsltArgumentList()
Private doc As New XPathDocument(Server.MapPath("App_Data/jobs2.xml"))
Public Sub ddlRoles_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRoles.SelectedIndexChanged, UpdatePanel1.DataBinding
RoleName = ddlRoles.SelectedValue
xslStuff()
End Sub
Public Sub xslStuff()
xslDoc.Load(Server.MapPath("App_Data/jobs2.xsl"))
args.AddParam("JobSelected", "", RoleName)
xslDoc.Transform(doc, args, Response.Output)
End Sub
End Class