Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > do not receive event in Datagrid

Reply
Thread Tools

do not receive event in Datagrid

 
 
ton
Guest
Posts: n/a
 
      02-09-2004
Hi,
I'm using a datagrid, which I fill with a subroutine :
When filling the initial 5 rows I want to show the next 5 rows, but the
screen is blank. No control is visible. It looks if the nextprev function is
not executed. What ever code is written there (even when I'm sure it will
result in an error, nothing happened). Why ?
In the beginning of my servercontrol I have:
Public Class dbWebList

Inherits System.Web.UI.WebControls.WebControl

Implements INamingContainer

The function to show the grid:

Public Function ShowGrid(Optional ByVal startpage As Integer = 0) As Boolean

Dim datagrid As DataGrid


Dim SQLdataAdapter As SqlDataAdapter

Dim SQLconnection As SqlConnection

Dim dataset As DataSet

SQLconnection = New SqlConnection("workstation id=VRS7;packet size=4096;user
id=sa;data source=VRS7\VRS7;persist security info=False;initial
catalog=Compass")

SQLdataAdapter = New SqlDataAdapter("select * from tuning",
SQLconnection.ConnectionString)

dataset = New DataSet

SQLdataAdapter.Fill(dataset)

Datagrid = New DataGrid

Datagrid.AllowPaging = True

AddHandler Datagrid.PageIndexChanged, AddressOf Me.nextprev

Datagrid.PageSize = 5

Datagrid.DataSource = dataset

Datagrid.DataBind()

Controls.Add(Datagrid)

end sub

Private Sub nextprev(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)

Dim datagrid1 As DataGrid

'' DataGrid = CType(sender, DataGrid) ''(

_Page = e.NewPageIndex

ShowGrid(e.NewPageIndex)

'' Exit Sub

'' datagrid.CurrentPageIndex = e.NewPageIndex

'' datagrid.DataBind()

''Controls.Add(datagrid)

End Sub


 
Reply With Quote
 
 
 
 
ton
Guest
Posts: n/a
 
      02-09-2004
I allready got the event. The reason was that the createchildrecords was
fired, which did not give the gridcontrol, so the event did not do anything
either.

My next problem is the the NEXT butto (>) workt fine, but the previous can
only be pushed once, but does not generate the previous page.
I expect it has to do with the way these controls are created but do not
have a clue why this is not working.
thanks
ton

"ton" <(E-Mail Removed)> schreef in bericht
news:c08587$snt$(E-Mail Removed)1.nb.home.nl...
> Hi,
> I'm using a datagrid, which I fill with a subroutine :
> When filling the initial 5 rows I want to show the next 5 rows, but the
> screen is blank. No control is visible. It looks if the nextprev function

is
> not executed. What ever code is written there (even when I'm sure it will
> result in an error, nothing happened). Why ?
> In the beginning of my servercontrol I have:
> Public Class dbWebList
>
> Inherits System.Web.UI.WebControls.WebControl
>
> Implements INamingContainer
>
> The function to show the grid:
>
> Public Function ShowGrid(Optional ByVal startpage As Integer = 0) As

Boolean
>
> Dim datagrid As DataGrid
>
>
> Dim SQLdataAdapter As SqlDataAdapter
>
> Dim SQLconnection As SqlConnection
>
> Dim dataset As DataSet
>
> SQLconnection = New SqlConnection("workstation id=VRS7;packet

size=4096;user
> id=sa;data source=VRS7\VRS7;persist security info=False;initial
> catalog=Compass")
>
> SQLdataAdapter = New SqlDataAdapter("select * from tuning",
> SQLconnection.ConnectionString)
>
> dataset = New DataSet
>
> SQLdataAdapter.Fill(dataset)
>
> Datagrid = New DataGrid
>
> Datagrid.AllowPaging = True
>
> AddHandler Datagrid.PageIndexChanged, AddressOf Me.nextprev
>
> Datagrid.PageSize = 5
>
> Datagrid.DataSource = dataset
>
> Datagrid.DataBind()
>
> Controls.Add(Datagrid)
>
> end sub
>
> Private Sub nextprev(ByVal sender As Object, ByVal e As
> DataGridPageChangedEventArgs)
>
> Dim datagrid1 As DataGrid
>
> '' DataGrid = CType(sender, DataGrid) ''(
>
> _Page = e.NewPageIndex
>
> ShowGrid(e.NewPageIndex)
>
> '' Exit Sub
>
> '' datagrid.CurrentPageIndex = e.NewPageIndex
>
> '' datagrid.DataBind()
>
> ''Controls.Add(datagrid)
>
> End Sub
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
generated imageButton does not receive click Event gabriel ASP .Net 2 08-05-2005 11:16 AM
Need to create buttons(that throw events) AFTER i receive an event from another button. smyersm@gmail.com ASP .Net Web Controls 0 07-07-2005 07:25 PM
DataGrid SortCommand Event not fired on dynamically generated datagrid biru ASP .Net Web Controls 2 05-06-2005 01:38 PM
pythoncom: STA python COM server randomly does not receive event from other objects : deadlock Marc ENGEL Python 0 07-30-2003 09:19 AM
Only One Tkinter Entry can receive key event event in Linux RH8.0 wang xiaoyu Python 0 06-25-2003 04:44 AM



Advertisments