J
john
Working in Visual Studio
Objective: I am trying to have my server side vb code construct a file name
for use with my client side JavaScript code to then save the file to the
web. My saving to the web method is working with a preset test filename.
The issue I have is that when I put this JavaScript in the source code of an
asp:content holder of a masterpage container, it is not able to see any
server side controls, one of which is returning my filename I want to use.
In a standard HTML page where I worked out the code method it works fine, so
I know the method works.
It is only in asp:content page, where there is no HTML that I cannot read
the server side control.
I can read a HTMLInputText control in the asp:content page so long as it is
not set to runat="server", but then my server side vb code cannot see it to
write my file name to it for use with the JavaScript code.
I either need a way to read the server side control from the asp:content
page with JavaScript, or write to the HTMLInputText control not set to
runat="server" when the server responds, or a different approach that allows
me to get my filename in a way that the JavaScript can read it.
Thank you for any help,
John
Here is a snippet of the code up to where the error on page occurs:
<%@ Page Language="VB" MasterPageFile="MasterPage.master"
AutoEventWireup="false" MaintainScrollPositionOnPostback ="true"
CodeFile="APcontent.aspx.vb" Inherits="APcontent" title="Accounts Payable"
%>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<script language="javascript" type="text/javascript">
// <!CDATA[
function File1_onclick() {
var Var1 = document.getElementById("TextBox1").value; 'ERROR OCCURS HERE
document.write(Var1);
//File saving code is here.
}
// ]]>
</script>
<asp:TextBox ID="TextBox1" runat="server"
Width="472px"></asp:TextBox>
</asp:Content>
Objective: I am trying to have my server side vb code construct a file name
for use with my client side JavaScript code to then save the file to the
web. My saving to the web method is working with a preset test filename.
The issue I have is that when I put this JavaScript in the source code of an
asp:content holder of a masterpage container, it is not able to see any
server side controls, one of which is returning my filename I want to use.
In a standard HTML page where I worked out the code method it works fine, so
I know the method works.
It is only in asp:content page, where there is no HTML that I cannot read
the server side control.
I can read a HTMLInputText control in the asp:content page so long as it is
not set to runat="server", but then my server side vb code cannot see it to
write my file name to it for use with the JavaScript code.
I either need a way to read the server side control from the asp:content
page with JavaScript, or write to the HTMLInputText control not set to
runat="server" when the server responds, or a different approach that allows
me to get my filename in a way that the JavaScript can read it.
Thank you for any help,
John
Here is a snippet of the code up to where the error on page occurs:
<%@ Page Language="VB" MasterPageFile="MasterPage.master"
AutoEventWireup="false" MaintainScrollPositionOnPostback ="true"
CodeFile="APcontent.aspx.vb" Inherits="APcontent" title="Accounts Payable"
%>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<script language="javascript" type="text/javascript">
// <!CDATA[
function File1_onclick() {
var Var1 = document.getElementById("TextBox1").value; 'ERROR OCCURS HERE
document.write(Var1);
//File saving code is here.
}
// ]]>
</script>
<asp:TextBox ID="TextBox1" runat="server"
Width="472px"></asp:TextBox>
</asp:Content>