Ask a Question related to ASP.NET Security, Design and Development.
-
who be dat? #1
Dynamically adding buttons to each row: how?
I'm working on a web application that will use some datagrid and asp.net, an
asp.net Forum to be exact where people can leave posts and respond to posts
others have left. One page in particular displays rows with an
"interesting" column. What's interesting about this column is that it
displays some links followed by text (the message someone left), all in the
same column. These links represent actions a user can do. One link lets a
user reply to a message, the other link lets a user quote a message, link #3
lets a user delete a message, while the fourth link let's a user edit a
message. I'd like for these links to be buttons. I'm relatively new to
ASP.Net although I'm picking it up fairly well. Datagrids in particular a
bit of a fit although I'm slowly learning the in's and out's of them.
However, I've hit of a break wall. I think I can do what I want with
templates and such. When a button is called, I can catch this event using
the ItemCommand event and write the necessary code to deal with what was
clicked. Two problems I'm having:
1) All four buttons are not shown for each row everytime. At a minimum, a
row will display only two buttons, the reply and quote buttons. Edit will
only show up if the user who is logged in created the message for that
particular row. If the user didn't create that message in a given row, then
that user shouldn't see an edit button for that message. The delete button
works in a similar fashion although there are conditions where others can
delete a message. The point is, there are a total of four buttons that
maybe visible for each row but on some rows only 2 or 3 buttons will be
shown.
2) Due to the fact I like the way things look, I prefer to put the buttons
and text in the same column. Essientlly, the buttons will be at the top of
a column with the text of a message shown below the buttons, again in the
same column.
I suppose if I have to, I can put the buttons in their own column and have
the text in a seperate column, but I'd rather have them both in the same
column while figuring out a way have buttons present or not present on a per
row basis.
Is this possible? I've seen quite a few examples of adding controls (such
as buttons) to a column, but I've never seen an example where each row could
have a different amount of buttons in the same column unless the datagrid
has gone to edit mode for a row, for example, which I'd rather not do.
Plus, I'm not seeing much where it comes adding controls and adding text
after a control although I suppose I could add a label after the buttons in
the column and fill it with the text representing the message...
Any thoughts on this would be greatly appreciated. I order an ASP.Net book
on controls which was recommended on DatagridGirl.com, but it won't be here
for a day or two. I'd really like to get past this ASAP.
Sorry for the long post and thanks!
Chris Smith
who be dat? Guest
-
Dynamically creating buttons per row: how?
I'm working on a web application that will use some datagrid and asp.net, an asp.net Forum to be exact where people can leave posts and respond to... -
adding buttons dynamically
Hello All Can i add a button to a form dynamically durin runtime Something like on(load) var bt:Button = new Button( this.add(bt) // this... -
dynamically made buttons and masks
Hi I've made a load of buttons dynamically. The buttons work fine and everything but they all hover above the mask that i made for the movie. How... -
Dynamically creating buttons in custom datagrid control
Hi, I am creating a custom control datagrid. For each dynamically created column I've added a button in the header that will filter based on the... -
Problem with Dynamically Creating Link Buttons
Hello, This is my code behind code for dynamic link button creation: strUrl = "<asp:LinkButton CommandName='Onet3_Cd'...



Reply With Quote

