473,405 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 2051
"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
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
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
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
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
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
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
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
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
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
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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
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,...
0
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...

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.