473,545 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can OnCommand event be added on the server side?

I have a single button. I want to change it's OnCommand. One moment
it may be Update, the next it may be New, etc.

I found btnMyButton.Com mand, but I cannot get it to work. The event
never fires. I have tried:

btnMyButton.Com mand+= new CommandEventHan dler(Update);

(there is an Update function)

No error. It just doesn't fire the event. Thanks for any advice.

Nov 19 '05 #1
2 1110
When are you setting the event handler? Everything looks fine. Try doing
it during Init

--
MY ASP.Net tutorials
http://www.openmymind.net/
<ne***********@ gmail.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
I have a single button. I want to change it's OnCommand. One moment
it may be Update, the next it may be New, etc.

I found btnMyButton.Com mand, but I cannot get it to work. The event
never fires. I have tried:

btnMyButton.Com mand+= new CommandEventHan dler(Update);

(there is an Update function)

No error. It just doesn't fire the event. Thanks for any advice.

Nov 19 '05 #2
You have to wire the eventhandler OnPageInit or OnPageLoad. If you have to
decide on which event to wire to in later stages within the page life cycle,
then you need to persist an indicator (either in the Session or in a cookie)
to redo that wiring upon page_load as I did in this sample:
http://www.societopia.net/Samples/Dy...dControls.aspx

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"ne***********@ gmail.com" wrote:
I have a single button. I want to change it's OnCommand. One moment
it may be Update, the next it may be New, etc.

I found btnMyButton.Com mand, but I cannot get it to work. The event
never fires. I have tried:

btnMyButton.Com mand+= new CommandEventHan dler(Update);

(there is an Update function)

No error. It just doesn't fire the event. Thanks for any advice.

Nov 19 '05 #3

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

Similar topics

4
4076
by: Zeebra3 | last post by:
Here goes: I have a web form with several asp:dropdownlists, with which, when selection is changed I want to fire an event defined in some clientside js. The content of the clientside code is dependant on data collected in the code behind on the server. I have set AutoPostback to false for the controls and added lines such as...
4
1300
by: WilsonSmith | last post by:
Hello All, My development environment is as follows: ASP.Net App with .Net Framework 1.1 with VB.net I have added the code in the page load event for non post back activity.
2
2867
by: Matthew MacDonald | last post by:
Hi all, I am adding controls to a table dynamically. I have a list that I am putting into the session to keep track of them on postback. What I need to know though, is how to add the oncommand method to the buttons as I create them? For example: btn.ID = "btnDelete" & list.Count btn.Text = "Remove" btn.CommandName = "RemoveSW"
7
2041
by: Dave R | last post by:
Anyone know how to wire up an event handler for controls added to an ASP.NET page at run-time? Of course, at design-time this is easy: just enter the method's name in the event tab of the control's properties. But what if I do... LinkButton lb = new LinkButton(); lb.Text = "Click me now!"; cell.Controls.Add(lb); I want to create a...
4
3008
by: Jordan | last post by:
I need to dynamically add an ImageButton control to a user control and and do some server-side processing when the user clicks it. While I the ImageButton is added to the user control at runtime, as needed, I'm having trouble wiring up its click event procedure. The problem is that when I go to subscribe the ImageButton to the delegate, the...
3
2453
by: wardy1975 | last post by:
Hi all....looking for a bit of help here....I'm using an asp.net server side button, and trying to add an onclick event on the button to call a javascript function. However, I am trying to enter the onclick syntax directly in the html instead of via the attributes.add functionality (this is required due to the dynamic nature of how the...
2
2064
by: moondaddy | last post by:
I have an asp.net 2.0 application and put a html button on a web page. I double clicked on the button and it crated the event handler for me and created the stub js function for it like this: <input id="btnQryFunctions" type="button" value="Query Functions" language="javascript" onclick="return btnQryFunctions_onclick()" /> and the...
0
1121
by: clintonG | last post by:
A Matter of Design: OnCommand or OnClick Event Handler? Attributing a control using OnCommand supports the use of other attibutes such as CommandName and CommandArgument. AFIK OnClick does not. Where it matters when using OnCommand for example is the value of the CommandArgument seems to be easier to use to indicate some behavior in that...
7
22407
controlbox
by: controlbox | last post by:
I have recently inplemented some drop-down lists (combos) on a page where one is dynamically populated according to the selection of another using the microsoft ajax extensions. I had to set AutoPostBack = true, and enable viewstate in order for the serverside events to fire, but once this was done, all seemed well - so far so good... Also,...
0
7479
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...
0
7669
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. ...
0
7926
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...
1
7439
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...
0
5987
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...
0
4962
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...
0
3468
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...
0
3450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1901
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

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.