473,898 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Postback control?

Is there anyway to find out which control fired the postback in server-side
code?
Like in windows programming "Form.ActiveCon trol" ?
Nov 18 '05 #1
5 1497
You can peak under the covers and take a look at
Request.Form["__EVENTTAR GET"]

which will give you the UniqueId of the control which cause the event to
fire. If the contro was a WebControls.But ton then __EVENTTARGET will
unfortunetly be blank, but the button's unique ID will be in the
Request.Form collection...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"vbMental" <vb******@discu ssions.microsof t.com> wrote in message
news:94******** *************** ***********@mic rosoft.com...
Is there anyway to find out which control fired the postback in server-side code?
Like in windows programming "Form.ActiveCon trol" ?

Nov 18 '05 #2
Thanks, and I figured something like that but I wanted a standard .NET way to
do it.

"Karl Seguin" wrote:
You can peak under the covers and take a look at
Request.Form["__EVENTTAR GET"]

which will give you the UniqueId of the control which cause the event to
fire. If the contro was a WebControls.But ton then __EVENTTARGET will
unfortunetly be blank, but the button's unique ID will be in the
Request.Form collection...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"vbMental" <vb******@discu ssions.microsof t.com> wrote in message
news:94******** *************** ***********@mic rosoft.com...
Is there anyway to find out which control fired the postback in

server-side
code?
Like in windows programming "Form.ActiveCon trol" ?


Nov 18 '05 #3
If postback happen, it will fire corresponding post back event in the server
side. That post event will have sender as one of its parameter, with which
you can identify which control caused the postback.

But if you want it to find it in Page_Load, only option is
Request.Form["__EVENTTAR GET"]. This method will only work if your control
has autopostback property set to true

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"vbMental" <vb******@discu ssions.microsof t.com> wrote in message
news:5F******** *************** ***********@mic rosoft.com...
Thanks, and I figured something like that but I wanted a standard .NET way to do it.

"Karl Seguin" wrote:
You can peak under the covers and take a look at
Request.Form["__EVENTTAR GET"]

which will give you the UniqueId of the control which cause the event to
fire. If the contro was a WebControls.But ton then __EVENTTARGET will
unfortunetly be blank, but the button's unique ID will be in the
Request.Form collection...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"vbMental" <vb******@discu ssions.microsof t.com> wrote in message
news:94******** *************** ***********@mic rosoft.com...
Is there anyway to find out which control fired the postback in

server-side
code?
Like in windows programming "Form.ActiveCon trol" ?


Nov 18 '05 #4
I understand all that but wouldnt it be nice to just have a property of the
page called Postback control that would be the control that caused the
postback. It's in the __EventTarget form element anyway.

"Saravana" wrote:
If postback happen, it will fire corresponding post back event in the server
side. That post event will have sender as one of its parameter, with which
you can identify which control caused the postback.

But if you want it to find it in Page_Load, only option is
Request.Form["__EVENTTAR GET"]. This method will only work if your control
has autopostback property set to true

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"vbMental" <vb******@discu ssions.microsof t.com> wrote in message
news:5F******** *************** ***********@mic rosoft.com...
Thanks, and I figured something like that but I wanted a standard .NET way

to
do it.

"Karl Seguin" wrote:
You can peak under the covers and take a look at
Request.Form["__EVENTTAR GET"]

which will give you the UniqueId of the control which cause the event to
fire. If the contro was a WebControls.But ton then __EVENTTARGET will
unfortunetly be blank, but the button's unique ID will be in the
Request.Form collection...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"vbMental" <vb******@discu ssions.microsof t.com> wrote in message
news:94******** *************** ***********@mic rosoft.com...
> Is there anyway to find out which control fired the postback in
server-side
> code?
> Like in windows programming "Form.ActiveCon trol" ?


Nov 18 '05 #5
It would be, but it's possible the control doesn't exist yet. You get into
complexe page event issues...but yet, it really really would be nice..

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"vbMental" <vb******@discu ssions.microsof t.com> wrote in message
news:56******** *************** ***********@mic rosoft.com...
I understand all that but wouldnt it be nice to just have a property of the page called Postback control that would be the control that caused the
postback. It's in the __EventTarget form element anyway.

