473,508 Members | 2,329 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 2053
"LIN" <ju******************@football.com> wrote in message
news:uw**************@TK2MSFTNGP09.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***********@surfcontrol.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**************@TK2MSFTNGP12.phx.gbl...
"LIN" <ju******************@football.com> wrote in message
news:uw**************@TK2MSFTNGP09.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***********@surfcontrol.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**************@TK2MSFTNGP09.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(ByVal sender As System.Object, ByVal e As System.EventArgs) 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**************@TK2MSFTNGP09.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.net> wrote in message
news:e6**************@tk2msftngp13.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**************@TK2MSFTNGP09.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**************@TK2MSFTNGP10.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(ByVal sender As System.Object, ByVal e As

System.EventArgs) 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:ImageButton id="ImageButton1" runat="server" ImageUrl="image1.jpg" />
<asp:ImageButton id="ImageButton2" runat="server" ImageUrl="image2.jpg" />

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

Private Sub ImageButton1_Click(ByVal sender As System.Object, _
ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click

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

Private Sub ImageButton2_Click(ByVal sender As System.Object, _
ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click

Dim myImageButton As ImageButton = CType(sender, ImageButton)
Dim myImageButtonID As String = myImageButton.ID
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**************@TK2MSFTNGP10.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(ByVal sender As System.Object, ByVal e As

System.EventArgs) 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
4246
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...
3
3520
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...
3
5372
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...
5
2441
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...
10
2877
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...
9
3127
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...
8
5064
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...
13
69979
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...
8
2263
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...
1
9692
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...
0
7225
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,...
1
7046
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...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
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...
0
3194
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
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...

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.