Solved

Is it possible to call an ascx page with a javascript function?

Posted on 2004-10-15
10
1,082 Views
Last Modified: 2008-03-10
Is it possible to call an ascx page with a javascript function?

I have a footer that a programmer created in C#. The ascx page has HTML + javascripts on it. The code behing page has some C# on it.
0
Comment
Question by:dmullis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +3
10 Comments
 
LVL 28

Expert Comment

by:mmarinov
ID: 12319242
Hi dmullis,

so what do you mean by "call an ascx page with a javascript function" ?
you can drag & drop the ascx file on your aspx page and when you open the page in browse you will see the result of executed ascx file

Regards!
B..M
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12319399
are you trying to access a routine in the control?
0
 
LVL 25

Expert Comment

by:nauman_ahmed
ID: 12319962
Please explain your question in detail. To add the footer decalre the following at the top of your aspx page:

<%@ Register TagPrefix="MYWeb" TagName="Footer" Src="Footer.ascx"%>

and where you want to insert the footer, add the following lines:

<MYWeb:Footer id="Footer" runat="Server"></MYWeb:Footer>

HTH, Nauman.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:dmullis
ID: 12320203
I am not using an aspx page..that would be easy. I hate to get into the details of this because it confuses everyone and the general issue but here goes:

I have an xml page created by other programmers..I cannot "re-do" this some other way. In the xml page, it contains several pages with page ids and their specific elements like textboxes, etc. From these page id's I can call a javascript function such as onclick, onload, etc. Within each of these page ids,at the beginning of the page, there are numerous javascript functions called by the elements. I will have to use a javascript function to call the footer that resides on the ascx page..This xml page will not understand putting
 <%@ Register TagPrefix="MYWeb" TagName="Footer" Src="Footer.ascx"%> at the top of each page id.

I plan to put an onload event with each page id element..( I know how to do this in the XML. I know how to position the footer on each page id.). The onload event should call a javascript function that calls my ascx page. I need to know if javascript can call an ascx page and if this is possible,how to tell the javascript function to call the ascx page.
0
 
LVL 28

Expert Comment

by:mmarinov
ID: 12320265
Man, I don't think it is possible
ascx files are something like the #include directive in the old asp , so ...

B..M
0
 
LVL 3

Expert Comment

by:nitrogenx
ID: 12325663
hmm, im not quite sure if i understand your question, but if you are trying to get javascript to interact with aspx you can do something like the following:

<input type=hidden id=xfer name=xfer />
<script language=javascript>
  function foo()
  {
    document.forms[0].xfer.value = something;
    submit();
  }
</script>

Then on the serverside use: string s = Request.Form["xfer"];
0
 
LVL 3

Expert Comment

by:nitrogenx
ID: 12325666
you can then have the server interpret that and do something to a
<asp:PlaceHolder Runat=server ID="PlaceHolder1"></asp:PlaceHolder>
PlaceHolder1.Controls.Add(new Footer_ascx.Footer());
0
 

Author Comment

by:dmullis
ID: 12380807
I wound up having to create a server control and do it this way, because of the deadline.

+"<td width='103'><a href='../pages/ContactUs.aspx' onMouseOut='MM_swapImgRestore()'"
+"onMouseOver='MM_swapImage('Contact US','','../images/controls/footer/contact_on.gif' ,1)'>"
+"<img name='Contact US' border='0' src='../images/controls/footer/contact_off.gif' width='119' height='43'>"
+"</a>"


I appreciate all your input.
nitogenx..you answered my other question about putting the javascript inside the above.

 Not sure what to do about points here. Moderater?
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12734852
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question