Avatar of goodk
goodkFlag for United States of America

asked on 

I want to use the input button - How do I see the value on the form submit

this part is inside the form,

   <input type="button"  runat="server" id="t1id" value="how do you see this value if changed"  />

   <input type="button"  runat="server" id="t2id" value="how do you see this value if changed"  />

on call back,
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("id= " + HttpContext.Current.Request.Form["t1id"]);
}

the above only work for the button I click - how do I see the value if I do not click it but click t2 button?  REALIZE I AM NOT USING ASP buttons!!
ASP.NETJScript

Avatar of undefined
Last Comment
goodk
Avatar of prajapati84
prajapati84
Flag of India image

Hi goodk,

HTML button posts the values inside FORM tag except other buttons to identify which button is clicked.
But there is an alternative, you can use a input hidden field to store the value of a button.
e.g.
<input type='hidden' id='hdnB1' name='hdnB1' value='Button1 text' />
<input type='hidden' id='hdnB2' name='hdnB2' value='Button2 text' />
Avatar of goodk
goodk
Flag of United States of America image

ASKER

Hi thanks,
in my case I show the dates on button and then on the client side two buttons acquire a new date through date picker.  

When I click the submit button,  I want to use those values.

. Please help
Avatar of goodk
goodk
Flag of United States of America image

ASKER

here is my code, there are no value appear when I do response.write

<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("Date= " + HttpContext.Current.Request.Form["t"]);

    }

</script>
   

    <link href="../jquery/jquery-Calendar.css" rel="stylesheet" type="text/css" />
    <script src="../jquery/jquery-1.5.2.js" type="text/javascript"></script>
    <script src="../jquery/jquery-ui-1.8.9.js" type="text/javascript"></script>  <script type="text/javascript">
        $(document).ready(function() {
            $("#datepicker").datepicker();
        });

        $(document).ready(function() {
            $("#t").datepicker();
        });
       
       
       
    </script>

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

    <input type="button" name="t" runat="server" id="t" value="04/04/2011" onclick='$( "#t" ).datepicker( "show");' />
    <asp:Button ID="Button1" runat="server" Text="Button" />
     </form>
</body>
</html>
Avatar of goodk
goodk
Flag of United States of America image

ASKER

I kind of figured out that I have to equate hidden fields to displayed button field,  so I did the following.

I am facing a small problem though.  when I use the master page, and the form is located in it. It is not working, that is it does not know form1?

How to resolve this?

   
    function submitform() {

            form1.hCal1.value = form1.Cal1.value;
            form1.hCal2.value = form1.Cal2.value;
            document.form1.submit();

        }  
Avatar of goodk
goodk
Flag of United States of America image

ASKER


I HAD TO USE aspnetForm for the form name - WHAT THE HELL this asp.net is?????

even though the name of my form is form1 - Where are the experts??
Avatar of goodk
goodk
Flag of United States of America image

ASKER

basically, I am asking how the form submit works when we are using the master pages
ASKER CERTIFIED SOLUTION
Avatar of prajapati84
prajapati84
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of goodk
goodk
Flag of United States of America image

ASKER

thanks, it works good!!

why take so long to responsd and help??
ASP.NET
ASP.NET

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

128K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo