473,651 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic Buttons

Frinavale
9,735 Recognized Expert Moderator Expert
Why would you ever want to create a button dynamically?
A button seems like a pretty concrete thing to have in an application; it requires you to implement code that handles its events....and usually we want a button to perform a specific task (really I can't think of a case where this doesn't happen).

So why would anyone want to create a button dynamically?

-Frinny
Jun 19 '07 #1
9 3106
r035198x
13,262 MVP
Why would you ever want to create a button dynamically?
A button seems like a pretty concrete thing to have in an application; it requires you to implement code that handles its events....and usually we want a button to perform a specific task (really I can't think of a case where this doesn't happen).

So why would anyone want to create a button dynamically?

-Frinny
I always keep a method like makeButton ready though, there's a bit you have to do to initialize a button in Java and often I fing that I don't want to write the same thing over and over again.
Jun 19 '07 #2
Frinavale
9,735 Recognized Expert Moderator Expert
I always keep a method like makeButton ready though, there's a bit you have to do to initialize a button in Java and often I fing that I don't want to write the same thing over and over again.

I can see where it could come in handy for a Java application...b ut you still hard code the method that handles it's "click" event.

It just seems that lately I've been encountering questions in .NET where a user creates a button on the fly and then they get stuck and ask us how to dynamically supply code for said button.

I wonder why the don't just create a button and make it visible or invisible depending on whatever their logic dictates.

It's not like Java where you have to declare the button, and then set up where it should be in some box that functions as your window (can't remember what it entails but I remember it being painful to do)...you just drag the button onto a form and go from there.

Isn't there some sort of Java editing software out there that is something like Visual Studio that lets you do this too?

-Frinny
Jun 19 '07 #3
Motoma
3,237 Recognized Expert Specialist
Why would you ever want to create a button dynamically?
A button seems like a pretty concrete thing to have in an application; it requires you to implement code that handles its events....and usually we want a button to perform a specific task (really I can't think of a case where this doesn't happen).

So why would anyone want to create a button dynamically?

-Frinny
If you have a undetermined dataset with an unknown number of elements, couldn't it be useful to be able to dynamically build buttons?

The only real reason why someone would be caught up on building handlers is if they did not use an object oriented approach to building the buttons. If I were to do something like this, I would build (or extend) a button class to include the related data elements, handler specifics, position, and style information.
Jun 19 '07 #4
Frinavale
9,735 Recognized Expert Moderator Expert
If you have a undetermined dataset with an unknown number of elements, couldn't it be useful to be able to dynamically build buttons?

The only real reason why someone would be caught up on building handlers is if they did not use an object oriented approach to building the buttons. If I were to do something like this, I would build (or extend) a button class to include the related data elements, handler specifics, position, and style information.
That's why the DataGrid / GridView control was created :)
Jun 19 '07 #5
Motoma
3,237 Recognized Expert Specialist
That's why the DataGrid / GridView control was created :)
Yes, however the DataGrid/DataView objects are very restrictive in the way they allow one to present data.
Jun 19 '07 #6
Frinavale
9,735 Recognized Expert Moderator Expert
Yes, however the DataGrid/DataView objects are very restrictive in the way they allow one to present data.
And edit/delete/update the data in the dataset.....
Jun 19 '07 #7
Frinavale
9,735 Recognized Expert Moderator Expert
I guess this is a good indication that I should get cracking on that DataGrid/GridView article.

Hehe
Jun 19 '07 #8
Motoma
3,237 Recognized Expert Specialist
I guess this is a good indication that I should get cracking on that DataGrid/GridView article.

Hehe
Let me know if you want any help with content or proofreading.
Jun 19 '07 #9
r035198x
13,262 MVP

Isn't there some sort of Java editing software out there that is something like Visual Studio that lets you do this too?

-Frinny
Unfortunately there's lots of them these days. More often than not though, I'd have one method called for all my button clicks (or for a set of similar actions) and then it would be easy to add more functionality if my buttons were made "dynamicall y" especially in cases where the interface itself is dynamic and I'm showing and hiding buttons.

