|
-
Jan 26th, 2016, 04:55 AM
#1
Thread Starter
New Member
Event handler
I use this code to obtain a selected data from GridView control.
I created a user control and reference it to ASPX page.
However, for some reason I can not access public methods IndexChanged to retrieve information of selected line.
What is wrong in the code?
*
User controls:
*
Public gridRow As GridViewRow
Public Event IndexChanged As GridViewSelectEventHandler
*
Protected Sub GridView_SelectedIndexChanged (sender As Object, e As EventArgs) Handles gv.SelectedIndexChanged
******* gridRow = Grid.SelectedRow
******* RaiseEvent IndexChanged (sender, e)
End Sub
*
ASPX page:
*
*
grid.IndexChanged - there is no such event in the selection (the grid is the name of the user control)
-
Jan 26th, 2016, 08:40 AM
#2
Re: Event handler
Well firstly if Grid is the actual name of your control then surely you should be doing -
Code:
Handles grid.SelectedIndexChanged
and not
Code:
Handles gv.SelectedIndexChanged
One thing though, when you say User Control, do you mean you added a Grid Control to the page? or you created your own User Control and added that to your page?
Please Mark your Thread "Resolved",  if the query is solved & Rate those who have helped you
-
Jan 26th, 2016, 08:45 AM
#3
Thread Starter
New Member
Re: Event handler
 Originally Posted by NeedSomeAnswers
Well firstly if Grid is the actual name of your control then surely you should be doing -
Code:
Handles grid.SelectedIndexChanged
and not
Code:
Handles gv.SelectedIndexChanged
One thing though, when you say User Control, do you mean you added a Grid Control to the page? or you created your own User Control and added that to your page?
I created my own user control.
gv is the name of grid in user control.
grid is one web page.
-
Jan 29th, 2016, 04:44 AM
#4
Re: Event handler
Ahh, that is your problem then, the Grid events wont be exposed unless you expose them.
When your using a predefined control such as a Grid it has events already exposed, when you create your own User Control you need to expose all the events you want to interact with yourself, it is not automatic, and the Grid itself wont be accessible externally either.
Essentially you need to create your own Events for your User Control.
Please Mark your Thread "Resolved",  if the query is solved & Rate those who have helped you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|