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
9 3106
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.
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
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.
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 :)
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.
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.....
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
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.
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 ...
Sign in to post your reply or Sign up for a free account.
Similar topics |
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.
|
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
|
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.
|
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
|
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...
| |
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:
|
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...
|
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.
|
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...
|
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...
|
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...
| |
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,...
|
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...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |