![]() |
| |||||||
| Sponsored Links |
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| ||||
| ||||
| Hi guys My scenario: i'm creating sorting on my columns, what i wanted to do is create an event for each link button, whereby i just populate the datasource with the new sorting value. but i have like 5 colums on the one datasource and another 5 on the other, and to me it seems like a waste to create so many events for sorting. so i was thinking it would be way cooler and neater if I could group my link buttons to one event? Is this possible, or is there another way? Shem |
| Sponsored Links |
|
#2
| ||||
| ||||
| I think you may be able to do it like this, although it's not something I've tried before:- Code: Sub sortbuttons_OnClick(ByVal s As Object, ByVal e As EventArgs) Dim mybutton As LinkButton = s Dim sortby As String = mybutton.CommandArgument . . . . . End Sub Like I say, I haven't tried this before, but in theory I think it should work. Let me know how you get on.... |
|
#3
| ||||
| ||||
| can my link buttons have diff id's and just the commandName set to sortbuttons? or am i misunderstanding how this is supposed to work ![]() Shem |
|
#4
| ||||
| ||||
| Yes, they must have different ids When the button is clicked, the object generating the call is passed to the Sub. This is then held in the variable you create As Object, for example s. We should then be able to create an instance of a LinkButton and set it to this object (s). Then, using mybutton.CommandArgument should give us the command argument of the object that created the call. I guess you could use either CommandName or CommandArgument. Perhaps use CommandName for the sort by variable and Command Argument as the direction variable. You could then just toggle the command argument to be either ASC or DESC as the link button is clicked each time. Hope that makes sense. |
|
#5
| ||||
| ||||
| ok the sub isn't firing, I put a break point on the sub and nothing ![]() Shem |
|
#7
| ||||
| ||||
| LMAO @ ME |
|
#9
| ||||
| ||||
| working like a charm now dude ![]() thanks |
![]() |
|
| Bookmarks |
| Tags |
| button, event |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| adding an event for my btnDelete in repeater | Shem | .Net Development | 13 | July 15th, 2008 09:33 AM |
| [JavaScript] addLoadListener - adding onload event in generic way | Shadow Wizard | Code Samples | 0 | July 13th, 2008 01:20 PM |
| Command Buttons Coloring | alansidman | Microsoft Access | 5 | May 15th, 2008 03:57 PM |