Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > DetailsView ObjectDataSource, and DataSet: Confused

Reply
Thread Tools

DetailsView ObjectDataSource, and DataSet: Confused

 
 
noah.blumenthal@gmail.com
Guest
Posts: n/a
 
      06-18-2007
I am new to asp.net and am learning the concepts and terminology as I
go, so please excuse me if I'm really off base here...

I am trying to add a DetailsView control to a page and have read up on
it and it sure looks easy in all the tutorials I read. However, I do
not wish to use textual SQL statements for my selects/updates/deletes
as the tutorials I have read describe. I already have a DataSet in my
project that has definitions for all my tables and would like to use
that as the datasource for my DetailsView control.

So here's what steps I take. In Design Mode in VS.NET2003, I select
the data source for the DetailsView control. I select "New Data
Source" and then choose and "Object" data source. I select the
DataSet1TableAdapters.userTableAdapter (I'm creating a user edit page
for admins to edit user information) and continue.

Now is where I start having problems. Now under the Update and Delete
tabs there are no methods for me to select. I did some research and
found that I can create methods for updating and deleting data in the
DataSet by visiting the DataSet's TableAdapters properties and so I
did that; I created a stored procedure that I can use to update data,
and then I selected that stored procedure as the UpdateCommand in the
properties of the DataSet's TableAdapters. Then I was given that
UpdateUser(Int32 id, String username, String password, [...]) as an
option under the Update tab of that Configure Data Source window.

I will be using a DataGrid for the admin to select the user to edit
and then the DetailsView will only show that user's info, so I have
set the DefaultMode of the DetailsView to Edit. Now when I run the
site I actually see data in the DetailsView but when I edit it and
press "Update", there is a postback and the original data reappears.
I tried debugging by assigning a method to run on ItemUpdating that
would loop through the new values. Well I did just that:

void DetailsView1_ItemUpdating(object sender,
DetailsViewUpdateEventArgs e)
{
string value;
for (int i = 0; i < e.NewValues.Count ; i++)
{
value = e.NewValues[i].ToString();
}
}

and put a breakpoint at the entrance but when I clicked Update on the
web form and I stepped through the code, that "value" variable I have
always contained the _old_ values, not the newly entered ones.

So this is sort of an all around question because I don't know if I'm
doing this all wrong or if I'm just missing something. I'm leaning
towards the former because another issue I can't seem to answer is how
to pull up a specific record via the DetailsView (currently it always
just pulls up the first row of the table, but obviously I will want to
pull up a specific row to edit).

I've been searching google and trying all kinds of things for hours
and hours. If someone could point me in the right direction I'd
really appreciate it!

Thanks,
Noah

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DetailsView and foreign key and LINQ-to-SQL Craig Buchanan ASP .Net 0 01-16-2009 03:48 PM
DetailsView ObjectDataSource and strongly typed dataset Spotnick ASP .Net 0 01-21-2006 07:56 PM
DetailsView - Changing to Insert Mode (Not By Using the Insert Button In the DetailsView Control) Feege ASP .Net Web Controls 0 12-20-2005 12:28 AM
DetailsView and ObjectDataSource - how to get updated object =?Utf-8?B?SmltIEhhbW1vbmQ=?= ASP .Net 12 10-17-2005 11:27 PM
How to add the DropDownList and TextBox Control in DetailsView Murugan V via DotNetMonster.com ASP .Net 0 01-08-2005 09:27 AM



Advertisments