DataGrid (fao Steven Cheng)

T

Terry Holland

This is a follow on from a previous posting. Ive posted as new post as the
previous thread seems to have dried up


Steven

Thank you. I mangaged to get your sample code working. However I am having
difficulty getting the code in the article
#Creating Custom Columns for the ASP.NET Datagrid
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html
/creatingcustomcolumns.asp

I am able to get the example that you can download working but am unable to
get it working in an application of my own.

I get the following error which occurrs on the line
cell.text = dgi.DataItem(DataField)

error
=============
Line 34: Throw New Exception(ex.InnerException.ToString)
Line 35: End Try
Line 36: End Sub


Source File: C:\_Development\CSA\Dev\ControlExtenders\clsDropDownColumn.vb
Line: 34

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an
object.]

=============

Any ideas why this is happening?

Also, is it possible for me to add a customcolumn completely
programmatically (ie without the need to add a @register directive and a
<ddg:DropDownColumn .../> tag on my page?

thanks in advance
 
S

Steven Cheng[MSFT]

Hi Terry,

Thanks for your followup.
As for the new problem you met, do you mean that you just use the sample
custom column in the MSDN atrticle and got some error to work in your own
page? Have you made any modification on that column? I'll have a further
look into the sample column first since I've direclty used it in my page.
If there're any other findings, please feel free to post here.

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




--------------------
| From: "Terry Holland" <[email protected]>
| Subject: DataGrid (fao Steven Cheng)
| Date: Wed, 10 Aug 2005 12:58:01 +0100
| Lines: 46
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: host240.multiserv.com 194.200.135.240
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10377
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| This is a follow on from a previous posting. Ive posted as new post as
the
| previous thread seems to have dried up
|
|
| Steven
|
| Thank you. I mangaged to get your sample code working. However I am
having
| difficulty getting the code in the article
| #Creating Custom Columns for the ASP.NET Datagrid
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html
| /creatingcustomcolumns.asp
|
| I am able to get the example that you can download working but am unable
to
| get it working in an application of my own.
|
| I get the following error which occurrs on the line
| cell.text = dgi.DataItem(DataField)
|
| error
| =============
| Line 34: Throw New Exception(ex.InnerException.ToString)
| Line 35: End Try
| Line 36: End Sub
|
|
| Source File: C:\_Development\CSA\Dev\ControlExtenders\clsDropDownColumn.vb
| Line: 34
|
| Stack Trace:
|
|
| [NullReferenceException: Object reference not set to an instance of an
| object.]
|
| =============
|
| Any ideas why this is happening?
|
| Also, is it possible for me to add a customcolumn completely
| programmatically (ie without the need to add a @register directive and a
| <ddg:DropDownColumn .../> tag on my page?
|
| thanks in advance
|
|
|
|
 
T

Terry Holland

My clsDropDownColumn as an exact copy of that in example.

My page HTML is
=========================================
<%@ Register TagPrefix="uc1" TagName="ctlMaint_List"
Src="UserControls/ctlMaint_List.ascx" %>
<%@ Register TagPrefix="ddc" Namespace="ControlExtenders"
Assembly="ControlExtenders"%>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="pgeTest.aspx.vb"
Inherits="CSAWeb.pgeTest"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>pgeTest</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<LINK href="Styles.css" type="text/css" rel="stylesheet">
</HEAD>
<body MS_POSITIONING="FlowLayout">
<form id="Form1" method="post" runat="server">
<P>
<asp:DataGrid id="DataGrid1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="ID"></asp:BoundColumn>
<asp:BoundColumn DataField="username"></asp:BoundColumn>
<ddc:clsDropDownColumn DataField="UstyID" HeaderText="User Type"/>
</Columns>
</asp:DataGrid></P>
<P> </P>
<P> </P>
</form>
</body>
</HTML>
=========================================


My Page code is
==============================
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
DataGrid1.DataSource = clsUser_ROC.GetUser_ROC
SetUpGrid()
DataBind()
'CtlMaint_ManyToMany21.InitialiseControl()
End Sub
Private Sub SetUpGrid()
Dim o As New clsDropDownColumn

With o
.DataField = "UstyID"
.DataTextField = "Desc"
.DataValueField = "ID"
.HeaderText = "User Type"
.DataSource = GetDS() ' clsUserType_NVL.GetList
End With
DataGrid1.Columns.Add(o)
End Sub
Private Function GetDS() As ArrayList
Dim al As New ArrayList
al.Add("Value 1")
al.Add("Value 2")
al.Add("Value 3")
Return al
End Function
=========================================

Where clsUser_ROC.GetUser_ROC returns a collection of object with the
following public interface
=========================================
Public Property ID() As Integer
Get
Return m_intID
End Get

Set(ByVal Value As Integer)
If m_intID <> Value Then
m_intID = Value
End If
End Set
End Property

Public Property FirstName() As String
Get
Return m_strFirstName
End Get

Set(ByVal Value As String)
If m_strFirstName <> Value Then
m_strFirstName = Value
End If
End Set
End Property

Public Property Surname() As String
Get
Return m_strSurname
End Get

Set(ByVal Value As String)
If m_strSurname <> Value Then
m_strSurname = Value
End If
End Set
End Property

Public Property Email() As String
Get
Return m_strEmail
End Get

Set(ByVal Value As String)
If m_strEmail <> Value Then
m_strEmail = Value
End If
End Set
End Property

Public Property Username() As String
Get
Return m_strUsername
End Get

Set(ByVal Value As String)
If m_strUsername <> Value Then
m_strUsername = Value
End If
End Set
End Property

Public Property Password() As String
Get
Return m_strPassword
End Get

Set(ByVal Value As String)
If m_strPassword <> Value Then
m_strPassword = Value
End If
End Set
End Property

Public Property UstyID() As Integer
Get
Return m_intUstyID
End Get

Set(ByVal Value As Integer)
If m_intUstyID <> Value Then
m_intUstyID = Value
End If
End Set
End Property
=========================================



Steven Cheng said:
Hi Terry,

Thanks for your followup.
As for the new problem you met, do you mean that you just use the sample
custom column in the MSDN atrticle and got some error to work in your own
page? Have you made any modification on that column? I'll have a further
look into the sample column first since I've direclty used it in my page.
If there're any other findings, please feel free to post here.

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




--------------------
| From: "Terry Holland" <[email protected]>
| Subject: DataGrid (fao Steven Cheng)
| Date: Wed, 10 Aug 2005 12:58:01 +0100
| Lines: 46
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: host240.multiserv.com 194.200.135.240
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10377
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| This is a follow on from a previous posting. Ive posted as new post as
the
| previous thread seems to have dried up
|
|
| Steven
|
| Thank you. I mangaged to get your sample code working. However I am
having
| difficulty getting the code in the article
| #Creating Custom Columns for the ASP.NET Datagrid
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html
| /creatingcustomcolumns.asp
|
| I am able to get the example that you can download working but am unable
to
| get it working in an application of my own.
|
| I get the following error which occurrs on the line
| cell.text = dgi.DataItem(DataField)
|
| error
| =============
| Line 34: Throw New Exception(ex.InnerException.ToString)
| Line 35: End Try
| Line 36: End Sub
|
|
| Source File: C:\_Development\CSA\Dev\ControlExtenders\clsDropDownColumn.vb
| Line: 34
|
| Stack Trace:
|
|
| [NullReferenceException: Object reference not set to an instance of an
| object.]
|
| =============
|
| Any ideas why this is happening?
|
| Also, is it possible for me to add a customcolumn completely
| programmatically (ie without the need to add a @register directive and a
| <ddg:DropDownColumn .../> tag on my page?
|
| thanks in advance
|
|
|
|
 
S

Steven Cheng[MSFT]

Hi Terry,

I've downloaded the code sample and performed some tests on my local side.
Based on my test , I can correctly use the Custom DropDownColumn both
statically or dynamnically. One thing need to pay attention is that since
the when we add column programmatically, we need to add it in every page
request (not only the intial time). Also, it's better that we add such
intialize code in the Page's Init event. Below is my test page's code, you
can refer to it and test on your side:

========aspx=============
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="SimpleTestPage.aspx.vb" Inherits="VBNETWebApp.SimpleTestPage"%>
<%@ Register TagPrefix="cdc" Namespace="VBNETWebApp.MyCustomColumn"
Assembly="VBNETWebApp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>SimpleTestPage</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table width="80%">
<tr>
<td>Statically add columns:<br>
<asp:DataGrid id="dgStatic" runat="server"
AutoGenerateColumns="False">
<Columns>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
<asp:BoundColumn DataField="id" HeaderText="Id"></asp:BoundColumn>
<asp:BoundColumn DataField="name"
HeaderText="Name"></asp:BoundColumn>
<cdc:DropDownColumn DataField="priority" HeaderText="Priority"/>
</Columns>
</asp:DataGrid>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>Dynamically add columns:<br>
<asp:DataGrid id="dgDynamic" runat="server"
AutoGenerateColumns="False">
<Columns>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
</Columns>
</asp:DataGrid>
</td>
</tr>
</table>
</form>
</body>
</HTML>


======code behind========
Public Class SimpleTestPage
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Protected WithEvents dgStatic As System.Web.UI.WebControls.DataGrid
Protected WithEvents dgDynamic As System.Web.UI.WebControls.DataGrid

'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()


Init_Dynamic_Columns()


End Sub

#End Region

Private Sub Init_Dynamic_Columns()
Dim col1 As New BoundColumn
col1.DataField = "id"
col1.HeaderText = "Id"

Dim col2 As New BoundColumn
col2.DataField = "name"
col2.HeaderText = "Name"

Dim col3 As New MyCustomColumn.DropDownColumn
col3.DataSource = New String() {"top", "mid", "bot"}
col3.DataField = "priority"

dgDynamic.Columns.Add(col1)
dgDynamic.Columns.Add(col2)
dgDynamic.Columns.Add(col3)


End Sub


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
CType(dgStatic.Columns(3),
MyCustomColumn.DropDownColumn).DataSource = New String() {"top", "mid",
"bot"}

If Not IsPostBack Then

dgStatic.DataSource = GetDataSource()
dgStatic.DataBind()

dgDynamic.DataSource = GetDataSource()
dgDynamic.DataBind()

End If
End Sub

Private Function GetDataSource() As DataTable
Dim dt As New DataTable
Dim prioritys As String() = {"top", "mid", "bot"}

dt.Columns.Add("id", GetType(Long))
dt.Columns.Add("name", GetType(String))
dt.Columns.Add("priority", GetType(String))

Dim i As Int32

For i = 1 To 10

Dim dr As DataRow = dt.NewRow()

dr(0) = i
dr(1) = "Name_" & i
dr(2) = prioritys(i Mod 3)

dt.Rows.Add(dr)

Next


Return dt

End Function

Private Sub dgDynamic_EditCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dgDynamic.EditCommand
dgDynamic.EditItemIndex = e.Item.ItemIndex
dgDynamic.DataSource = GetDataSource()
dgDynamic.DataBind()

End Sub

Private Sub dgDynamic_UpdateCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dgDynamic.UpdateCommand
dgDynamic.EditItemIndex = -1
dgDynamic.DataSource = GetDataSource()
dgDynamic.DataBind()
End Sub

Private Sub dgDynamic_CancelCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dgDynamic.CancelCommand
dgDynamic.EditItemIndex = -1
dgDynamic.DataSource = GetDataSource()
dgDynamic.DataBind()
End Sub


Private Sub dgStatic_EditCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dgStatic.EditCommand
dgStatic.EditItemIndex = e.Item.ItemIndex
dgStatic.DataSource = GetDataSource()
dgStatic.DataBind()

End Sub

Private Sub dgStatic_UpdateCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dgStatic.UpdateCommand
dgStatic.EditItemIndex = -1
dgStatic.DataSource = GetDataSource()
dgStatic.DataBind()
End Sub

Private Sub dgStatic_CancelCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dgStatic.CancelCommand
dgStatic.EditItemIndex = -1
dgStatic.DataSource = GetDataSource()
dgStatic.DataBind()
End Sub
End Class

===================

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


















--------------------
| Thread-Topic: DataGrid (fao Steven Cheng)
| thread-index: AcWfIxuit5hxRqK3RaCi34EZGJIKOw==
| X-WBNR-Posting-Host: 194.200.135.5
| From: "=?Utf-8?B?VGVycnkgSG9sbGFuZA==?="
<[email protected]>
| References: <#[email protected]>
<[email protected]>
| Subject: RE: DataGrid (fao Steven Cheng)
| Date: Fri, 12 Aug 2005 02:49:18 -0700
| Lines: 253
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10409
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| My clsDropDownColumn as an exact copy of that in example.
|
| My page HTML is
| =========================================
| <%@ Register TagPrefix="uc1" TagName="ctlMaint_List"
| Src="UserControls/ctlMaint_List.ascx" %>
| <%@ Register TagPrefix="ddc" Namespace="ControlExtenders"
| Assembly="ControlExtenders"%>
| <%@ Page Language="vb" AutoEventWireup="false"
Codebehind="pgeTest.aspx.vb"
| Inherits="CSAWeb.pgeTest"%>
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
| <HTML>
| <HEAD>
| <title>pgeTest</title>
| <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
| <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
| <meta name="vs_defaultClientScript" content="JavaScript">
| <meta name="vs_targetSchema"
| content="http://schemas.microsoft.com/intellisense/ie5">
| <LINK href="Styles.css" type="text/css" rel="stylesheet">
| </HEAD>
| <body MS_POSITIONING="FlowLayout">
| <form id="Form1" method="post" runat="server">
| <P>
| <asp:DataGrid id="DataGrid1" runat="server"
AutoGenerateColumns="False">
| <Columns>
| <asp:BoundColumn DataField="ID"></asp:BoundColumn>
| <asp:BoundColumn DataField="username"></asp:BoundColumn>
| <ddc:clsDropDownColumn DataField="UstyID" HeaderText="User Type"/>
| </Columns>
| </asp:DataGrid></P>
| <P> </P>
| <P> </P>
| </form>
| </body>
| </HTML>
| =========================================
|
|
| My Page code is
| ==============================
| Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
| System.EventArgs) Handles MyBase.Load
| 'Put user code to initialize the page here
| DataGrid1.DataSource = clsUser_ROC.GetUser_ROC
| SetUpGrid()
| DataBind()
| 'CtlMaint_ManyToMany21.InitialiseControl()
| End Sub
| Private Sub SetUpGrid()
| Dim o As New clsDropDownColumn
|
| With o
| .DataField = "UstyID"
| .DataTextField = "Desc"
| .DataValueField = "ID"
| .HeaderText = "User Type"
| .DataSource = GetDS() ' clsUserType_NVL.GetList
| End With
| DataGrid1.Columns.Add(o)
| End Sub
| Private Function GetDS() As ArrayList
| Dim al As New ArrayList
| al.Add("Value 1")
| al.Add("Value 2")
| al.Add("Value 3")
| Return al
| End Function
| =========================================
|
| Where clsUser_ROC.GetUser_ROC returns a collection of object with the
| following public interface
| =========================================
| Public Property ID() As Integer
| Get
| Return m_intID
| End Get
|
| Set(ByVal Value As Integer)
| If m_intID <> Value Then
| m_intID = Value
| End If
| End Set
| End Property
|
| Public Property FirstName() As String
| Get
| Return m_strFirstName
| End Get
|
| Set(ByVal Value As String)
| If m_strFirstName <> Value Then
| m_strFirstName = Value
| End If
| End Set
| End Property
|
| Public Property Surname() As String
| Get
| Return m_strSurname
| End Get
|
| Set(ByVal Value As String)
| If m_strSurname <> Value Then
| m_strSurname = Value
| End If
| End Set
| End Property
|
| Public Property Email() As String
| Get
| Return m_strEmail
| End Get
|
| Set(ByVal Value As String)
| If m_strEmail <> Value Then
| m_strEmail = Value
| End If
| End Set
| End Property
|
| Public Property Username() As String
| Get
| Return m_strUsername
| End Get
|
| Set(ByVal Value As String)
| If m_strUsername <> Value Then
| m_strUsername = Value
| End If
| End Set
| End Property
|
| Public Property Password() As String
| Get
| Return m_strPassword
| End Get
|
| Set(ByVal Value As String)
| If m_strPassword <> Value Then
| m_strPassword = Value
| End If
| End Set
| End Property
|
| Public Property UstyID() As Integer
| Get
| Return m_intUstyID
| End Get
|
| Set(ByVal Value As Integer)
| If m_intUstyID <> Value Then
| m_intUstyID = Value
| End If
| End Set
| End Property
| =========================================
|
|
|
| "Steven Cheng[MSFT]" wrote:
|
| > Hi Terry,
| >
| > Thanks for your followup.
| > As for the new problem you met, do you mean that you just use the
sample
| > custom column in the MSDN atrticle and got some error to work in your
own
| > page? Have you made any modification on that column? I'll have a
further
| > look into the sample column first since I've direclty used it in my
page.
| > If there're any other findings, please feel free to post here.
| >
| > Thanks & Regards,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| > --------------------
| > | From: "Terry Holland" <[email protected]>
| > | Subject: DataGrid (fao Steven Cheng)
| > | Date: Wed, 10 Aug 2005 12:58:01 +0100
| > | Lines: 46
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
| > | Message-ID: <#[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | NNTP-Posting-Host: host240.multiserv.com 194.200.135.240
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:10377
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | This is a follow on from a previous posting. Ive posted as new post
as
| > the
| > | previous thread seems to have dried up
| > |
| > |
| > | Steven
| > |
| > | Thank you. I mangaged to get your sample code working. However I am
| > having
| > | difficulty getting the code in the article
| > | #Creating Custom Columns for the ASP.NET Datagrid
| > |
| >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html
| > | /creatingcustomcolumns.asp
| > |
| > | I am able to get the example that you can download working but am
unable
| > to
| > | get it working in an application of my own.
| > |
| > | I get the following error which occurrs on the line
| > | cell.text = dgi.DataItem(DataField)
| > |
| > | error
| > | =============
| > | Line 34: Throw New Exception(ex.InnerException.ToString)
| > | Line 35: End Try
| > | Line 36: End Sub
| > |
| > |
| > | Source File:
C:\_Development\CSA\Dev\ControlExtenders\clsDropDownColumn.vb
| > | Line: 34
| > |
| > | Stack Trace:
| > |
| > |
| > | [NullReferenceException: Object reference not set to an instance of an
| > | object.]
| > |
| > | =============
| > |
| > | Any ideas why this is happening?
| > |
| > | Also, is it possible for me to add a customcolumn completely
| > | programmatically (ie without the need to add a @register directive
and a
| > | <ddg:DropDownColumn .../> tag on my page?
| > |
| > | thanks in advance
| > |
| > |
| > |
| > |
| >
| >
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top