PC Review


Reply
Thread Tools Rate Thread

Datagrid- adding/editing record with a column that uses a drop dow

 
 
=?Utf-8?B?UGF0cmljaw==?=
Guest
Posts: n/a
 
      16th Aug 2005
ADO.NET Datagrid do NOT provide native support for
1) Adding records
2) Using Drop-down lists in editing a column

However,
1) http://aspnet.4guysfromrolla.com/articles/021203-1.aspx provides an
excellent guide on how to add records using template columns (textboxes, etc.
at the footer, and implementing the OnItemCommand event handler)
2)
http://msdn.microsoft.com/library/en...columns_topic6
provides an equally excellent article on how to use a drop down column

However, I can I combine the two together such that
1) In Normal view (when not editing), all data appears as plain-text
2) When Edit button/link is clicked, the column specified to use
DropDownColumn appears as a drop-down list
3) At the footer, a drop-down list of DropDownColumn type is used.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGF0cmljaw==?=
Guest
Posts: n/a
 
      16th Aug 2005
I tried adding the following to The DataGridColumn class:
'Case ListItemType.Footer
' AddHandler cell.DataBinding, AddressOf
EditItemDataBinding
' Dim DDL As New DropDownList
' DDL.ID = "add" + DataField
' cell.Controls.Add(DDL)

but when the page loads and following hitting these few lines
EditItemDataBinding is hit, I get a null exception on For Each DataSourceItem
In DataSource, as DataSource had only been initialised at protected void
UsersDataGrid_Edit(Object sender, DataGridCommandEventArgs e) , which is good
enough for data editing, but not for the Footer, how/where could I initialise
the DataSource for the footer?

"Patrick" wrote:

> ADO.NET Datagrid do NOT provide native support for
> 1) Adding records
> 2) Using Drop-down lists in editing a column
>
> However,
> 1) http://aspnet.4guysfromrolla.com/articles/021203-1.aspx provides an
> excellent guide on how to add records using template columns (textboxes, etc.
> at the footer, and implementing the OnItemCommand event handler)
> 2)
> http://msdn.microsoft.com/library/en...columns_topic6
> provides an equally excellent article on how to use a drop down column
>
> However, I can I combine the two together such that
> 1) In Normal view (when not editing), all data appears as plain-text
> 2) When Edit button/link is clicked, the column specified to use
> DropDownColumn appears as a drop-down list
> 3) At the footer, a drop-down list of DropDownColumn type is used.
>

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      17th Aug 2005
Hi Patrick,

Welcome to MSDN newsgroup.
As for the Custom DropDownColumn in the below tech article:

http://msdn.microsoft.com/library/en...stomcolumns.as
p?frame=true#creatingcustomcolumns_topic6

it's "DataSource" property is used to populate the DropDownList, as you
mentioend that if you set the datasource at
DataGrid_Edit event handler, it's ok for bind items to the dropdownlist
in Edit template. However, since the DropDownList in the Footer template
need to be bind everytime no matter the edit event is fired or not, wo
should assign the DataSource in another place which will be executed
everytime. I think Page's Init or Load event is a proper place, we can
just find the DropDownColumn from the DataGrid's Columns collection and
assign the datasource for it.

Thanks,

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- adding/editing record with a column that uses a
drop dow
| thread-index: AcWihKn30embLAEfQd2071TaNMDU6g==
| X-WBNR-Posting-Host: 198.240.128.75
| From: "=?Utf-8?B?UGF0cmljaw==?=" <(E-Mail Removed)>
| References: <3DB6C92A-15D5-41F9-A133-(E-Mail Removed)>
| Subject: RE: Datagrid- adding/editing record with a column that uses a
drop dow
| Date: Tue, 16 Aug 2005 10:05:12 -0700
| Lines: 35
| Message-ID: <1DD97383-30C5-475A-8EDD-(E-Mail Removed)>
| 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.adonet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.adonet:34112
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| I tried adding the following to The DataGridColumn class:
| 'Case ListItemType.Footer
| ' AddHandler cell.DataBinding, AddressOf
| EditItemDataBinding
| ' Dim DDL As New DropDownList
| ' DDL.ID = "add" + DataField
| ' cell.Controls.Add(DDL)
|
| but when the page loads and following hitting these few lines
| EditItemDataBinding is hit, I get a null exception on For Each
DataSourceItem
| In DataSource, as DataSource had only been initialised at protected void
| UsersDataGrid_Edit(Object sender, DataGridCommandEventArgs e) , which is
good
| enough for data editing, but not for the Footer, how/where could I
initialise
| the DataSource for the footer?
|
| "Patrick" wrote:
|
| > ADO.NET Datagrid do NOT provide native support for
| > 1) Adding records
| > 2) Using Drop-down lists in editing a column
| >
| > However,
| > 1) http://aspnet.4guysfromrolla.com/articles/021203-1.aspx provides an
| > excellent guide on how to add records using template columns
(textboxes, etc.
| > at the footer, and implementing the OnItemCommand event handler)
| > 2)
| >
http://msdn.microsoft.com/library/en...stomcolumns.as
p?frame=true#creatingcustomcolumns_topic6
| > provides an equally excellent article on how to use a drop down column
| >
| > However, I can I combine the two together such that
| > 1) In Normal view (when not editing), all data appears as plain-text
| > 2) When Edit button/link is clicked, the column specified to use
| > DropDownColumn appears as a drop-down list
| > 3) At the footer, a drop-down list of DropDownColumn type is used.
| >
|

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      24th Aug 2005
Hi Patrick,

