Click here to Skip to main content
15,662,426 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
This is my Form Tag from The Master Page:

<form id="form1" runat="server" action="Handler.ashx" method="POST" enctype="multipart/form-data">

I have a TextBox in my Content Page:

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

I want to access the TextBox value in the Handler.ashx page Or Send the TextBox value as a query string in the action attribute like this
<form id="form1" runat="server" action="Handler.ashx?textBoxVal=SOMETHING" method="POST" enctype="multipart/form-data">

Is this possible?

1 solution

Try this

<script type="text/javascript">
  window.onload = function() {
	document.FormName.onsubmit = submitForm;

 function submitForm() {
	this.action = "http://Handler.ashx?textbox" + value;

<form id="form1" runat="server" method="POST" enctype="multipart/form-data">

Refer this
Share this answer
Member 7781963 7-Dec-12 5:26am    
What is FormName here?
pradiprenushe 7-Dec-12 5:44am    
It is id or name of form replace statement with this
Member 7781963 7-Dec-12 5:45am    
where do i use this script?? Master Page or Content Page??
pradiprenushe 7-Dec-12 5:49am    
In master page & to get textbox from content page
refer this link
Member 7781963 7-Dec-12 6:01am    
I tried your solution , but i get the Content Page Name(action="Album.aspx") in the action attribute with your solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900