HighTechTalks DotNet Forums  

Question regarding forcing a postback event

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss Question regarding forcing a postback event in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Michael Horton
 
Posts: n/a

Default Question regarding forcing a postback event - 06-29-2003 , 03:41 AM






I've dynamically creating a datagrid and have the grid setup to allow
sorting. The problem is that the event isn't getting called until after the
table is created. How can I get it to to fire earler? I'm guessing I need to
know how to find out what the e.sortexpression value is and call the
procedure before calling the CreateGrid sub. I've attached the code
CreateGrid sub below

Public Sub CreateGrid()

'declare a new datagrid and set properties

Dim dgDrivers As New DataGrid()

dgDrivers.BorderWidth = Unit.Pixel(0)

dgDrivers.CellPadding = 5

dgDrivers.GridLines = GridLines.None

dgDrivers.BorderColor = System.Drawing.Color.Empty

dgDrivers.ShowHeader = True

dgDrivers.AutoGenerateColumns = False

dgDrivers.SelectedItemStyle.BackColor = System.Drawing.Color.Empty

dgDrivers.AllowSorting = True

'add bound columns to the datagrid

Dim datagridcol As New BoundColumn()

datagridcol.HeaderText = "Car #"

datagridcol.DataField = "car #"

datagridcol.SortExpression = "Car #"

dgDrivers.Columns.Add(datagridcol)

datagridcol = New BoundColumn()

datagridcol.HeaderText = "Name"

datagridcol.DataField = "Name"

datagridcol.SortExpression = "Name"

dgDrivers.Columns.Add(datagridcol)

datagridcol = New BoundColumn()

datagridcol.HeaderText = "Status"

datagridcol.DataField = "Status"

'datagridcol.DataFormatString = "{0:d}"

datagridcol.SortExpression = "Status"

dgDrivers.Columns.Add(datagridcol)

datagridcol = New BoundColumn()

datagridcol.HeaderText = "Hometown"

datagridcol.DataField = "Hometown"

datagridcol.SortExpression = "HomeTown"

dgDrivers.Columns.Add(datagridcol)

'add event handlers

AddHandler dgDrivers.SortCommand, AddressOf dgDriver_Sort

dgDrivers.DataSource = DisplayDrivers()

dgDrivers.DataBind()

'add datagrid to the page

Page.Controls(1).Controls.Add(dgDrivers)

End Sub




--
Michael Horton
http://www.cta-racing.com



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.