8 Replies - 3136 Views - Last Post: 12 February 2013 - 12:43 PM Rate Topic: -----

#1 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,090
  • Joined: 02-July 08

Event not firing.

Posted 09 February 2013 - 02:48 PM

I have a GridView(GV) and inside the GV I have a databound column. The column has a Checkbox in it and I have tried to wire up the OnCheckedChanged event to a code block in the code behind file. The event signature is correct I just can't get it to fire. The GV is inside of a Update panel. Any ideas?

Class _Default : Inherits Page

  Protected Sub cb_cc(sender As Object, e As EventArgs)
   'do stuff
  End sub
... 


<asp:CheckBox ID="cb" runat="server" Checked="false" OnCheckedChanged="cb_cc" />


Is This A Good Question/Topic? 0
  • +

Replies To: Event not firing.

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3522
  • View blog
  • Posts: 12,022
  • Joined: 12-December 12

Re: Event not firing.

Posted 09 February 2013 - 03:33 PM

I don't use ASP so I'm just guessing that your sub should be Public(?).
Was This Post Helpful? 0
  • +
  • -

#3 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,090
  • Joined: 02-July 08

Re: Event not firing.

Posted 09 February 2013 - 04:12 PM

I have tried that. Most events are done with Protected Sub, so I was following a pattern. Thanks for the thought.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3522
  • View blog
  • Posts: 12,022
  • Joined: 12-December 12

Re: Event not firing.

Posted 09 February 2013 - 04:28 PM

I believe you need AutoPostBack=true but it is a little more involved when the checkbox is in a GridView, as the GV handles the assignment of IDs. SO discussion.
Was This Post Helpful? 1
  • +
  • -

#5 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,090
  • Joined: 02-July 08

Re: Event not firing.

Posted 09 February 2013 - 04:44 PM

I have tried the AutoPostback as well. I have done some serious searching and did not find that post - thanks for that. It will lead me into some more research.

Let me now add more complexity - I am using the footer template of a column. All columns are in templates.

I think I will redesign what I am doing and remove that from the GV. It just looked very nice there in the footer.
Was This Post Helpful? 0
  • +
  • -

#6 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,090
  • Joined: 02-July 08

Re: Event not firing.

Posted 09 February 2013 - 06:12 PM

Turns out I was wrong about the event signature (e As EventArgs) is correct and it works now!

This post has been edited by _HAWK_: 09 February 2013 - 07:33 PM

Was This Post Helpful? 0
  • +
  • -

#7 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3522
  • View blog
  • Posts: 12,022
  • Joined: 12-December 12

Re: Event not firing.

Posted 10 February 2013 - 02:35 AM

View Post_HAWK_, on 09 February 2013 - 06:12 PM, said:

Turns out I was wrong about the event signature (e As EventArgs) is correct and it works now!


He,he, I did spot that at one point! I don't know why I didn't mention it. Andy.
Was This Post Helpful? 0
  • +
  • -

#8 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,090
  • Joined: 02-July 08

Re: Event not firing.

Posted 10 February 2013 - 02:05 PM

Well not all event signatures are the same - the DropDownList onselectedIndexChanged is as above on my first post - inconsistant as best!
Was This Post Helpful? 0
  • +
  • -

#9 h4nnib4l  Icon User is offline

  • The Noid
  • member icon

Reputation: 1181
  • View blog
  • Posts: 1,677
  • Joined: 24-August 11

Re: Event not firing.

Posted 12 February 2013 - 12:43 PM

That's interesting (I've never used VB with ASP.NET). I'm surprised that the event handlers' signatures would take a different number of arguments.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1