473,396 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DetailsView ItemUpdating woes...

Hi Everyone,

I am having a massive issue trying to get custom data into my DV. What I
want to do is sooo simple:

1. I have a single DV on a page
2. I created my own template (see below)
3. I created the DetailsViewDataBinging sub which populates the field using
a datatable
4. I created a ModeChanging Event handler to allow me to change the mode
into EDIT mode
5. I created a ItemUpdating mode to handle the item update.

No matter what I do or what I put in, the e.NewValues or e.OldValue
contain NOTHING... Whan I do a count I see 0 everytime. Non of my fields are
Template fields and they are all databound. Everything works with any
issues, just no data is ever returned.

I hope these shed some light:

DETAILSVIEW1
################################################## ###############
<asp:DetailsView ID="DetailsView1" runat="server" Width="125px"
AutoGenerateRows="False">

<Fields>

<asp:BoundField DataField="FirstName" HeaderText="First Name:" />

<asp:BoundField DataField="LastName" HeaderText="Last Name:" />

<asp:BoundField DataField="DisplayName" HeaderText="Display Name:" />

<asp:BoundField DataField="Description" HeaderText="Description:" />

<asp:BoundField DataField="PrimaryEmail" HeaderText="Primary Email:"
ReadOnly="True" />

<asp:CommandField ShowEditButton="True" ShowDeleteButton="True" />

</Fields>

</asp:DetailsView>
Protected Sub DetailsView1_ModeChanging(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewModeEventArgs ) Handles
DetailsView1.ModeChanging

'# When the form mode changes we handle how the form loads and what it looks
like here

Select Case e.NewMode

'Put into edit mode and databind

Case DetailsViewMode.Edit

DetailsView1.ChangeMode(DetailsViewMode.Edit)

'BindDetailsView()

'Put into insert mode

Case DetailsViewMode.Insert

'put into read only mode and databind

Case DetailsViewMode.ReadOnly

DetailsView1.ChangeMode(DetailsViewMode.ReadOnly)

BindDetailsView()

End Select

End Sub

Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewUpdateEventAr gs) Handles
DetailsView1.ItemUpdating
Response.Write(e.NewValues.Count)

End Sub

What Else am I missing here? This is driving me batty as I cannotdo anything
with my data. All I want to do is intercept the NewValues and put them in my
custom data solution.

-Timothy
Oct 25 '06 #1
1 7714
UPDATE:

Ok I dont know why this is, but maybe someone can explain it to me.

My custom data routine that I was using to bind data to my DetailsView was
comming from the active directory. I had created all of the databindings and
everything was working very well. But I could not delete or update any data
as it would tell me there were no fields upon the post back in the
ItemDeleting or ItemUpdating event handlers.

As an experiment I have created an ODS (ObjectDataSource) that has custome
select and custom UPdate routines. I create a USER and EMAILUSER class and
populated them with their corresponding attributes. I was then able to go
back to my test page and drop an ODS connector on there and attach to the
custom select and update routines. I bound that to the DetailsView and low
and behold it works! It now returns the correct number of fields.

Why is it when I use my own DataBinding routines (which bind to the data
just fine) in a code behind page that I have issues when it comes to the
ItemDelting or ItemUpdating routines?

I hate the idea with beign stuck with an ODS as its less efficient now I
have to make 2 calls to my active directory to accomplish the same thing I
was able to do with a single call and some rather complex logic (like adding
and subtracting email address aliases to exchange). While an ODS may be nice
for those afraid of code, I prefer to do my complex operations the old
school way in the code behind page.

Can anyone shed any light on this?

-Timothy

"Timothy H. Schilbach" <ts********@NOSPAMaodinc.comwrote in message
news:%2******************@TK2MSFTNGP05.phx.gbl...
Hi Everyone,

I am having a massive issue trying to get custom data into my DV. What I
want to do is sooo simple:

1. I have a single DV on a page
2. I created my own template (see below)
3. I created the DetailsViewDataBinging sub which populates the field
using a datatable
4. I created a ModeChanging Event handler to allow me to change the mode
into EDIT mode
5. I created a ItemUpdating mode to handle the item update.

No matter what I do or what I put in, the e.NewValues or e.OldValue
contain NOTHING... Whan I do a count I see 0 everytime. Non of my fields
are Template fields and they are all databound. Everything works with any
issues, just no data is ever returned.

I hope these shed some light:

DETAILSVIEW1
################################################## ###############
<asp:DetailsView ID="DetailsView1" runat="server" Width="125px"
AutoGenerateRows="False">

<Fields>

<asp:BoundField DataField="FirstName" HeaderText="First Name:" />

<asp:BoundField DataField="LastName" HeaderText="Last Name:" />

<asp:BoundField DataField="DisplayName" HeaderText="Display Name:" />

<asp:BoundField DataField="Description" HeaderText="Description:" />

<asp:BoundField DataField="PrimaryEmail" HeaderText="Primary Email:"
ReadOnly="True" />

<asp:CommandField ShowEditButton="True" ShowDeleteButton="True" />

</Fields>

</asp:DetailsView>
Protected Sub DetailsView1_ModeChanging(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewModeEventArgs ) Handles
DetailsView1.ModeChanging

'# When the form mode changes we handle how the form loads and what it
looks like here

Select Case e.NewMode

'Put into edit mode and databind

Case DetailsViewMode.Edit

DetailsView1.ChangeMode(DetailsViewMode.Edit)

'BindDetailsView()

'Put into insert mode

Case DetailsViewMode.Insert

'put into read only mode and databind

Case DetailsViewMode.ReadOnly

DetailsView1.ChangeMode(DetailsViewMode.ReadOnly)

BindDetailsView()

End Select

End Sub

Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewUpdateEventAr gs) Handles
DetailsView1.ItemUpdating
Response.Write(e.NewValues.Count)

End Sub

What Else am I missing here? This is driving me batty as I cannotdo
anything with my data. All I want to do is intercept the NewValues and put
them in my custom data solution.

-Timothy

Oct 25 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andrew Robinson | last post by:
Is there any way to accomplish two way data binding in a Details View with a DataSet or DataTable as the DataSource. All I want is to get an updated DataSet or DataTable back from the...
12
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press...
3
by: chrisn | last post by:
Hi, (Using ASP.Net 2.0) I have a wizard control inside a detailsview control. When I attempt to call the InsertItem method on the DetailsView I get an error "ObjectDataSource...
1
by: cisco | last post by:
I've been trying to figure out how the client of a DetailsView or FormView should handle the ItemUpdating event when setting the datasource programatically. I want to do something simple like...
1
by: Mark Stafford | last post by:
I am attempting to use a DetailsView control to view some data where the fields returned by the database are determined at runtime. I create the TemplateFields on the fly using a class that...
1
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi, I am a newbie to ASP.NET 2.0. This is driving me nuts! I think I might have a fundamental misunderstanding of how this all works! I am using a DetailsView which is populated dynaically at...
0
by: kamlesh | last post by:
Hi Experts, I have a question on the ASP.NET 2.0 Details view control I dont like using the SQLDataSource to bind the data to the DetailsView control.. I dont like the idea of placing Queries...
1
by: gsauns | last post by:
I have a DetailsView inside a ModalPopup (using the AJAX ModalPopupExtender). I would like the user to have the ability to change the DetailsView's mode within the ModalPopup. But whenever I...
0
by: | last post by:
I'm using a detailsview to insert a record, should be simple enough? What am I doing wrong? Thank you for your help. The user fills in all the textboxes and hits insert. I've tried every event...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.