Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 29th, 2006, 07:00 PM
Authorized User
 
Join Date: Jun 2003
Location: St. Louis, Mo., USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to rfinks
Default Unable to fire a click event

I'm having trouble with link buttons in a datagrid column template, contained in a dynamically loaded user control. I'm unable to get the controls to respond to click events or command events. They don't seem to be firing. I've also tried regular buttons with the same result.

I've got a feeling this is a page life-cycle issue but haven't been able to find an answer. I know that link buttons generate Java Script for client side events. This is not an issue because I've tested link buttons on a form by themselves and they work. I appears that the form is making a round-trip to the server and then reloading the same form instead of redirecting to a different page, which would have happened if the click-event was executed.

Any insight into this issue would be most appreciated.

Roger Finks
  #2 (permalink)  
Old August 29th, 2006, 07:19 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Have you stepped through the code?

Are the link buttons in an EditCommandColumn?
If so:
In the datagrid, have you set the OnEditCommand, OnUpdateCommand?

If these are just buttons contained in a datagrid, and you need to wire up some functionality to them, in your case, a redirect you could do something like this:

    Private Sub dgItemBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs) Handles dgRec.ItemDataBound
        Dim lb As LinkButton
        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
            lb = CType(e.Item.Cells(0).FindControl("lbDelete"), LinkButton)
            lb.Attributes.Add("onClick", "return getconfirm();")
        End If

    End Sub

Then each link button will trigger the getconfirm function when it is clicked.

hth.

"The one language all programmers understand is profanity."
  #3 (permalink)  
Old September 1st, 2006, 11:26 PM
Authorized User
 
Join Date: Jun 2003
Location: St. Louis, Mo., USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to rfinks
Default

Thanks for the reply. You've exposed me to a different way to accomplish this. I've got the ItemDataBound event to fire. Now I have to write the Javascript function to handle it.

Roger Finks
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot get Edit Template event to fire zoltac007 ASP.NET 2.0 Professional 4 February 13th, 2007 03:29 PM
ImageButton wont fire event Moonie112 ASP.NET 1.0 and 1.1 Basics 1 February 11th, 2006 01:01 PM
SelectedIndexChanged Event doesn't fire ddudley3 ASP.NET 2.0 Professional 7 February 6th, 2006 10:47 AM
Can't fire button event more than 1 time goatstudio ASP.NET 2.0 Basics 4 September 22nd, 2004 08:45 AM



All times are GMT -4. The time now is 11:55 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.