473,661 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp.net form post

LIN
hii im working on asp.net and i have a form which has 4 asp.net buttons ech
time i click on a button the page is posted now i want to know on pageload
which button has caused the post action.. of the page ...this is would help
me to write button specific events on tht page ....can any one help out in
this .....
Nov 17 '05 #1
8 2062
"LIN" <ju************ ******@football .com> wrote in message
news:uw******** ******@TK2MSFTN GP09.phx.gbl...
hii im working on asp.net and i have a form which has 4 asp.net buttons ech time i click on a button the page is posted now i want to know on pageload
which button has caused the post action.. of the page ...this is would help me to write button specific events on tht page ....can any one help out in
this .....


Why not simply handle the Click events for all four buttons?
--
John Saunders
Internet Engineer
jo***********@s urfcontrol.com
Nov 17 '05 #2
LIN
im actually writing a few lines of code on the click event of the button
...thts not the problem i want to capture the name of the button wheen the
form is posted i.e after the button is being clicked..i want to know which
button has made the form to post..

"John Saunders" <jo***********@ surfcontrol.com > wrote in message
news:uW******** ******@TK2MSFTN GP12.phx.gbl...
"LIN" <ju************ ******@football .com> wrote in message
news:uw******** ******@TK2MSFTN GP09.phx.gbl...
hii im working on asp.net and i have a form which has 4 asp.net buttons

ech
time i click on a button the page is posted now i want to know on pageload which button has caused the post action.. of the page ...this is would

help
me to write button specific events on tht page ....can any one help out in this .....


Why not simply handle the Click events for all four buttons?
--
John Saunders
Internet Engineer
jo***********@s urfcontrol.com

Nov 17 '05 #3
From within your Page_Load event you can look for the names of the buttons
in the Request.Form collection.
If the button name is present then you know that button caused the postback.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"LIN" <ju************ ******@football .com> wrote in message
news:uw******** ******@TK2MSFTN GP09.phx.gbl...
hii im working on asp.net and i have a form which has 4 asp.net buttons ech time i click on a button the page is posted now i want to know on pageload
which button has caused the post action.. of the page ...this is would help me to write button specific events on tht page ....can any one help out in
this .....

Nov 17 '05 #4
"LIN" <ju************ ******@football .com> wrote
im actually writing a few lines of code on the click event of the button
..that is not the problem I want to capture the name of the button when the
form is posted i.e after the button is being clicked..I want to know which
button has made the form to post..


Lin,
Given a Button WebControl
<asp:Button id="Button1" Runat="server" Text="Button1"> </asp:Button>

You can get the Button ID and Text as follows:

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
Dim myButton As Button = CType(sender, Button)
Dim myButtonID As String = myButton.ID
Dim myButtonName As String = myButton.Text
End Sub

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com


Nov 17 '05 #5
From within your Page_Load event you can look for the names of the buttons
in the Request.Form collection.
If the button name is present then you know that button caused the postback.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"LIN" <ju************ ******@football .com> wrote in message
news:uw******** ******@TK2MSFTN GP09.phx.gbl...
hii im working on asp.net and i have a form which has 4 asp.net buttons ech time i click on a button the page is posted now i want to know on pageload
which button has caused the post action.. of the page ...this is would help me to write button specific events on tht page ....can any one help out in
this .....

Nov 17 '05 #6
LIN
ok now i can find the button in the request.form on page load section ...for
wht do i check it for ....
pls note tht the button im using here is image button..pls lemme know

thanx
"Steve C. Orr, MCSD" <St***@Orr.ne t> wrote in message
news:e6******** ******@tk2msftn gp13.phx.gbl...
From within your Page_Load event you can look for the names of the buttons
in the Request.Form collection.
If the button name is present then you know that button caused the postback.
--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"LIN" <ju************ ******@football .com> wrote in message
news:uw******** ******@TK2MSFTN GP09.phx.gbl...
hii im working on asp.net and i have a form which has 4 asp.net buttons

ech
time i click on a button the page is posted now i want to know on pageload which button has caused the post action.. of the page ...this is would

help
me to write button specific events on tht page ....can any one help out in this .....


Nov 17 '05 #7
LIN
hii this is working for only a single button when i have more than a single
button and write the same code below ..both the button's are getting
executed ....i.e i get the messages from both the buttons ...wht do i do
now ..and one more thing the button im using here is an image button and not
a normal button

thanx
"Carl Prothman [MVP]" <ca****@spamcop .net> wrote in message
news:#1******** ******@TK2MSFTN GP10.phx.gbl...
"LIN" <ju************ ******@football .com> wrote
im actually writing a few lines of code on the click event of the button
..that is not the problem I want to capture the name of the button when the form is posted i.e after the button is being clicked..I want to know which button has made the form to post..

Lin,
Given a Button WebControl
<asp:Button id="Button1" Runat="server" Text="Button1"> </asp:Button>

You can get the Button ID and Text as follows:

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As

System.EventArg s) Handles Button1.Click Dim myButton As Button = CType(sender, Button)
Dim myButtonID As String = myButton.ID
Dim myButtonName As String = myButton.Text
End Sub

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com

Nov 17 '05 #8
"LIN" <ju************ ******@football .com> wrote
hii this is working for only a single button when i have more than a single
button and write the same code below ..both the button's are getting
executed ....i.e i get the messages from both the buttons ...wht do i do
now ..
and one more thing the button im using here is an image button and not
a normal button

