Ask a Question related to ASP.NET General, Design and Development.
-
LIN #1
asp.net form post
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 .....
LIN Guest
-
redirect but with post data - mimick form post behaviour
Any thoughts on how to mimic result of submitting form data via POST Method? I have some code that sanitizes some submitted formfields and i'd like... -
How do I POST without a form?
$name="Bozo The Clown"; $AddressCity="New York City"; How would I "simulate" a POST of those two variables to your web site without having an... -
How to post some data in form of POST action of forms in asp?
Hi there, I need to post some information into an ASP page (mypage.asp), in form of POST action which I do with the following code: 'contents... -
Re-POST a form using ASP
Sure, build a form that posts to itself, and loop through the form collection and put an input type=hidden for each element (except the element(s)... -
ASP, FORMS, POST METHOD And Post with out form(???)
Lets see if I can decribe, this... I have a form on an html page, that will call a remote site with a post method. Prior to running off to the... -
John Saunders #2
Re: asp.net form post
"LIN" <junkvaluesnotallowed@football.com> wrote in message
news:uwJxI5lXDHA.2620@TK2MSFTNGP09.phx.gbl...ech> hii im working on asp.net and i have a form which has 4 asp.net buttonshelp> 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 wouldWhy not simply handle the Click events for all four buttons?> me to write button specific events on tht page ....can any one help out in
> this .....
--
John Saunders
Internet Engineer
[email]john.saunders@surfcontrol.com[/email]
John Saunders Guest
-
LIN #3
Re: asp.net form post
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" <john.saunders@surfcontrol.com> wrote in message
news:uW45F7lXDHA.2352@TK2MSFTNGP12.phx.gbl...pageload> "LIN" <junkvaluesnotallowed@football.com> wrote in message
> news:uwJxI5lXDHA.2620@TK2MSFTNGP09.phx.gbl...> ech> > hii im working on asp.net and i have a form which has 4 asp.net buttons> > time i click on a button the page is posted now i want to know onin> help> > which button has caused the post action.. of the page ...this is would> > me to write button specific events on tht page ....can any one help out>> > this .....
> Why not simply handle the Click events for all four buttons?
> --
> John Saunders
> Internet Engineer
> [email]john.saunders@surfcontrol.com[/email]
>
>
LIN Guest
-
Carl Prothman [MVP] #4
Re: asp.net form post
"LIN" <junkvaluesnotallowed@football.com> wrote
Lin,> 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..
>
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
[url]http://www.able-consulting.com[/url]
Carl Prothman [MVP] Guest
-
Steve C. Orr, MCSD #5
Re: asp.net form post
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
[url]http://Steve.Orr.net[/url]
"LIN" <junkvaluesnotallowed@football.com> wrote in message
news:uwJxI5lXDHA.2620@TK2MSFTNGP09.phx.gbl...ech> hii im working on asp.net and i have a form which has 4 asp.net buttonshelp> 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> me to write button specific events on tht page ....can any one help out in
> this .....
>
>
Steve C. Orr, MCSD Guest
-
LIN #6
Re: asp.net form post
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" <Steve@Orr.net> wrote in message
news:e6xtuhqXDHA.3724@tk2msftngp13.phx.gbl...postback.> 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 thepageload>
> --
> I hope this helps,
> Steve C. Orr, MCSD
> [url]http://Steve.Orr.net[/url]
>
>
> "LIN" <junkvaluesnotallowed@football.com> wrote in message
> news:uwJxI5lXDHA.2620@TK2MSFTNGP09.phx.gbl...> ech> > hii im working on asp.net and i have a form which has 4 asp.net buttons> > time i click on a button the page is posted now i want to know onin> help> > which button has caused the post action.. of the page ...this is would> > me to write button specific events on tht page ....can any one help out>> > this .....
> >
> >
>
LIN Guest
-
LIN #7
Re: asp.net form post
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]" <carlpr@spamcop.net> wrote in message
news:#1OzCXoXDHA.1640@TK2MSFTNGP10.phx.gbl...the> "LIN" <junkvaluesnotallowed@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 whenwhich> > form is posted i.e after the button is being clicked..I want to knowSystem.EventArgs) Handles Button1.Click>> > 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> 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
> [url]http://www.able-consulting.com[/url]
>
>
>
>
LIN Guest
-
Carl Prothman [MVP] #8
Re: asp.net form post
"LIN" <junkvaluesnotallowed@football.com> wrote
Given two ImageButton WebControls> 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
>
<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
[url]http://www.able-consulting.com[/url]
> thanx
>
>
> "Carl Prothman [MVP]" <carlpr@spamcop.net> wrote in message
> news:#1OzCXoXDHA.1640@TK2MSFTNGP10.phx.gbl...> the> > "LIN" <junkvaluesnotallowed@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> which> > > form is posted i.e after the button is being clicked..I want to know> System.EventArgs) Handles Button1.Click> >> > > 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>> > 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
> > [url]http://www.able-consulting.com[/url]
> >
> >
> >
> >
>
Carl Prothman [MVP] Guest



Reply With Quote

