Click here to Skip to main content
13,197,767 members (40,271 online)
Rate this:
Please Sign up or sign in to vote.
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?
Posted 6-Dec-12 22:45pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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
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.
pradiprenushe 7-Dec-12 6:08am
you may have specified it somewhere
Member 7781963 7-Dec-12 6:09am
Nope. I just selected the master page while creating the content page.
Member 7781963 7-Dec-12 6:09am
<%@ Page Title="" Language="VB" MasterPageFile="~/Memories/Memories.master" AutoEventWireup="false"
CodeFile="CreateAlbums.aspx.vb" Inherits="Memories_CreateAlbums" %>
pradiprenushe 7-Dec-12 6:12am
in master page or code somewhere
pradiprenushe 7-Dec-12 6:17am
Look for this links

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171020.1 | Last Updated 7 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100