Given two ImageButton WebControls

<asp:ImageButto n id="ImageButton 1" runat="server" ImageUrl="image 1.jpg" />
<asp:ImageButto n id="ImageButton 2" runat="server" ImageUrl="image 2.jpg" />

The events handlers (and code to get each ID) looks like:

Private Sub ImageButton1_Cl ick(ByVal sender As System.Object, _
ByVal e As System.Web.UI.I mageClickEventA rgs) Handles ImageButton1.Cl ick

Dim myImageButton As ImageButton = CType(sender, ImageButton)
Dim myImageButtonID As String = myImageButton.I D
End Sub

Private Sub ImageButton2_Cl ick(ByVal sender As System.Object, _
ByVal e As System.Web.UI.I mageClickEventA rgs) Handles ImageButton2.Cl ick

Dim myImageButton As ImageButton = CType(sender, ImageButton)
Dim myImageButtonID As String = myImageButton.I D
End Sub

When you click on a single ImageButton, the corresponding click event handler fires,
not both. If you are seeing both click event handlers fire for a single click on one of
the ImageButton, then post some sample code which repros the problem.

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com

thanx
"Carl Prothman [MVP]" <ca****@spamcop .net> wrote in message
news:#1******** ******@TK2MSFTN GP10.phx.gbl...
"LIN" <ju************ ******@football .com> wrote
im actually writing a few lines of code on the click event of the button
..that is not the problem I want to capture the name of the button when the form is posted i.e after the button is being clicked..I want to know which button has made the form to post..


Lin,
Given a Button WebControl
<asp:Button id="Button1" Runat="server" Text="Button1"> </asp:Button>

You can get the Button ID and Text as follows:

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As

System.EventArg s) Handles Button1.Click
Dim myButton As Button = CType(sender, Button)
Dim myButtonID As String = myButton.ID
Dim myButtonName As String = myButton.Text
End Sub

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com


Nov 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4251
by: TG | last post by:
Dear PHP Group, I have two forms that are used to collect user information. The first one takes user inputted values such as fullname, city, address etc. I want these values to display in the second form when it is called. Both forms are .htm files that call themselves when the submit button is press via the following command in each form: <form method="post" action="<?php $server?>">
3
3532
by: sammmista | last post by:
hello experts, Plz dont treat this as another newbie query , i did my homework but still getting nowhere :( :( :( Trying to learn PHP on Fedora core 1 (PHP 4.3,MySQL,HTTPD).Unable to post data from html form to php file(connecting to mysql database and inserting into a table) . This seemingly simple problem is making me go mad !!! I googled extensively and already tried the following
3
5383
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says there is a sample file called Ixtrasp.asp, but I could not find it in my system although I installed indexing service. I followed the steps in MSDN site to create a basic .asp query form (too long to post it here), but it always displays: No...
5
2449
by: Paxton | last post by:
I created an html email containing a form whose method is POST. The form is posted to an asp page for processing, but no values are retrieved. So I response.write all the Request.Form fields, and nothing appears. I change the form's method to GET, then response.write the Request.QueryString items (which I can see in the URL) and it works fine. I need to use POST, as the quantity of data from the form will often exceed the limits of...
10
2897
by: Noozer | last post by:
Below is some ASP, HTML and javascript. It is part of a page used to maintain a small database. This code did work at one time, but has since stopped. For some reason the data on my form is not being passed to the page specified in the Action property of the form. This is on a Windows 2000 Pro PC. I copied the code to another server (Windows XP Pro machine) and it DOES work as expected there. The first block is the data located near...
9
3142
by: eswanson | last post by:
I have a web page I need to post a file plus some other fields to it. How can I do this from a asp.net page. I know I can send individual fields to the other page, but how do I send a file to the other page, or is there something else like a stream which will be like a file. I am attempting to get a way from writing out a file and then having to give the page that I am posting to the file name. Instead I would like to just from asp.net...
8
5076
by: Gert | last post by:
Hi, I have a form (server side) because of the filling of variables through the application. But now I need to post it to an url on submit. My .HTML form looks like this, but how to translate it to asp.net vb code? !--<FORM ACTION="/test/test.php" METHOD=POST>--> <form action="https://multipay.net/transaction/mpmain.php" method="post"> ....
13
69994
by: deko | last post by:
I have a basic feedback form with a submit button. After the "send" button is clicked, I want the user to be redirected to a different page that says "Your message has been sent." How do I do this? I've tried using: header("Location:http://www.mysite.com/send-confirm.php");
8
2281
by: Theadmin77 | last post by:
Ok ,i have to create a page to allow entry of user information;all fields must be validated and error displayed otherwise * First Name (limit 25 characters) * Last Name (limit 25 characters) * Street Address (limit 45 characters) * City (limit 25 characters) * State (2 character code ) * Zip Code (5 digits only, must be numeric) * Date of Birth (mm/dd/yyyy format, day, month, and year must be valid)
1
9754
by: starter08 | last post by:
Hi, I have a C++ routine(client-side) which uploads an xml file to a web server by making a socket connection and sending all the post request through that socket. On the server side I have a cgi script which receives all the data and creates a file in the specified directory. If I am uploading only the file all works well, however I want to send data of other fields too (field1, field2 ..etc), this fails the post request and even the file is...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8754
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8542
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2760
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1740
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.