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"
</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
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"
</tr>Text=' said:</asp:TextBox></td>
</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