Solved

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

Posted on 2004-10-15
10
974 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
  • 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
 

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now