Client side jscript issue

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.



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>
 
J

John Saunders [MVP]

You'll probably get a better response on the
microsoft.public.dotnet.framework.aspnet newsgroup.
 
S

Steven Cheng[MSFT]

Hi John,

Regarding on this issue, many community members and I have replied you in
the new thread you posted in the microsoft.public.dotnet.framework.aspnet
newsgroup.

Please have a look there and feel free to followup if there is anything
else we can help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top