Have you got a chance to view the suggestions in my last reply or have you
got any further progress on this issue? If there're anything else we can
help, please feel free to post here. Thanks,

Steven Cheng
Microsoft Online Support

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


--------------------
| X-Tomcat-ID: 62051915
| References: <3DB6C92A-15D5-41F9-A133-(E-Mail Removed)>
<1DD97383-30C5-475A-8EDD-(E-Mail Removed)>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (E-Mail Removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Wed, 17 Aug 2005 03:20:57 GMT
| Subject: RE: Datagrid- adding/editing record with a column that uses a
drop dow
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| Message-ID: <(E-Mail Removed)>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Lines: 99
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.adonet:34164
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Hi Patrick,
|
| Welcome to MSDN newsgroup.
| As for the Custom DropDownColumn in the below tech article:
|
|
http://msdn.microsoft.com/library/en...stomcolumns.as
| p?frame=true#creatingcustomcolumns_topic6
|
| it's "DataSource" property is used to populate the DropDownList, as you
| mentioend that if you set the datasource at
| DataGrid_Edit event handler, it's ok for bind items to the dropdownlist
| in Edit template. However, since the DropDownList in the Footer template
| need to be bind everytime no matter the edit event is fired or not, wo
| should assign the DataSource in another place which will be executed
| everytime. I think Page's Init or Load event is a proper place, we can
| just find the DropDownColumn from the DataGrid's Columns collection and
| assign the datasource for it.
|
| Thanks,
|
| 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- adding/editing record with a column that uses a
| drop dow
| | thread-index: AcWihKn30embLAEfQd2071TaNMDU6g==
| | X-WBNR-Posting-Host: 198.240.128.75
| | From: "=?Utf-8?B?UGF0cmljaw==?=" <(E-Mail Removed)>
| | References: <3DB6C92A-15D5-41F9-A133-(E-Mail Removed)>
| | Subject: RE: Datagrid- adding/editing record with a column that uses a
| drop dow
| | Date: Tue, 16 Aug 2005 10:05:12 -0700
| | Lines: 35
| | Message-ID: <1DD97383-30C5-475A-8EDD-(E-Mail Removed)>
| | 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.adonet
| | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
| | Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.adonet:34112
| | X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| |
| | I tried adding the following to The DataGridColumn class:
| | 'Case ListItemType.Footer
| | ' AddHandler cell.DataBinding, AddressOf
| | EditItemDataBinding
| | ' Dim DDL As New DropDownList
| | ' DDL.ID = "add" + DataField
| | ' cell.Controls.Add(DDL)
| |
| | but when the page loads and following hitting these few lines
| | EditItemDataBinding is hit, I get a null exception on For Each
| DataSourceItem
| | In DataSource, as DataSource had only been initialised at protected
void
| | UsersDataGrid_Edit(Object sender, DataGridCommandEventArgs e) , which
is
| good
| | enough for data editing, but not for the Footer, how/where could I
| initialise
| | the DataSource for the footer?
| |
| | "Patrick" wrote:
| |
| | > ADO.NET Datagrid do NOT provide native support for
| | > 1) Adding records
| | > 2) Using Drop-down lists in editing a column
| | >
| | > However,
| | > 1) http://aspnet.4guysfromrolla.com/articles/021203-1.aspx provides
an
| | > excellent guide on how to add records using template columns
| (textboxes, etc.
| | > at the footer, and implementing the OnItemCommand event handler)
| | > 2)
| | >
|
http://msdn.microsoft.com/library/en...stomcolumns.as
| p?frame=true#creatingcustomcolumns_topic6
| | > provides an equally excellent article on how to use a drop down column
| | >
| | > However, I can I combine the two together such that
| | > 1) In Normal view (when not editing), all data appears as plain-text
| | > 2) When Edit button/link is clicked, the column specified to use
| | > DropDownColumn appears as a drop-down list
| | > 3) At the footer, a drop-down list of DropDownColumn type is used.
| | >
| |
|
|

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Editing a record from a datagrid. =?Utf-8?B?Z2VvZGV2?= Microsoft ASP .NET 2 20th Oct 2005 05:20 PM
editing by column insted of by row in a DataGrid Schultz Microsoft ASP .NET 0 6th May 2005 05:30 PM
editing by column insted of by row in a DataGrid Schultz Microsoft ASP .NET 1 5th May 2005 12:01 AM
Editing toolbars and adding to your drop down menu =?Utf-8?B?YW5l?= Microsoft Outlook Discussion 1 10th Mar 2005 01:32 PM
save record in datagrid while still editing jaYPee Microsoft VB .NET 2 22nd Apr 2004 11:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:12 PM.