473,725 Members | 2,118 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3623
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
DetailsViewUpda teEventArgs.Can cel to cancel the buildin update operation.

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

protected void Button1_Click(o bject sender, EventArgs e)
{
Response.Write( "<br>DetailsVie w1.Rows.Count: " + DetailsView1.Ro ws.Count);

foreach (DetailsViewRow dvr in DetailsView1.Ro ws)
{
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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: 216.57.203.121
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP15.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1283 39
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.publi c.dotnet.framew ork.aspnet
| Message-ID: <V2************ **@TK2MSFTNGXA0 1.phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Lines: 75
| Path: TK2MSFTNGXA01.p hx.gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1285 47
| 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
| DetailsViewUpda teEventArgs.Can cel to cancel the buildin update operation.
|
| 2. If we don't want the utilize the buildin events, we can use the
| DetailsView.Row s and DetailsViewRow. Cells collection to manually retrieve
| the values from the Bounded control's Text Property. Like:
|
| protected void Button1_Click(o bject sender, EventArgs e)
| {
| Response.Write( "<br>DetailsVie w1.Rows.Count: " +
DetailsView1.Ro ws.Count);
|
| foreach (DetailsViewRow dvr in DetailsView1.Ro ws)
| {
| 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.publi c.dotnet.framew ork.aspnet
| | NNTP-Posting-Host: 216.57.203.121
| | Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP15.phx. gbl
| | Xref: TK2MSFTNGXA01.p hx.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:1283 39
| | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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
8697
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
3156
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 my error messages. Currently, it appears that the detailsview is trying to rebind after the error, to the empty/null detail item(on insert it is null), and thus I lose all the operator's input. Can someone suggest the proper way for me to...
0
2550
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 sample provided by Microsoft and other comminity sites. Most of the samples were using Databinding using a DesignTime "SqlDataSource" Control and assigning its ID to DataSourceID property of DetailsView. However, in all of my application we DO...
0
1401
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 from separate data sources. my question is - while in edit mode of my detailsView how do I make the (region) change according to what country I choose to select. I'm using an ObjectDataSource - one for countries and one for regions -
2
16208
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 the insertbutton, i want a warning if one or more inputs are not correct and the user must have the opportunity to correct his errors (so all the fields must remains as it). I know it exists e.g. "RequiredFieldValidator", but i can't link it to...
0
1520
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 a handful of fields. Two of the controls are a DropDownList of countries and a DropDownList of states (populated from a provider that is known to be working elsewhere in the website). The idea is simple... If a user selects a different...
1
16843
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" DataKeyNames="ID" DataSourceID="objCurrentSubscriber" DefaultMode="Insert" HeaderText="Subscriber Details">
2
5511
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 programmatically. And I want to bind the selection of a TreeNode (which is a record) from the database) to a DetailsView which shows the datatable record for the selected TreeView node in the Details View. I am using IDE : Visual Web Developer 2005 Express; OS=...
1
7787
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 in detailsview. can some1 please tell me how to do that. Regards, vineet
0
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9113
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...
1
6702
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
6011
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
4519
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...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
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
3
2157
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.