It is also possible to over-do-it though ...
Jun 20 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

6
2907
by: MikeY | last post by:
Hi Everyone, Does anyone know where I can get my hands on a sample with source code of a simple dynamic button control in C# Windows form. I am looking for a sample that uses a class library that sets the properties send/passed from the main windows form. I'm having problems with the class library, the button control collection and my referencing it ie this.Control.Add(aControl);. Any and all help is appreciated. Thanks in advance.
1
447
by: brian | last post by:
'visual studio 2002 pro 1.0 framwork' I am creating dynamic Link buttons on my intranet site and assigning a click_event to them. A user clicks a link and I call the method to recreate the links in the page load so the click event will be recogonized. This works! Now the link previously clicked actually will generate a new list of link buttons in the click event. Once I load
1
2288
by: andrei | last post by:
Hi Group, I have an aspx form with a variable number of buttons added dynamically, with id's like b01, b02, b03... Whenever I click one of these buttons, the form is posted back. I need to find out which of the buttons triggered the postback *in the Page_Load* - here I have some code that needs to know which button was clicked so it will generate different output for the page.
3
1852
by: WebBuilder451 | last post by:
I have a series of dynamic link buttons created based upon a datareader. I've added a click event and it calls the sub ok: example: "while loop through the reader" Dim ltrCtrl As New LiteralControl Dim lbtnCtrl As New LinkButton ltrCtrl.Text = "<br>" lbtnCtrl.Text = "WE: " & dtrCal(10).ToString lbtnCtrl.ToolTip = dtrCal(10).ToString & " these events" & dtrCal(1) lbtnCtrl.ID = "wecc" & i.ToString
3
13738
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum. Everyone wants to do a java confirmation box when a user clicks the delete button. Fair enough, basic user design rules state that you should always confirm a delete action. There is also a consensus that the best way to do this is a template...
2
2702
by: WolfyUK | last post by:
Hello, I have a standard asp:DataGrid called CasesGrid that I wish to write my own paging controls for. The aim is to get something like the following rendered to screen: << First < Previous 1 2 3 4 5 ... Next Last >> I have achieved the first/previous/next/last buttons quite easily as follows in the ASPX (1.1) page:
13
10162
by: rn5a | last post by:
In a shopping cart app, suppose a user has placed 5 orders, I want to show him 5 LinkButtons (one for each order) so that when he clicks the first LinkButton, he would be shown the details of his first order. Likewise if he clicks the second LinkButton, he will be shown the details of the second order he had placed. The Text of the LinkButtons will be 1 2 3 etc. So this user would see 1 2 3 4 5 as the LinkButtons. The problem is...
5
1852
by: Gui | last post by:
Hi, I'm working in C# .net 2005 with Ajax. I have a page that loads dynamic user controls depending on the scenario. In those user controls, I create dynamic linkbuttons. The user controls are loaded on the .aspx PageLoad and the linkbuttons are created on the .ascx PageLoad. The problem I have is that those linkbuttons don't work on the first click. I have to make 2 clicks to have their event fired. What can I do for that ? Thanks.
2
2197
by: remya1000 | last post by:
hai i'm using Vb.net. i'm creating 64 dynamic created buttons of 8 rows and 8 columns. And i have 1 Go button, 1 textbox. those were created dynamically. if i enter one number inside textbox and hit Go Button, then it checks corresponding Database and display buttons on page. and inside Database i have a field called Item, that tells the button number to display. for eg: if Database1 contain items 0,10,20,50. then i need to display...
2
4452
Frinavale
by: Frinavale | last post by:
I've created a ASP.NET control that displays a "book" of schedules. It dynamically displays scheduling times and allows the user to page through the schedules. It also lets the user edit the schedule times if the user has permissions to edit schedules. When the user is not editing, or the user is not allowed to edit, the buttons that let the user edit are not displayed. If the user is allowed to edit schedules but they are not editing a link...
0
8352
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
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
8697
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8465
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7297
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...
0
4144
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
4283
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2699
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
1
1909
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.