473,769 Members | 7,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 DetailsViewData Binging 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:DetailsVie w ID="DetailsView 1" runat="server" Width="125px"
AutoGenerateRow s="False">

<Fields>

<asp:BoundFie ld DataField="Firs tName" HeaderText="Fir st Name:" />

<asp:BoundFie ld DataField="Last Name" HeaderText="Las t Name:" />

<asp:BoundFie ld DataField="Disp layName" HeaderText="Dis play Name:" />

<asp:BoundFie ld DataField="Desc ription" HeaderText="Des cription:" />

<asp:BoundFie ld DataField="Prim aryEmail" HeaderText="Pri mary Email:"
ReadOnly="True" />

<asp:CommandFie ld ShowEditButton= "True" ShowDeleteButto n="True" />

</Fields>

</asp:DetailsView >
Protected Sub DetailsView1_Mo deChanging(ByVa l sender As Object, ByVal e As
System.Web.UI.W ebControls.Deta ilsViewModeEven tArgs) Handles
DetailsView1.Mo deChanging

'# 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.Ch angeMode(Detail sViewMode.Edit)

'BindDetailsVie w()

'Put into insert mode

Case DetailsViewMode .Insert

'put into read only mode and databind

Case DetailsViewMode .ReadOnly

DetailsView1.Ch angeMode(Detail sViewMode.ReadO nly)

BindDetailsView ()

End Select

End Sub

Protected Sub DetailsView1_It emUpdating(ByVa l sender As Object, ByVal e As
System.Web.UI.W ebControls.Deta ilsViewUpdateEv entArgs) Handles
DetailsView1.It emUpdating
Response.Write( e.NewValues.Cou nt)

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 7732
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 (ObjectDataSour ce) 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********@NOS PAMaodinc.comwr ote in message
news:%2******** **********@TK2M SFTNGP05.phx.gb l...
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 DetailsViewData Binging 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:DetailsVie w ID="DetailsView 1" runat="server" Width="125px"
AutoGenerateRow s="False">

<Fields>

<asp:BoundFie ld DataField="Firs tName" HeaderText="Fir st Name:" />

<asp:BoundFie ld DataField="Last Name" HeaderText="Las t Name:" />

<asp:BoundFie ld DataField="Disp layName" HeaderText="Dis play Name:" />

<asp:BoundFie ld DataField="Desc ription" HeaderText="Des cription:" />

<asp:BoundFie ld DataField="Prim aryEmail" HeaderText="Pri mary Email:"
ReadOnly="True" />

<asp:CommandFie ld ShowEditButton= "True" ShowDeleteButto n="True" />

</Fields>

</asp:DetailsView >
Protected Sub DetailsView1_Mo deChanging(ByVa l sender As Object, ByVal e As
System.Web.UI.W ebControls.Deta ilsViewModeEven tArgs) Handles
DetailsView1.Mo deChanging

'# 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.Ch angeMode(Detail sViewMode.Edit)

'BindDetailsVie w()

'Put into insert mode

Case DetailsViewMode .Insert

'put into read only mode and databind

Case DetailsViewMode .ReadOnly

DetailsView1.Ch angeMode(Detail sViewMode.ReadO nly)

BindDetailsView ()

End Select

End Sub

Protected Sub DetailsView1_It emUpdating(ByVa l sender As Object, ByVal e As
System.Web.UI.W ebControls.Deta ilsViewUpdateEv entArgs) Handles
DetailsView1.It emUpdating
Response.Write( e.NewValues.Cou nt)

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
3626
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 DetailsView and then handle my updating manually. -Andrew
12
8705
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 update after making changes, but I don't want that update button. How can I get the updated object when the user presses one of my other action buttons?
3
4072
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 'ObjectDataSource1' has no values to insert. Check that the 'values' dictionary contains values." I have found I can suppress the error by placing a hidden field inside
1
2768
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 this: formView.DataSource = new SomeUserObject { user }; formView.DataBind(); All the examples i've come across show a declerative data source being used. Do i need to use ObjectDataSource? I can get the information going through the cells by...
1
7314
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 implements ITemplate and repopulate the Template properters of TemplateField in OnInit. And I am DataBinding by getting a DataTable from my db provider class in Page_Load event. When I databind programmatically in the Page_Load, the data displays in...
1
1885
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 runtime: table = DataTable from Dataset passed back from Data Access Layer DV1 = DetailsView
0
1416
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 in the .ASPX files...I prefer a 3 tiered approach to development. Am using a Custom object to bind the object to the Details View
1
7195
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 click the button to change the mode, the ModalPopup closes itself. The NEXT time I open the ModalPopup, the mode has been changed. So the mode is changing... my problem is that I need the ModalPopup to stay visible. Also, the DetailsView is inside...
0
1867
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 there is to retrieve cells and rows and I've even converted some of the fields from bound controls to templates, and all the data is blank no matter what I do: <asp:DetailsView ID="dvBillingServiceInsert" runat="server" GridLines="None"
0
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.