473,657 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Page.Controls to identify server controls

KK
Hi

I have a webform. To enter data, there are couple of text boxes,
check boxes, select boxes etc.. Data will get collected and saved.
When user want to see the data(not edit) I thouht of showing the
same form. at that point, all the edit boxes, check boxes, list boxes
etc.. will get hidden and labels in those places will get shown.

For this next to every editable control I have a label. The problem
now is, when I ask the form to show it in VIEW form it should
iterate though all the controls and hide the editable controls and
set the visibility of labels to true.

I am having a problem of doing that iterating through the
Page.Controls collection.

Is there a better way to do this? I am trying to avoid 2 forms(one to
edit and one to display because database logic is almost same)

Thanks
KK
Nov 18 '05 #1
2 958
Why not explicitly show and hide the controls?

"KK" <kk@kk.com> wrote in message
news:uN******** ******@tk2msftn gp13.phx.gbl...
Hi

I have a webform. To enter data, there are couple of text boxes,
check boxes, select boxes etc.. Data will get collected and saved.
When user want to see the data(not edit) I thouht of showing the
same form. at that point, all the edit boxes, check boxes, list boxes
etc.. will get hidden and labels in those places will get shown.

For this next to every editable control I have a label. The problem
now is, when I ask the form to show it in VIEW form it should
iterate though all the controls and hide the editable controls and
set the visibility of labels to true.

I am having a problem of doing that iterating through the
Page.Controls collection.

Is there a better way to do this? I am trying to avoid 2 forms(one to
edit and one to display because database logic is almost same)

Thanks
KK

Nov 18 '05 #2
or how about putting the labels and textboxes in two seperate panels...
and then toggle the visibility of panel based on whether its read or edit.

--
Regards,
HD
Once a Geek.... Always a Geek
"KK" <kk@kk.com> wrote in message
news:uN******** ******@tk2msftn gp13.phx.gbl...
Hi

I have a webform. To enter data, there are couple of text boxes,
check boxes, select boxes etc.. Data will get collected and saved.
When user want to see the data(not edit) I thouht of showing the
same form. at that point, all the edit boxes, check boxes, list boxes
etc.. will get hidden and labels in those places will get shown.

For this next to every editable control I have a label. The problem
now is, when I ask the form to show it in VIEW form it should
iterate though all the controls and hide the editable controls and
set the visibility of labels to true.

I am having a problem of doing that iterating through the
Page.Controls collection.

Is there a better way to do this? I am trying to avoid 2 forms(one to
edit and one to display because database logic is almost same)

Thanks
KK

Nov 18 '05 #3

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

Similar topics

7
3677
by: Kersh | last post by:
I'm trying to implement XHTML standards in my ASP.NET web pages but whenever I use web controls I get problems because of the very strict nature of W3C XHTML (transitional version is picky but strict1.1 very severe!) e.g. align="Center" fails validation because of the capital "C" - this makes asp:Calendar control unuseable because it happens to use this tag for each of the cells. Also Javascript tags require a 'type' attribute...etc
1
2889
by: panche | last post by:
I'm developing a fairly simple user control that has two textboxes for date/time entry (a from date/time and a to date/time). One of my requirements is that there should be no button that sets these values (i.e., no button to cause a postback). The problem I'm having is that I need a number of validations to be performed on the data entry, but I don't know how to do this without having the user control/page posted back to the server. ...
3
6420
by: ivanpais | last post by:
Hi, I have a Web User Control, Lets say "Foo.ascx", that contains a button "btnFoo". I have a Master Page "Bar.master", that has a label "lblBar". This label is exposed by a public property BarLabelText. I now have a contentpage "FooBar.aspx", where "Bar.master" is the master page and in the content section has the control "Foo.ascx".
1
3245
by: ChrisFrohlich | last post by:
I am in the early stages of an ASP.NET project and my Architect is proposing a form that would have as many as 1200 (twelve-hundred!) textboxes on a single page. Aside from the usability concerns, I'm trying to identify other obstacles to this approach. One thought I had was that this many web controls may start to seriously tax ..NET vis-a-vis the Viewstate. Essentially that loading this many textboxes on a form will create tons of...
0
8324
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
8740
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...
1
8513
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
8617
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
5642
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
4173
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
2742
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
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
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.