且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何访问“动作”在使用母版页的asp.net页面上的表单标签上

更新时间:2023-12-03 10:20:52

从客户端,您可以访问它:

  document  .getElementById(  myForm)。action 





  document  .forms [ 0 ]。action 



(大多数页面都有单一表格但如果你有更多的调整索引!)

从服务器端可以这样做:

 MyPage.Form.Action 


I am using following file uploader in asp.net page "https://github.com/blueimp/jQuery-File-Upload"
FileUpld.aspx page :

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div id="fileupload">
<form action="../WebServices/SFileUpload.ashx" method="POST" enctype="multipart/form-data" >



MasterPage :

<body>
    <form id="form1" runat="server" >



Here as you can see master page and .aspx page both contains form tag. I want to access "action" of <form> from .aspx page. But when I am trying to do the same, its searching in master page for "action". Above .aspx page inherits same master page. Can anyone please tell me how can I access "SFileUpload.ashx" ?

From the client side you can access it like:
document.getElementById("myForm").action


or

document.forms[0].action 


(Most pages hav a single form but if you have more adjust index!)
From the server side it can be done like this:

MyPage.Form.Action