Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onCommand event (linkButton)

Status
Not open for further replies.

link9

Programmer
Nov 28, 2000
3,387
US
Hello all --

I'm missing something painfully obvious here, I'm sure, but I'm trying to get a simple command event handler to fire when a link button is clicked. This should not be so painful.

The following is my linkbutton declaration in the aspx file:

<asp:LinkButton id=&quot;lnkAccount&quot; runat=&quot;server&quot; CommandName=&quot;sort&quot;
CommandArgument=&quot;account&quot; OnCommand=handleSorting>Account</asp:LinkButton>


Ok. I have then declared the respective event handler for the command in the codebehind:

Protected Sub handleSorting(ByVal sender As Object, ByVal e As CommandEventArgs)
bindList(e.CommandArgument)
End Sub

What am I missing here, guys/gals? The event handler is not firing, and I'm about to lose my head over here.

[curse]

Thanks,
paul
penny1.gif
penny1.gif
 
Are you sure the input arguments of your sub are correct?
check out if there is a LinkCommandEventArgs object. I have used the same thing for a imagebutton and the arguments change from the normal button.
Another thing, try keeping the CommandArgument and adding the OnClick=&quot;handleSorting&quot; and check if it passes the arguments correctly...

hth
 
Well, I took a deep breath, deleted the file, and started all over, this time using a repeater instead of a datalist.

I took baby steps, testing functionality at every checkpoint, until the entire &quot;grid&quot; was re-built. To be honest, I don't know what the problem was. Obviously, I had missed something, though.

I was about **THIS** close to just writing this in ASP classic yesterday. I just have to keep telling myself:

This IS better
This IS better
This IS better
You WILL learn it
You WILL learn it
You WILL learn it

Zen master over and out -- [fumanchu]
penny1.gif
penny1.gif
 
a good book to read is:

&quot;Patiance before coding&quot;

if someone whould just write it, I would be the first to buy it. =)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top