Listview with objectdatasource Delete not working
Posted
by Radhi
on Stack Overflow
See other posts from Stack Overflow
or by Radhi
Published on 2009-12-30T09:47:41Z
Indexed on
2010/03/21
18:11 UTC
Read the original article
Hit count: 341
Hello,
i have one Listview in my Usercontrol & 1 objectdatasource binded with the ListView. now in objectdatasource's Deletemethod i have taken businessobject as argument but at runtime i am not getting value in my businessobject's properties...
i also tried to use "Bind" instead of "eval" in ItemTemplate. but not getting any value at runtime in my DeleteMethod provided in objectdatasource's Deletecommand... can anybody help to know weather i am mising anything or what?
my Listview's ItemTemplate
<ItemTemplate>
<asp:HiddenField ID="hidUserAchievementInfoId" runat="server" Value='<%# Bind("UserAchievementInfoId") %>' />
<asp:HiddenField ID="hidUserIdField" runat="server" Value='<%# Bind("UserId") %>' />
<tr>
<td class="style1">
<asp:Label ID="AwardLabel" runat="server" Text="Award "></asp:Label>
</td>
<td>
<asp:Label ID="lblAward" runat="server" Text='<%# Bind("Awards") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style1">
<asp:Label ID="FieldofAwardLabel" runat="server" Text="Field of Award "></asp:Label>
</td>
<td>
<asp:Label ID="lblFieldofAward" runat="server" Text='<%# Bind("FieldofAward") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style1">
<asp:Label ID="TournamentLabel" runat="server" Text="Tournament "></asp:Label>
</td>
<td>
<asp:Label ID="lblTournament" runat="server" Text='<%# Bind("Tournament") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style1">
<asp:Label ID="AwardYearLabel" runat="server" Text="Award Year "></asp:Label>
</td>
<td>
<asp:Label ID="AwardYear" runat="server" Text='<%# Bind("AwardYear") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style1">
<asp:Label ID="AwardDescriptionLabel" runat="server" Text="Description "></asp:Label>
</td>
<td>
<asp:Label ID="lblAwardDescription" runat="server" Text='<%# Bind("AwardDescription") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style1">
<asp:LinkButton ID="EditButton" runat="server" CommandName="Edit" Text="Edit"></asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete"></asp:LinkButton>
</td>
</tr>
</ItemTemplate>
Delete Method used in objectdata source's Deletecommand
public void DeleteUserAchievementInfo(UserAchivementInfoBO BOInstance)
{
try
{
Int64 UserAchievementInfoId=BOInstance.UserAchievementInfoId
objUserBasicInfoServiceClient.DeleteUserAchievementInfo(UserAchievementInfoId);
}
catch (Exception ex)
{
HandleException.LogError(ex);
}
}
© Stack Overflow or respective owner