asp.net output from a SOAP page location using response.write

152 Views Asked by At

I hope someone can help. I created a webservice and it returns XML via SOAP fine and well. It transforms fine with XSLT and I return the HTML to a ASP VB.net webform.

I call the functions in the code behind with a button.

Everything works great except the transformed output always ends up at top of the page. I return the result to a label, put the label in a different contentplaceholder but it always is on top. I want the input items(text box) and button to float at the top.

Here is the very simple main webform - plus a bit from where the results are coming from.

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="WebForm1.aspx.vb" Inherits="WS_NewCar.WebForm1" %>

    <asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <p>
        <img src="images/barner.jpg" style="width: 508px; height: 198px; margin-left: 280px" /></p>
    <p>
        &nbsp;</p>
    <p>
        <asp:TextBox ID="txtInput" runat="server"></asp:TextBox>
    </p>
        <p>
            &nbsp;</p>
        <p>
            &nbsp;</p>
    <p>
        <br />
 Click here for SOAP request. <asp:Button ID="btnConvert" runat="server" Text="Search" />

</asp:Content>

 <asp:Content ContentPlaceHolderID="MainContent" runat="server">
      <asp:Label ID="lblMake" runat="server" Text="Please enter vehicle make"></asp:Label>
</asp:Content>

       Dim sr As New StreamReader(memoryStream)

        response.Write(sr.ReadToEnd())

        sr.Close()

    End Function

    Protected Sub btnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvert.Click
        lblMake.Text = callWS(txtInput.Text)

    End Sub

1

There are 1 best solutions below

0
On

Response.Write(sr.ReadToEnd()) will always render at the top of the page. It is called before the page is rendered. Try changing it by adding a label where you want the output to appear and do the following in your page_load

label1.Text = sr.ReadToEnd()