[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1215
  • Last Modified:

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

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
dmullis
Asked:
dmullis
  • 2
  • 2
  • 2
  • +3
1 Solution
 
mmarinovCommented:
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
 
AerosSagaCommented:
are you trying to access a routine in the control?
0
 
nauman_ahmedCommented:
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
Independent Software Vendors: 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!

 
dmullisAuthor Commented:
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
 
mmarinovCommented:
Man, I don't think it is possible
ascx files are something like the #include directive in the old asp , so ...

B..M
0
 
nitrogenxCommented:
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
 
nitrogenxCommented:
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
 
dmullisAuthor Commented:
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
 
moduloCommented:
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!

  • 2
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now