HELP !!! ObjectDataSource Delete Parameter Problem ASP.NET 2.0

M

Microsoft news

Hi,

I have a problem with delete method:

public static int DeleteEmployee(string original_EmployeeId)

{

return ClassDB.DeleteEmployee(original_EmployeeId);

}



And in aspx :

<asp:ObjectDataSource ID="ObjectDataSource1" Runat="server"
DeleteMethod="DeleteEmployee" TypeName="BusinessObject"
SortParameterName="sortExpression" ></asp:ObjectDataSource>

Any advice please I have a pb to pass parameter !!!!

I tried also with <DeleteParameter> ... the same pb



Thanks

Tarek.
 
M

Microsoft news

Hi again,

I solved the problem , I added the DataKeyNames for the GridView and this is
logical because when you need to delete something you should use the primary
key (by mistake DataKeyNames not defined), and i used the same code but
attention for (original_)

public static int DeleteEmployee(string original_EmployeeId)
{
return ClassDB.DeleteEmployee(original_EmployeeId);
}

And in aspx :
<asp:GridView ............ DataKeyNames="EmployeeId" >.....</asp:GridView>

<asp:ObjectDataSource ID="ObjectDataSource1" Runat="server"
DeleteMethod="DeleteEmployee" TypeName="BusinessObject"
SortParameterName="sortExpression" ></asp:ObjectDataSource>

Thanks,

Tarek
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top