473,396 Members | 2,029 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 Data Binding

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
Nov 19 '05 #1
2 3601
Hi Andrew,

Welcome to ASPNET newsgroup.
As for the template databound controls such as GridView/DetailsView, and
the original DataGrid and DAtaList ...., the DataSource instance (DataSet,
DataTable ...) only exist when the datacontrol is performing databinding.
After that, the datasource instance no longer exist in the sequential
request, the datas are persisted in the control through ViewState. So we
can not directly obtain the original DataSet/DataTable back from The
databound control on the page. If you're wantting to retrieve the updated
values (of the controls) in each row and do manual data updating, we have
the following options:

1. We still use the DetailsView control's buildin updating mechanism, but
use the ItemUpdating event to proprocess the update operation. The
ItemUpdating event, we can get the paramters that will be used to do the
updating operation and then use them to perform our own update operation.
And we can use the
DetailsViewUpdateEventArgs.Cancel to cancel the buildin update operation.

2. If we don't want the utilize the buildin events, we can use the
DetailsView.Rows and DetailsViewRow.Cells collection to manually retrieve
the values from the Bounded control's Text Property. Like:

protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("<br>DetailsView1.Rows.Count: " + DetailsView1.Rows.Count);

foreach (DetailsViewRow dvr in DetailsView1.Rows)
{
Response.Write("<br>dvr.Cells.Count: " + dvr.Cells[1].Text);
}
}

However, all the above options can only retrieve the values for the
currently active (displayed ) record. Unlike the DataGrid, GridView,
DetailsView dosn't provide the direct interfaces for loop through all the
records's data.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "Andrew Robinson" <ne****@nospam.nospam>
| Subject: DetailsView Data Binding
| Date: Fri, 30 Sep 2005 13:44:03 -0700
| Lines: 9
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#t**************@TK2MSFTNGP15.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 216.57.203.121
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:128339
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| 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
|
|
|

Nov 19 '05 #2
Hi Andrew,

How are you doing on this thread, does the suggestions in my last reply
helps a littile? If there're anything else we can help, please feel free to
post here.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
--------------------
| X-Tomcat-ID: 80680570
| References: <#t**************@TK2MSFTNGP15.phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@online.microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Mon, 03 Oct 2005 06:04:19 GMT
| Subject: RE: DetailsView Data Binding
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| Message-ID: <V2**************@TK2MSFTNGXA01.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Lines: 75
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:128547
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Hi Andrew,
|
| Welcome to ASPNET newsgroup.
| As for the template databound controls such as GridView/DetailsView, and
| the original DataGrid and DAtaList ...., the DataSource instance
(DataSet,
| DataTable ...) only exist when the datacontrol is performing databinding.
| After that, the datasource instance no longer exist in the sequential
| request, the datas are persisted in the control through ViewState. So we
| can not directly obtain the original DataSet/DataTable back from The
| databound control on the page. If you're wantting to retrieve the updated
| values (of the controls) in each row and do manual data updating, we have
| the following options:
|
| 1. We still use the DetailsView control's buildin updating mechanism, but
| use the ItemUpdating event to proprocess the update operation. The
| ItemUpdating event, we can get the paramters that will be used to do the
| updating operation and then use them to perform our own update operation.
| And we can use the
| DetailsViewUpdateEventArgs.Cancel to cancel the buildin update operation.
|
| 2. If we don't want the utilize the buildin events, we can use the
| DetailsView.Rows and DetailsViewRow.Cells collection to manually retrieve
| the values from the Bounded control's Text Property. Like:
|
| protected void Button1_Click(object sender, EventArgs e)
| {
| Response.Write("<br>DetailsView1.Rows.Count: " +
DetailsView1.Rows.Count);
|
| foreach (DetailsViewRow dvr in DetailsView1.Rows)
| {
| Response.Write("<br>dvr.Cells.Count: " + dvr.Cells[1].Text);
| }
| }
|
| However, all the above options can only retrieve the values for the
| currently active (displayed ) record. Unlike the DataGrid, GridView,
| DetailsView dosn't provide the direct interfaces for loop through all the
| records's data.
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
|
|
|
| --------------------
| | From: "Andrew Robinson" <ne****@nospam.nospam>
| | Subject: DetailsView Data Binding
| | Date: Fri, 30 Sep 2005 13:44:03 -0700
| | Lines: 9
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| | X-RFC2646: Format=Flowed; Original
| | Message-ID: <#t**************@TK2MSFTNGP15.phx.gbl>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | NNTP-Posting-Host: 216.57.203.121
| | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| | Xref: TK2MSFTNGXA01.phx.gbl
| microsoft.public.dotnet.framework.aspnet:128339
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | 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
| |
| |
| |
|
|

Nov 19 '05 #3

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

Similar topics

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: jparlato | last post by:
I'm using the detailsview to perform edit and insert of new records via an object datasource. If an error occurs on the insert, I want to preserve the data the operator tried to input, along with...
0
by: mike | last post by:
Hi, When I programatically Bind a DataSource to DetailsView it does not fire "ModeChanged" event. This is first time i am trying to use ASP.NET DetailsView control. I have played with some of the...
0
by: Mike | last post by:
I've a datagrid containing user's information which onselect displays a detailsview control in edit mode I've set-up two template fields to map to (country) and (region) these are dropdownlists...
2
by: Cas | last post by:
Hi, I use a detailsview control for inputtng data. I want to check the user input before it is sent to the database (min. /max value, not empty, only some values allowed ...). When clicking on...
0
by: 47computers | last post by:
Hello. I'm having a bit of difficulty with some DropDownList controls within templates in a DetailsView on my web form. Basically, I have a form where a user is building a "location profile" with...
1
by: JJ | last post by:
Hi. I am having trouble getting a dropdownlist to work properly in a detailsview: The code is something like: <asp:DetailsView ID="dvwSubscriber" runat="server" AutoGenerateRows="False" ...
2
by: makennedy | last post by:
Hi Experts, Please help, I am a newbie to ASP.NET 2.0 may be I am doing something wrong or there may be a bug somewhere. Basically I have a TreeView Control which I have created...
1
by: vineetbindal | last post by:
Hi all, I have a datagrid and detailsview. when a user selects a row in datagrid onSelectedIndexchanged is fired and Detailsview comes into picture. I want to display the data of the selected row...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...
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.