Click here to Skip to main content
15,923,557 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: creating an online forum Pin
M A A Mehedi Hasan28-Feb-07 20:41
M A A Mehedi Hasan28-Feb-07 20:41 
AnswerRe: creating an online forum Pin
Vasudevan Deepak Kumar4-Mar-07 2:29
Vasudevan Deepak Kumar4-Mar-07 2:29 
QuestionForms Authentication with Active Directory LDAP Problem Pin
rock05628-Feb-07 9:21
rock05628-Feb-07 9:21 
QuestionCube File Connection string ? Pin
_mubashir28-Feb-07 8:36
_mubashir28-Feb-07 8:36 
AnswerRe: Cube File Connection string ? Pin
Vasudevan Deepak Kumar4-Mar-07 2:29
Vasudevan Deepak Kumar4-Mar-07 2:29 
QuestionProblem with project upload Pin
srinandan..28-Feb-07 6:47
srinandan..28-Feb-07 6:47 
AnswerRe: Problem with project upload Pin
Vasudevan Deepak Kumar4-Mar-07 2:30
Vasudevan Deepak Kumar4-Mar-07 2:30 
QuestionGridView Delete() with ObjectDataSource Pin
Taurian11028-Feb-07 6:33
Taurian11028-Feb-07 6:33 
I am using ObjectDataSource to display records on a Gridview. In my BLL I have three functions GetAll() [returns MyEntity], Save(MyEntity entity) and Delete(MyEntity entity) which make use of a business entity called MyEntity.

The GetAll() and Save(MyEntity entity) works perfectly fine but the Delete(MyEntity entity) does not work at all. This is what my BLL Delete(MyEntity entity) looks like:

[System.ComponentModel.DataObjectMethod(DataObjectMethodType.Delete,true)]
public Boolean Delete(UserEntity tblUserXref)
{
UserXrefDAL dal = new UserXrefDAL();
return dal.Delete(tblUserXref);
}
And my DAL Delete(MyEntity entity) looks like this:


public Boolean Delete(GlobalClassLibrary.Site.Entities.UserXrefEntity entity)
{
try
{
SqlDatabase dbHelper = new SqlDatabase(ConnectionString.GetConnectionString());
SqlCommand dbCommand = (SqlCommand)dbHelper.GetStoredProcCommand("tblUserXrefD");
dbHelper.AddInParameter(dbCommand, "@XrefId", SqlDbType.Int, entity.XrefId);
dbHelper.ExecuteNonQuery(dbCommand);
return true;
}
catch (Exception)
{
throw;
}
}

Now, when I put a break point I found out that Delete button on GridView does call the BLL's Delete(MyEntity entity) method, but, all the values of my entity are null.

<asp:GridView ID="GridView1"
runat="server"
AllowPaging="True"
DataSourceID="odsUserXrefBLL"
AutoGenerateColumns="False">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"></asp:CommandField>
<asp:BoundField DataField="RemoteId" SortExpression="RemoteId" HeaderText="Id"></asp:BoundField>
<asp:BoundField DataField="XrefId" SortExpression="XrefId" HeaderText="XrefId">
</asp:BoundField><asp:BoundField DataField="UserId" SortExpression="UserId" HeaderText="UserId"></asp:BoundField>
<asp:BoundField DataField="siteUserId" SortExpression="siteUserId" HeaderText="siteUserId"></asp:BoundField>
<asp:BoundField DataField="CreationDate" SortExpression="CreationDate" HeaderText="CreationDate"></asp:BoundField>
</Columns>
</asp:GridView>
<asp:ObjectDataSource
ID="odsUserYardXrefBLL"
runat="server"
UpdateMethod="Save"
DataObjectTypeName="GlobalClassLibrary.Site.Entities.UserXrefEntity"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetAll"
DeleteMethod="Delete"
TypeName="GlobalClassLibrary.Site.BLL.UserXrefBLL">
</asp:ObjectDataSource>


Please help. Thanks.
.

AnswerRe: GridView Delete() with ObjectDataSource Pin
Naveed Kamboh28-Feb-07 10:30
Naveed Kamboh28-Feb-07 10:30 
GeneralRe: GridView Delete() with ObjectDataSource Pin
Taurian1105-Mar-07 4:58
Taurian1105-Mar-07 4:58 
GeneralRe: GridView Delete() with ObjectDataSource Pin
Naveed Kamboh5-Mar-07 6:24
Naveed Kamboh5-Mar-07 6:24 
QuestionSorting a dynamically created GridView [modified] Pin
darren2428-Feb-07 6:21
darren2428-Feb-07 6:21 
AnswerRe: Sorting a dynamically created GridView Pin
darren2428-Feb-07 8:45
darren2428-Feb-07 8:45 
QuestionTracking User Clicks Pin
cisco210328-Feb-07 5:35
cisco210328-Feb-07 5:35 
AnswerRe: Tracking User Clicks Pin
SIJUTHOMASP28-Feb-07 13:06
professionalSIJUTHOMASP28-Feb-07 13:06 
QuestionSSL error - unable to download attachments Pin
Cafedreamz28-Feb-07 4:28
Cafedreamz28-Feb-07 4:28 
QuestionSecurity exception with windows server 2003 Pin
Cafedreamz28-Feb-07 4:27
Cafedreamz28-Feb-07 4:27 
QuestionDownload option...? Pin
fmlove28-Feb-07 4:21
fmlove28-Feb-07 4:21 
AnswerRe: Download option...? Pin
Naveed Kamboh28-Feb-07 10:14
Naveed Kamboh28-Feb-07 10:14 
GeneralRe: Download option...? Pin
fmlove28-Feb-07 18:53
fmlove28-Feb-07 18:53 
GeneralRe: Download option...? Pin
Naveed Kamboh28-Feb-07 22:35
Naveed Kamboh28-Feb-07 22:35 
AnswerRe: Download option...? Pin
Vasudevan Deepak Kumar4-Mar-07 2:30
Vasudevan Deepak Kumar4-Mar-07 2:30 
QuestionInserting a new row. Pin
nclauder28-Feb-07 4:09
nclauder28-Feb-07 4:09 
QuestionPopup Control behaviour Pin
John Gathogo28-Feb-07 4:07
John Gathogo28-Feb-07 4:07 
AnswerRe: Popup Control behaviour Pin
Sylvester george28-Feb-07 20:24
Sylvester george28-Feb-07 20:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.