473,785 Members | 3,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dealing with DetailsView control programmaticall y

I seem to understand how the control works as long as I mated to
SqlDataSource or ObjDataSource it works fine. But I do not want to flatten
my design in this manner. I am interested in how I can programmaticall y
manipulate the control. In other words maybe just use the data source then
extract from the control the information do with it as I see fit. The
opposite is also true. I want to be able to add or modify the data in the
detailsview control without the assistance of a SqlDatasource.

Has anyone done this? I have google this to death to no avail.

Thanks,

--
aaa
Dec 7 '07 #1
3 2765
On 7 Dec, 17:08, Angel <rodoo...@hotma il.comwrote:
I seem to understand how the control works as long as I mated to
SqlDataSource or ObjDataSource it works fine. But I do not want to flatten
my design in this manner. I am interested in how I can programmaticall y
manipulate the control. In other words maybe just use the data source then
extract from the control the information do with it as I see fit. The
opposite is also true. I want to be able to add or modify the data in the
detailsview control without the assistance of a SqlDatasource.

Has anyone done this? I have google this to death to no avail.

Thanks,

--
aaa
Why use a detailsview control for this?

If you only want to display one record (or row) of the datasource at
one time and retain the flexibility to do what you like then why not
use ordinary standalone web server controls with databinding where
appropriate? You'll have much more control of what happens when.
Furthermore if you want it to be re-usable then consider a
encapsulating it in a web user control.

This is a classic case of what I was talking about on another thread
where I posed the question about the inappropriate use of certain
databound controls (e.g. FormView, GridView etc) where the normal
behaviour doesn't meet the needs of the developer.
Dec 8 '07 #2
What exactly is appropriate use? Both the Gridview ahd DetailsView controls
have databinding to some extend. I can program against the datasource
property without ever using another abstraction

I can extract data from Gridview control programmaticall y with no problem at
all why not the Detailsview? You talk about improper use but give no
evidence to support your claims.

In fact, tell my what possible purpose would the detailsview control
possibly have without the use of a datasource control. It seems unatural to
me. The second item is that you are forcing me into programming
declaratively which is not what I do. I want to retain some level of
control why tease me with read part of the process and give me no simple
alternative to the write part of the process.

The point is quite mute and purely academic for my part. What I have done
is create a custom control which can mimic both what the detailsview and
formsview controls do and much more. I just was wondering if I had missed
something and thus the question.

BTW - I do not believe you are entire correct, I seen some very ugly
implementations that allow what I am talking about. Including my new custom
control.
Getting back to Appropriate use, where is it specified how these controls
are to be used? In light of what I see nothing there in the control suggest
your position so I am curious how you arrived at your opinion.--
aaa
"Phil H" wrote:
On 7 Dec, 17:08, Angel <rodoo...@hotma il.comwrote:
I seem to understand how the control works as long as I mated to
SqlDataSource or ObjDataSource it works fine. But I do not want to flatten
my design in this manner. I am interested in how I can programmaticall y
manipulate the control. In other words maybe just use the data source then
extract from the control the information do with it as I see fit. The
opposite is also true. I want to be able to add or modify the data in the
detailsview control without the assistance of a SqlDatasource.

Has anyone done this? I have google this to death to no avail.

Thanks,

--
aaa

Why use a detailsview control for this?

If you only want to display one record (or row) of the datasource at
one time and retain the flexibility to do what you like then why not
use ordinary standalone web server controls with databinding where
appropriate? You'll have much more control of what happens when.
Furthermore if you want it to be re-usable then consider a
encapsulating it in a web user control.

This is a classic case of what I was talking about on another thread
where I posed the question about the inappropriate use of certain
databound controls (e.g. FormView, GridView etc) where the normal
behaviour doesn't meet the needs of the developer.
Dec 10 '07 #3
Once again I ask a question but get no useful answer so I felt that for you
unfortunate souls looking for this information deserve more than some
unfounded statement about appropriate use. In my search I found this
url: http://www.aspdotnetcodes.com/Parent...tailsView.aspx
which provide a reasonably detailed explanation on how to use the
DetailsView control without a datasource control. Something I think is a
real world requirement. I planned to provide a working version of the same
thing in VB for those of you that may be C# chanllenged.

Intereseted send me an email aa*******@hotma il.com
--
aaa
"Angel" wrote:
I seem to understand how the control works as long as I mated to
SqlDataSource or ObjDataSource it works fine. But I do not want to flatten
my design in this manner. I am interested in how I can programmaticall y
manipulate the control. In other words maybe just use the data source then
extract from the control the information do with it as I see fit. The
opposite is also true. I want to be able to add or modify the data in the
detailsview control without the assistance of a SqlDatasource.

Has anyone done this? I have google this to death to no avail.

Thanks,

--
aaa
Dec 12 '07 #4

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

Similar topics

12
8706
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?
4
16072
by: Frits van Soldt | last post by:
Hello, I hope somebody can help me with this! I have 2 listboxes in the edititemtemplate of a detailsview. In the databound event of the detailsview I would like to fill the listboxes programmatically (not through databinding). If I use detailsview.findcontrol(controlname) then an empty object is returned. How can I address these controls? Thank you for your time.
0
1064
by: Jim McGivney | last post by:
On an aspx page I have a DetailsView control that uses a template row. The item template for the row is an asp:Label. The label will contain date/time information. I would like to format the label to display information in short time format. I don't seem to be able to access the label to do this programmatically. Any suggestions are welcomed. Either programmatically or in HTML. Thanks, Jim
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...
0
1869
by: Cas | last post by:
Hi, I defined a detailsview in insertmode in the .aspx file. In the code-behind, i created 6 fields and adding them to the detailsview. Independantly of the detailsview, I use the datareader to read data from a database. Now, when the second field of the datareader (dtreader.GetString(1)) contains an "x", the field created and added to the detailsview must be read-only. I tried in the code below, but i can still input data into that...
3
5295
by: =?Utf-8?B?TWlrZSBE?= | last post by:
I need to dynamically set the ReadOnly value in a BoundField in a DetailsView. The DetailsView is generated from a GridView selection and has both Edit and New buttons. I need to be able to set the readonly property on one of the fields depending on the user's group. I have tried to access the property by Detailsview1.Fields.Readonly and by Detailsview1.FindControl("Dept").Readonly but neither exist. Is it even possible to set the...
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=...
0
1011
by: =?Utf-8?B?QW5nZWw=?= | last post by:
I seem to understand how the control works as long as I mated to SqlDataSource or ObjDataSource it works fine. But I do not want to flatten my design in this manner. I am interested in how I can programmatically manipulate the control. In other words maybe just use the data source then extract from the control the information do with it as I see fit. The opposite is also true. I want to be able to add or modify the data in the...
5
3466
by: =?Utf-8?B?bXBhaW5l?= | last post by:
Hello, I am completely lost as to why I can't update a DropDownList inside a DetailsView after I perform an insert into an object datasource. I tried to simply it down to the core demostration: default.aspx:
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
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
10085
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
9947
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
6737
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
5379
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...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
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.