"Saravana" wrote:
If postback happen, it will fire corresponding post back event in the server side. That post event will have sender as one of its parameter, with which you can identify which control caused the postback.

But if you want it to find it in Page_Load, only option is
Request.Form["__EVENTTAR GET"]. This method will only work if your control has autopostback property set to true

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"vbMental" <vb******@discu ssions.microsof t.com> wrote in message
news:5F******** *************** ***********@mic rosoft.com...
Thanks, and I figured something like that but I wanted a standard .NET way
to
do it.

"Karl Seguin" wrote:

> You can peak under the covers and take a look at
> Request.Form["__EVENTTAR GET"]
>
> which will give you the UniqueId of the control which cause the

event to > fire. If the contro was a WebControls.But ton then __EVENTTARGET will > unfortunetly be blank, but the button's unique ID will be in the
> Request.Form collection...
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "vbMental" <vb******@discu ssions.microsof t.com> wrote in message
> news:94******** *************** ***********@mic rosoft.com...
> > Is there anyway to find out which control fired the postback in
> server-side
> > code?
> > Like in windows programming "Form.ActiveCon trol" ?
>
>
>


Nov 18 '05 #6

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

Similar topics

6
3834
by: V | last post by:
I have found that when I have a composite control that uses the CreateChildControls method, on a regular page load, Page_Load executes before CreateChildControls, but on a postback it is the reverse. This is causing logic problems and it really bothers me that this sequence of events fires inconsistently. Can anyone tell me why this happens and how we might get around it?
5
4819
by: Dan | last post by:
Hi, I'd like to find out the control that caused a postback to be raised. Obviously this could simply done in a control event handler. I am not going to do this method and would like no references as to how to do it this way as I already know how. I know this may be getting into advanced or unheard of territory. I have some custom web user controls that are dynamically created at run time along with other controls. I can still add an...
5
2053
by: Matthew Louden | last post by:
I created simple ASP.NET web application to test how AutoPostBack property in a web control works. I set AutoPostBack property to be true of a web control. When I run the application, here's the sequences when I step through the program: 1. Page loaded to the browser 2. Page_Load method is called with non-postback event 3. The user has certain actions on a control 4. Page_Load method is called with postback event
9
375
by: Robert Galvin | last post by:
Is it possible to tell which control caused a postback?
10
4536
by: Krista Lemieux | last post by:
I'm new to ASP.NET and I'm not use to the way things are handled with this technology. I've been told that when I have a control, I should only bind the data to it once, and not on each post back (basically have the data binding done in the If NOT IsPostBack Then statement). How come? How does this information get preserved? Which raises another question. Becuase I want to get away from the spaghetti code approach, I would like to create...
2
4382
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control displaying the contents of the data source, whilst another control updates the datasource via a command buttons implementation of 'Click', an event raised in the 'Handle Postback Events' stage of the control execution life cycle (via the...
0
1111
by: Antoine | last post by:
Forgive me as a beginner in asp.net. I wanted to ask some simple but clear questions, at least I hope they are. Ive seen a control in asp.net that works with codebehind and the good thing about the control it uses, is that it doesnt appear to use postback. I've generated myown app, it works well but with postback. I've tried it so that each button click only brings a ranged source of binded data, but its surely not as quite a preloading...
3
4561
by: Dave Adler | last post by:
Is there any way to retain the value of an HtmlInputFile control through a postback? I do some server side validation on the page when it is submitted and if an error occurs on the page the HtmlInputFile control value is blank after the postback. The EnableViewState for the control is set to true. I can't put the postedFile.filename value in a hidden control and then put it back into the HtmlInputFile control on postback because the...
1
17058
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater control in my aspx page with two image buttons, one for an edit command, another a delete command. Here is a cut down code fragment. ...
2
620
by: Wizzard | last post by:
I have a repeater with and imagebutton on a page useing VS2005 ASP.Net 2.0 <asp:Repeater ID="Repeater1" runat="server" > <ItemTemplate> <div> <asp:ImageButton ImageUrl="button.gif" ID="ImageButton1" runat="server" /> <p><%# Eval("Name") %></p> </div> </ItemTemplate>
0
9839
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10481
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9658
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8034
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
7187
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();...
0
5877
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4705
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
4295
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.