DataItem in DataListItem is null.

M

Mirek Endys

Hello,

the problem I have now, is:

Im binding generic collection based on List<iDB2SQLTransferItem> //
iDB2SQLTransferItem is my class // into WebCOntrol DataList. But the
DataItem of the DataListCommandEventArgs is null. Here is my code:

private MyData.iDB2SQLTransfers transfers = null;

protected void Page_Load(object sender, EventArgs e)
{
AppSettingsReader apReader = new AppSettingsReader();
string dtdPath = (string)apReader.GetValue("DTDPath", typeof(string));
transfers = iDB2SQLTransfers.Load(dtdPath);
this.dlDTDefinitions.DataSource = transfers;
this.dlDTDefinitions.DataBind();
}

protected void dlDTDefinitions_ItemCommand(object source,
DataListCommandEventArgs e)
{
switch(e.CommandName)
{

case "Save":
// Here i suppose, that in the DataItem is edited item typeof
iDB2SQLTransferItem
// but it is null. (ListItemType is right - EditItem)
iDB2SQLTransferItem item = (iDB2SQLTransferItem)e.Item.DataItem
dlDTDefinitions.EditItemIndex = -1;
dlDTDefinitions.SelectedIndex = e.Item.ItemIndex;
break;
}

---------------------------------------------
Code in aspx page // Only EditItemTemplate //
---------------------------------------------

<EditItemTemplate>
<table>
<tr>
<td>ID:</td>
<td nowrap="nowrap" valign="top"><%#
DataBinder.Eval(Container.DataItem, "ID")%></td>
<td>Caption:</td>
<td>
<asp:TextBox ID="txtCaption" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Caption") %>'></asp:TextBox></td>
<td>Description:</td>
<td>
<asp:TextBox ID="txtDescription" runat="server"
Text=' said:
</asp:TextBox></td>
</tr>
</table>

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

All is working well, data are viewed, commands are working well, but on Save
command I need to get edited iDB2SQLTransferItem and save it.

Thanks for ideas.

Mirek
 
S

Steven Cheng[MSFT]

Hi Mirek,

Welcome to ASPNET newsgroup.
Regarding on the DataList databinding with Generic List instance problem, I
think we should use the DataList's "ItemDataBound" event instead of the
"ItemCommand" event. The "Itemcommand" event is used for processing
DataList's Postback events , such as "Edit", "update".... If we need to
programmatically access the current bound datasource's dataitems and do
customization on the DataList's inner Control with the DataItem, we should
use the "ItemDataBound" event , this event will be fired when each DataItem
has been bound to the DataList's certain Row.....

If there're anything else unclear, 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.)




--------------------
| From: "Mirek Endys" <[email protected]>
| Subject: DataItem in DataListItem is null.
| Date: Mon, 21 Nov 2005 10:01:33 +0100
| Lines: 67
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| Message-ID: <[email protected]>
| Newsgroups:
microsoft.public.dotnet.framework.aspnet,microsoft.public.dotnet.framework.a
spnet.webcontrols
| NNTP-Posting-Host: gw.coty.cz 195.47.52.129
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:31227
microsoft.public.dotnet.framework.aspnet:359739
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hello,
|
| the problem I have now, is:
|
| Im binding generic collection based on List<iDB2SQLTransferItem> //
| iDB2SQLTransferItem is my class // into WebCOntrol DataList. But the
| DataItem of the DataListCommandEventArgs is null. Here is my code:
|
| private MyData.iDB2SQLTransfers transfers = null;
|
| protected void Page_Load(object sender, EventArgs e)
| {
| AppSettingsReader apReader = new AppSettingsReader();
| string dtdPath = (string)apReader.GetValue("DTDPath", typeof(string));
| transfers = iDB2SQLTransfers.Load(dtdPath);
| this.dlDTDefinitions.DataSource = transfers;
| this.dlDTDefinitions.DataBind();
| }
|
| protected void dlDTDefinitions_ItemCommand(object source,
| DataListCommandEventArgs e)
| {
| switch(e.CommandName)
| {
|
| case "Save":
| // Here i suppose, that in the DataItem is edited item typeof
| iDB2SQLTransferItem
| // but it is null. (ListItemType is right - EditItem)
| iDB2SQLTransferItem item =
(iDB2SQLTransferItem)e.Item.DataItem
| dlDTDefinitions.EditItemIndex = -1;
| dlDTDefinitions.SelectedIndex = e.Item.ItemIndex;
| break;
| }
|
| ---------------------------------------------
| Code in aspx page // Only EditItemTemplate //
| ---------------------------------------------
|
| <EditItemTemplate>
| <table>
| <tr>
| <td>ID:</td>
| <td nowrap="nowrap" valign="top"><%#
| DataBinder.Eval(Container.DataItem, "ID")%></td>
| <td>Caption:</td>
| <td>
| <asp:TextBox ID="txtCaption" runat="server" Text='<%#
| DataBinder.Eval(Container.DataItem, "Caption") %>'></asp:TextBox></td>
| <td>Description:</td>
| <td>
| <asp:TextBox ID="txtDescription" runat="server"
| Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'
| ></asp:TextBox></td>
| </tr>
| </table>
|
| ==================================================
|
| All is working well, data are viewed, commands are working well, but on
Save
| command I need to get edited iDB2SQLTransferItem and save it.
|
| Thanks for ideas.
|
| Mirek
|
|
|
 
S

Steven Cheng[MSFT]

Hi Mirek,

How are you doing on this issue , does the suggestion in my last reply
helps a little?
If threre'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: 27416236
| References: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Tue, 22 Nov 2005 01:24:42 GMT
| Subject: RE: DataItem in DataListItem is null.
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Lines: 102
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:360011
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi Mirek,
|
| Welcome to ASPNET newsgroup.
| Regarding on the DataList databinding with Generic List instance problem,
I
| think we should use the DataList's "ItemDataBound" event instead of the
| "ItemCommand" event. The "Itemcommand" event is used for processing
| DataList's Postback events , such as "Edit", "update".... If we need to
| programmatically access the current bound datasource's dataitems and do
| customization on the DataList's inner Control with the DataItem, we
should
| use the "ItemDataBound" event , this event will be fired when each
DataItem
| has been bound to the DataList's certain Row.....
|
| If there're anything else unclear, 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.)
|
|
|
|
| --------------------
| | From: "Mirek Endys" <[email protected]>
| | Subject: DataItem in DataListItem is null.
| | Date: Mon, 21 Nov 2005 10:01:33 +0100
| | Lines: 67
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| | X-RFC2646: Format=Flowed; Original
| | Message-ID: <[email protected]>
| | Newsgroups:
|
microsoft.public.dotnet.framework.aspnet,microsoft.public.dotnet.framework.a
| spnet.webcontrols
| | NNTP-Posting-Host: gw.coty.cz 195.47.52.129
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| | Xref: TK2MSFTNGXA02.phx.gbl
| microsoft.public.dotnet.framework.aspnet.webcontrols:31227
| microsoft.public.dotnet.framework.aspnet:359739
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | Hello,
| |
| | the problem I have now, is:
| |
| | Im binding generic collection based on List<iDB2SQLTransferItem> //
| | iDB2SQLTransferItem is my class // into WebCOntrol DataList. But the
| | DataItem of the DataListCommandEventArgs is null. Here is my code:
| |
| | private MyData.iDB2SQLTransfers transfers = null;
| |
| | protected void Page_Load(object sender, EventArgs e)
| | {
| | AppSettingsReader apReader = new AppSettingsReader();
| | string dtdPath = (string)apReader.GetValue("DTDPath",
typeof(string));
| | transfers = iDB2SQLTransfers.Load(dtdPath);
| | this.dlDTDefinitions.DataSource = transfers;
| | this.dlDTDefinitions.DataBind();
| | }
| |
| | protected void dlDTDefinitions_ItemCommand(object source,
| | DataListCommandEventArgs e)
| | {
| | switch(e.CommandName)
| | {
| |
| | case "Save":
| | // Here i suppose, that in the DataItem is edited item
typeof
| | iDB2SQLTransferItem
| | // but it is null. (ListItemType is right - EditItem)
| | iDB2SQLTransferItem item =
| (iDB2SQLTransferItem)e.Item.DataItem
| | dlDTDefinitions.EditItemIndex = -1;
| | dlDTDefinitions.SelectedIndex = e.Item.ItemIndex;
| | break;
| | }
| |
| | ---------------------------------------------
| | Code in aspx page // Only EditItemTemplate //
| | ---------------------------------------------
| |
| | <EditItemTemplate>
| | <table>
| | <tr>
| | <td>ID:</td>
| | <td nowrap="nowrap" valign="top"><%#
| | DataBinder.Eval(Container.DataItem, "ID")%></td>
| | <td>Caption:</td>
| | <td>
| | <asp:TextBox ID="txtCaption" runat="server" Text='<%#
| | DataBinder.Eval(Container.DataItem, "Caption") %>'></asp:TextBox></td>
| | <td>Description:</td>
| | <td>
| | <asp:TextBox ID="txtDescription" runat="server"
| | Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'
| | ></asp:TextBox></td>
| | </tr>
| | </table>
| |
| | ==================================================
| |
| | All is working well, data are viewed, commands are working well, but on
| Save
| | command I need to get edited iDB2SQLTransferItem and save it.
| |
| | Thanks for ideas.
| |
| | Mirek
| |
| |
| |
|
|
 
M

Mirek Endys

Thanks, it works well.


Steven Cheng said:
Hi Mirek,

How are you doing on this issue , does the suggestion in my last reply
helps a little?
If threre'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: 27416236
| References: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Tue, 22 Nov 2005 01:24:42 GMT
| Subject: RE: DataItem in DataListItem is null.
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Lines: 102
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:360011
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi Mirek,
|
| Welcome to ASPNET newsgroup.
| Regarding on the DataList databinding with Generic List instance
problem,
I
| think we should use the DataList's "ItemDataBound" event instead of the
| "ItemCommand" event. The "Itemcommand" event is used for processing
| DataList's Postback events , such as "Edit", "update".... If we need
to
| programmatically access the current bound datasource's dataitems and do
| customization on the DataList's inner Control with the DataItem, we
should
| use the "ItemDataBound" event , this event will be fired when each
DataItem
| has been bound to the DataList's certain Row.....
|
| If there're anything else unclear, 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.)
|
|
|
|
| --------------------
| | From: "Mirek Endys" <[email protected]>
| | Subject: DataItem in DataListItem is null.
| | Date: Mon, 21 Nov 2005 10:01:33 +0100
| | Lines: 67
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| | X-RFC2646: Format=Flowed; Original
| | Message-ID: <[email protected]>
| | Newsgroups:
|
microsoft.public.dotnet.framework.aspnet,microsoft.public.dotnet.framework.a
| spnet.webcontrols
| | NNTP-Posting-Host: gw.coty.cz 195.47.52.129
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| | Xref: TK2MSFTNGXA02.phx.gbl
| microsoft.public.dotnet.framework.aspnet.webcontrols:31227
| microsoft.public.dotnet.framework.aspnet:359739
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | Hello,
| |
| | the problem I have now, is:
| |
| | Im binding generic collection based on List<iDB2SQLTransferItem> //
| | iDB2SQLTransferItem is my class // into WebCOntrol DataList. But the
| | DataItem of the DataListCommandEventArgs is null. Here is my code:
| |
| | private MyData.iDB2SQLTransfers transfers = null;
| |
| | protected void Page_Load(object sender, EventArgs e)
| | {
| | AppSettingsReader apReader = new AppSettingsReader();
| | string dtdPath = (string)apReader.GetValue("DTDPath",
typeof(string));
| | transfers = iDB2SQLTransfers.Load(dtdPath);
| | this.dlDTDefinitions.DataSource = transfers;
| | this.dlDTDefinitions.DataBind();
| | }
| |
| | protected void dlDTDefinitions_ItemCommand(object source,
| | DataListCommandEventArgs e)
| | {
| | switch(e.CommandName)
| | {
| |
| | case "Save":
| | // Here i suppose, that in the DataItem is edited item
typeof
| | iDB2SQLTransferItem
| | // but it is null. (ListItemType is right - EditItem)
| | iDB2SQLTransferItem item =
| (iDB2SQLTransferItem)e.Item.DataItem
| | dlDTDefinitions.EditItemIndex = -1;
| | dlDTDefinitions.SelectedIndex = e.Item.ItemIndex;
| | break;
| | }
| |
| | ---------------------------------------------
| | Code in aspx page // Only EditItemTemplate //
| | ---------------------------------------------
| |
| | <EditItemTemplate>
| | <table>
| | <tr>
| | <td>ID:</td>
| | <td nowrap="nowrap" valign="top"><%#
| | DataBinder.Eval(Container.DataItem, "ID")%></td>
| | <td>Caption:</td>
| | <td>
| | <asp:TextBox ID="txtCaption" runat="server" Text='<%#
| | DataBinder.Eval(Container.DataItem, "Caption") %>'></asp:TextBox></td>
| | <td>Description:</td>
| | <td>
| | <asp:TextBox ID="txtDescription" runat="server"
| | Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'
| | ></asp:TextBox></td>
| | </tr>
| | </table>
| |
| | ==================================================
| |
| | All is working well, data are viewed, commands are working well, but
on
| Save
| | command I need to get edited iDB2SQLTransferItem and save it.
| |
| | Thanks for ideas.
| |
| | Mirek
| |
| |
| |
|
|
 
S

Steven Cheng[MSFT]

You're welcome Mirek,

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: "Mirek Endys" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: DataItem in DataListItem is null.
| Date: Fri, 25 Nov 2005 13:33:56 +0100
| Lines: 170
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: gw.coty.cz 195.47.52.129
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:360889
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks, it works well.
|
|
| | > Hi Mirek,
| >
| > How are you doing on this issue , does the suggestion in my last reply
| > helps a little?
| > If threre'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: 27416236
| > | References: <[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain
| > | Content-Transfer-Encoding: 7bit
| > | From: (e-mail address removed) (Steven Cheng[MSFT])
| > | Organization: Microsoft
| > | Date: Tue, 22 Nov 2005 01:24:42 GMT
| > | Subject: RE: DataItem in DataListItem is null.
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | Lines: 102
| > | Path: TK2MSFTNGXA02.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:360011
| > | NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
| > |
| > | Hi Mirek,
| > |
| > | Welcome to ASPNET newsgroup.
| > | Regarding on the DataList databinding with Generic List instance
| > problem,
| > I
| > | think we should use the DataList's "ItemDataBound" event instead of
the
| > | "ItemCommand" event. The "Itemcommand" event is used for processing
| > | DataList's Postback events , such as "Edit", "update".... If we
need
| > to
| > | programmatically access the current bound datasource's dataitems and
do
| > | customization on the DataList's inner Control with the DataItem, we
| > should
| > | use the "ItemDataBound" event , this event will be fired when each
| > DataItem
| > | has been bound to the DataList's certain Row.....
| > |
| > | If there're anything else unclear, 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.)
| > |
| > |
| > |
| > |
| > | --------------------
| > | | From: "Mirek Endys" <[email protected]>
| > | | Subject: DataItem in DataListItem is null.
| > | | Date: Mon, 21 Nov 2005 10:01:33 +0100
| > | | Lines: 67
| > | | X-Priority: 3
| > | | X-MSMail-Priority: Normal
| > | | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| > | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| > | | X-RFC2646: Format=Flowed; Original
| > | | Message-ID: <[email protected]>
| > | | Newsgroups:
| > |
| >
microsoft.public.dotnet.framework.aspnet,microsoft.public.dotnet.framework.a
| > | spnet.webcontrols
| > | | NNTP-Posting-Host: gw.coty.cz 195.47.52.129
| > | | Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| > | | Xref: TK2MSFTNGXA02.phx.gbl
| > | microsoft.public.dotnet.framework.aspnet.webcontrols:31227
| > | microsoft.public.dotnet.framework.aspnet:359739
| > | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | |
| > | | Hello,
| > | |
| > | | the problem I have now, is:
| > | |
| > | | Im binding generic collection based on List<iDB2SQLTransferItem> //
| > | | iDB2SQLTransferItem is my class // into WebCOntrol DataList. But the
| > | | DataItem of the DataListCommandEventArgs is null. Here is my code:
| > | |
| > | | private MyData.iDB2SQLTransfers transfers = null;
| > | |
| > | | protected void Page_Load(object sender, EventArgs e)
| > | | {
| > | | AppSettingsReader apReader = new AppSettingsReader();
| > | | string dtdPath = (string)apReader.GetValue("DTDPath",
| > typeof(string));
| > | | transfers = iDB2SQLTransfers.Load(dtdPath);
| > | | this.dlDTDefinitions.DataSource = transfers;
| > | | this.dlDTDefinitions.DataBind();
| > | | }
| > | |
| > | | protected void dlDTDefinitions_ItemCommand(object source,
| > | | DataListCommandEventArgs e)
| > | | {
| > | | switch(e.CommandName)
| > | | {
| > | |
| > | | case "Save":
| > | | // Here i suppose, that in the DataItem is edited item
| > typeof
| > | | iDB2SQLTransferItem
| > | | // but it is null. (ListItemType is right - EditItem)
| > | | iDB2SQLTransferItem item =
| > | (iDB2SQLTransferItem)e.Item.DataItem
| > | | dlDTDefinitions.EditItemIndex = -1;
| > | | dlDTDefinitions.SelectedIndex = e.Item.ItemIndex;
| > | | break;
| > | | }
| > | |
| > | | ---------------------------------------------
| > | | Code in aspx page // Only EditItemTemplate //
| > | | ---------------------------------------------
| > | |
| > | | <EditItemTemplate>
| > | | <table>
| > | | <tr>
| > | | <td>ID:</td>
| > | | <td nowrap="nowrap" valign="top"><%#
| > | | DataBinder.Eval(Container.DataItem, "ID")%></td>
| > | | <td>Caption:</td>
| > | | <td>
| > | | <asp:TextBox ID="txtCaption" runat="server"
Text='<%#
| > | | DataBinder.Eval(Container.DataItem, "Caption")
%>'></asp:TextBox></td>
| > | | <td>Description:</td>
| > | | <td>
| > | | <asp:TextBox ID="txtDescription" runat="server"
| > | | Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'
| > | | ></asp:TextBox></td>
| > | | </tr>
| > | | </table>
| > | |
| > | | ==================================================
| > | |
| > | | All is working well, data are viewed, commands are working well,
but
| > on
| > | Save
| > | | command I need to get edited iDB2SQLTransferItem and save it.
| > | |
| > | | Thanks for ideas.
| > | |
| > | | Mirek
| > | |
| > | |
| > | |
| > |
| > |
| >
|
|
|
 
H

Henning Eiben

Steven said:
Hi Mirek,

Welcome to ASPNET newsgroup.
Regarding on the DataList databinding with Generic List instance problem, I
think we should use the DataList's "ItemDataBound" event instead of the
"ItemCommand" event. The "Itemcommand" event is used for processing
DataList's Postback events , such as "Edit", "update".... If we need to
programmatically access the current bound datasource's dataitems and do
customization on the DataList's inner Control with the DataItem, we should
use the "ItemDataBound" event , this event will be fired when each DataItem
has been bound to the DataList's certain Row.....

If there're anything else unclear, please feel free to post here.


|
| Hello,
|
| the problem I have now, is:
|
| Im binding generic collection based on List<iDB2SQLTransferItem> //
| iDB2SQLTransferItem is my class // into WebCOntrol DataList. But the
| DataItem of the DataListCommandEventArgs is null. Here is my code:
|

Well, I have a similar but sligthly different problem :) I have a
ButtonColumn in my DataGrid (which is populated by an arraylist of
custom objects). When the users clicks on the button, I would like to
access the custom object that was "selected". So I tried:

private void ResultListGrid_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if (((LinkButton)e.CommandSource).CommandName == "Select")
{
WhoIsWhoPerson mySelectedPerson = (WhoIsWhoPerson)e.Item.DataItem;


but "mySelectedPerson" is always "empty" ... any suggestions?
 
H

Henning Eiben

Steven said:
Hi Mirek,

Welcome to ASPNET newsgroup.
Regarding on the DataList databinding with Generic List instance problem, I
think we should use the DataList's "ItemDataBound" event instead of the
"ItemCommand" event. The "Itemcommand" event is used for processing
DataList's Postback events , such as "Edit", "update".... If we need to
programmatically access the current bound datasource's dataitems and do
customization on the DataList's inner Control with the DataItem, we should
use the "ItemDataBound" event , this event will be fired when each DataItem
has been bound to the DataList's certain Row.....

If there're anything else unclear, please feel free to post here.


|
| Hello,
|
| the problem I have now, is:
|
| Im binding generic collection based on List<iDB2SQLTransferItem> //
| iDB2SQLTransferItem is my class // into WebCOntrol DataList. But the
| DataItem of the DataListCommandEventArgs is null. Here is my code:
|

Well, I have a similar but sligthly different problem :) I have a
ButtonColumn in my DataGrid (which is populated by an arraylist of
custom objects). When the users clicks on the button, I would like to
access the custom object that was "selected". So I tried:

private void ResultListGrid_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if (((LinkButton)e.CommandSource).CommandName == "Select")
{
WhoIsWhoPerson mySelectedPerson = (WhoIsWhoPerson)e.Item.DataItem;


but "mySelectedPerson" is always "empty" ... any suggestions?
 
H

Henning Eiben

Steven said:
Hi Mirek,

Welcome to ASPNET newsgroup.
Regarding on the DataList databinding with Generic List instance problem, I
think we should use the DataList's "ItemDataBound" event instead of the
"ItemCommand" event. The "Itemcommand" event is used for processing
DataList's Postback events , such as "Edit", "update".... If we need to
programmatically access the current bound datasource's dataitems and do
customization on the DataList's inner Control with the DataItem, we should
use the "ItemDataBound" event , this event will be fired when each DataItem
has been bound to the DataList's certain Row.....

If there're anything else unclear, please feel free to post here.


|
| Hello,
|
| the problem I have now, is:
|
| Im binding generic collection based on List<iDB2SQLTransferItem> //
| iDB2SQLTransferItem is my class // into WebCOntrol DataList. But the
| DataItem of the DataListCommandEventArgs is null. Here is my code:
|

Well, I have a similar but sligthly different problem :) I have a
ButtonColumn in my DataGrid (which is populated by an arraylist of
custom objects). When the users clicks on the button, I would like to
access the custom object that was "selected". So I tried:

private void ResultListGrid_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if (((LinkButton)e.CommandSource).CommandName == "Select")
{
WhoIsWhoPerson mySelectedPerson = (WhoIsWhoPerson)e.Item.DataItem;


but "mySelectedPerson" is always "empty" ... any suggestions?
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top