Datagrid and boundcolumns
Hi everyone, I have a datagrid that is populated by binding it to the results of an SQL query returned by a datareader.
Some of the columns I do not need displayed so I have set the AutoGenerateColumns property to false.
I then create (Via VB) all the columns that I want to bind to the datagrid like so
[Highlight=VB]
' These two lines just return a a datareader with results of SQL query
Dim oDB As New HREvents.clsDatabase()
dgEvents.DataSource = oDB.getEvents("", "")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Add in the name column
Dim oName As New Web.UI.WebControls.BoundColumn()
oName.DataField = "Name"
oName.HeaderText = "Event name"
dgEvents.Columns.Add(oName)
dgEvents.DataBind()
[\vbcode]
THe above works fine but what I would like to know is how can I change the value of the name at runtime (Some names are NULL and I would rather display 'Not available' than NULL)
Thanks in advance
Mark