D
David
Hi all,
I have a datalist that I can put into edit then into update.
In my update datalist function, I call another function passing the
DataListCommandEventArgs which actually does the update work instead of
relying on the update (mainly because I need to control the update from
another event).
The problem I have is when I click edit, then click edit on another row
(without cancelling or updating the first row) I want to update the first
edit row before putting the next row into edit mode. This is where I call
the function that I pass the DataListCommandEventArgs to.
It is easier to explain in code...
protected void DefectListDL_EditCommand(object source,
DataListCommandEventArgs e)
{
if (DefectListDL.EditItemIndex >= 0)
{
UpdateDefectDL(e);
}
DefectListDL.EditItemIndex = e.Item.ItemIndex;
BuildIncomingDefects();
}
As you can see, when I click edit, I check if something is already being
editted, then I want to call the update function.
However, my problem is that when I call the UpdateDefectDL, any time I try
to reference an item, it is wanting to reference the row based on the
current ItemIndex rather than the current EditItemIndex.
This is fine when I do a save on the current row, but not when I click to
edit another row.
Simplistically, if in my updatedefectdl function...
private void UpdateDefectDL(DataListCommandEventArgs e)
{
string MyID = ((TextBox)e.Item.FindControl("DBRowIDTB")).Text
}
the MyID will attempt to get the item from the current ItemIndex, however, I
cannot see any way to get a specific row from the datalist. Not even if I
reference the DL directly.
(I have done the same with a gridview and that works well... I just cannot
make it work with the DataList)
Any ideas?
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
I have a datalist that I can put into edit then into update.
In my update datalist function, I call another function passing the
DataListCommandEventArgs which actually does the update work instead of
relying on the update (mainly because I need to control the update from
another event).
The problem I have is when I click edit, then click edit on another row
(without cancelling or updating the first row) I want to update the first
edit row before putting the next row into edit mode. This is where I call
the function that I pass the DataListCommandEventArgs to.
It is easier to explain in code...
protected void DefectListDL_EditCommand(object source,
DataListCommandEventArgs e)
{
if (DefectListDL.EditItemIndex >= 0)
{
UpdateDefectDL(e);
}
DefectListDL.EditItemIndex = e.Item.ItemIndex;
BuildIncomingDefects();
}
As you can see, when I click edit, I check if something is already being
editted, then I want to call the update function.
However, my problem is that when I call the UpdateDefectDL, any time I try
to reference an item, it is wanting to reference the row based on the
current ItemIndex rather than the current EditItemIndex.
This is fine when I do a save on the current row, but not when I click to
edit another row.
Simplistically, if in my updatedefectdl function...
private void UpdateDefectDL(DataListCommandEventArgs e)
{
string MyID = ((TextBox)e.Item.FindControl("DBRowIDTB")).Text
}
the MyID will attempt to get the item from the current ItemIndex, however, I
cannot see any way to get a specific row from the datalist. Not even if I
reference the DL directly.
(I have done the same with a gridview and that works well... I just cannot
make it work with the DataList)
Any ideas?
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available