I
Iain
Hi All
Using Delphi 2006 developer - C# Project
I have the following 2 event handlers for the datagrid - see botton of
page
Both events will fire off correctly but i have a problem collecting the
correct data in teh Update event - I have noted the problem in the
event handler
protected void Livery_DeleteCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string LLivery = e.Item.Cells[1].Text;
string LLeadTime = e.Item.Cells[2].Text;
int LRow = e.Item.ItemIndex;
// If I step through this I can see the values of the cells of the
row highlighted when I press the delete button
}
protected void Livery_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string LLivery = e.Item.Cells[1].Text;
string LLeadTime = e.Item.Cells[2].Text;
int LRow = e.Item.ItemIndex;
// If I step through this the values of e.Item.Cells[1].Text and
// e.Item.Cells[2].Text are blank. I could understand if the
// value contained the old (pre-update) values or the
// new (post-update) values but the fields are blank ?????
// e.Item.ItemIndex is showing the correct row index
}
Can anyone advise me why this is so and if so how do I rectify the
situation.
Many thanks in advance for assistance offered
Iain
<asp:datagrid id="Livery" runat="server"
allowsorting="True"
EnableViewState="true"
itemstyle-verticalalign="top"
headerstyle-font-bold="true"
headerstyle-forecolor="white"
headerstyle-backcolor="black"
autogeneratecolumns="false" font-size="8pt"
cellpadding="5"
width="92%"
onsortcommand="Livery_SortCommand"
ondeletecommand="Livery_DeleteCommand"
oneditcommand="Livery_EditCommand"
onupdatecommand="Livery_UpdateCommand"
oncancelcommand="Livery_CancelCommand">
<EditItemStyle borderstyle="Dashed"
bordercolor="#0000C0"
backcolor="#FFFFC0">
</EditItemStyle>
<ItemStyle verticalalign="Top">
</ItemStyle>
<HeaderStyle font-bold="True"
forecolor="White"
backcolor="Black">
</HeaderStyle>
<Columns>
<ASP:EditCommandColumn
buttontype="PushButton"
updatetext="Update"
headertext="Edit"
canceltext="Cancel"
edittext="Edit">
</ASP:EditCommandColumn>
<ASP:BoundColumn datafield="LIVNAME"
headertext="Livery Name">
</ASP:BoundColumn>
<ASP:BoundColumn datafield="LEADTIME"
headertext="Lead Time">
</ASP:BoundColumn>
<ASP:ButtonColumn text="Delete"
buttontype="PushButton"
headertext="Delete"
commandname="Delete">
</ASP:ButtonColumn>
</Columns>
</asp:datagrid>
Using Delphi 2006 developer - C# Project
I have the following 2 event handlers for the datagrid - see botton of
page
Both events will fire off correctly but i have a problem collecting the
correct data in teh Update event - I have noted the problem in the
event handler
protected void Livery_DeleteCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string LLivery = e.Item.Cells[1].Text;
string LLeadTime = e.Item.Cells[2].Text;
int LRow = e.Item.ItemIndex;
// If I step through this I can see the values of the cells of the
row highlighted when I press the delete button
}
protected void Livery_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string LLivery = e.Item.Cells[1].Text;
string LLeadTime = e.Item.Cells[2].Text;
int LRow = e.Item.ItemIndex;
// If I step through this the values of e.Item.Cells[1].Text and
// e.Item.Cells[2].Text are blank. I could understand if the
// value contained the old (pre-update) values or the
// new (post-update) values but the fields are blank ?????
// e.Item.ItemIndex is showing the correct row index
}
Can anyone advise me why this is so and if so how do I rectify the
situation.
Many thanks in advance for assistance offered
Iain
<asp:datagrid id="Livery" runat="server"
allowsorting="True"
EnableViewState="true"
itemstyle-verticalalign="top"
headerstyle-font-bold="true"
headerstyle-forecolor="white"
headerstyle-backcolor="black"
autogeneratecolumns="false" font-size="8pt"
cellpadding="5"
width="92%"
onsortcommand="Livery_SortCommand"
ondeletecommand="Livery_DeleteCommand"
oneditcommand="Livery_EditCommand"
onupdatecommand="Livery_UpdateCommand"
oncancelcommand="Livery_CancelCommand">
<EditItemStyle borderstyle="Dashed"
bordercolor="#0000C0"
backcolor="#FFFFC0">
</EditItemStyle>
<ItemStyle verticalalign="Top">
</ItemStyle>
<HeaderStyle font-bold="True"
forecolor="White"
backcolor="Black">
</HeaderStyle>
<Columns>
<ASP:EditCommandColumn
buttontype="PushButton"
updatetext="Update"
headertext="Edit"
canceltext="Cancel"
edittext="Edit">
</ASP:EditCommandColumn>
<ASP:BoundColumn datafield="LIVNAME"
headertext="Livery Name">
</ASP:BoundColumn>
<ASP:BoundColumn datafield="LEADTIME"
headertext="Lead Time">
</ASP:BoundColumn>
<ASP:ButtonColumn text="Delete"
buttontype="PushButton"
headertext="Delete"
commandname="Delete">
</ASP:ButtonColumn>
</Columns>
</asp:datagrid>