Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5.1 > BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
|
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 2nd, 2014, 07:04 PM
Authorized User
 
Join Date: Aug 2014
Posts: 16
Thanks: 7
Thanked 0 Times in 0 Posts
Default Programmatically finding differences between analogous controls in separate formviews

Is there a way to highlight the difference between two corresponding labels/textboxes within two formviews? I have two formviews on a webpage, the second of which displays after a user edits the first formview and clicks the update button. The second formview shows the updates the user just made while the first formview shows the database row as it was before the user edited it.

So if both formviews have a textbox or label that display phonenumber and the user changed the phonenumber, I'd like the phonenumber in the second formview to be highlighted. I'd need to compare each pair of textboxes or labels in the two formviews. Also, if one of the formviews has an empty textbox or label and the corresponding label/textbox in the other formview has content, I'd want to highlight that as well. I mention that because I usually do something like (an unrelated example):
Code:
    If FormView1.CurrentMode = FormViewMode.Edit Then

      Dim UpdDate As TextBox = TryCast(FormView1.FindControl("UpdDateTextBox"), TextBox)
      If UpdDate IsNot Nothing Then
        UpdDate.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt")
so I'm not sure how compare when one or both of the controls is empty.

Thanks for reading and if you can suggest some logic to use I will be very appreciative.

Last edited by DatabaseGoddess; October 2nd, 2014 at 07:08 PM..
 
Old October 6th, 2014, 03:13 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Not entirely sure what you mean or what you're trying to accomplish, but it sounds like you're better off using something like LINQ to get the data in the Code Behind and then compare it against the data the user entered.

BTW: since this is not related to my book directly, please post questions like this in the General ASP.NET Category: http://p2p.wrox.com/asp-net-4-5-1-752/

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old October 6th, 2014, 09:18 PM
Authorized User
 
Join Date: Aug 2014
Posts: 16
Thanks: 7
Thanked 0 Times in 0 Posts
Default

The General ASP.NET forum seems dead. Lots of questions and no answers. I figured out how to highlight the edited control in the code behind looping through and using Drawing.Color.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting two FormViews Filespit BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 10 May 2nd, 2010 05:35 PM
Finding Controls and Checking Boxes rstelma ASP.NET 1.0 and 1.1 Professional 1 October 30th, 2007 02:01 PM
How to access form controls from separate class? paket C# 6 August 1st, 2007 06:18 AM
Finding child controls Hunter ASP.NET 1.0 and 1.1 Professional 4 October 27th, 2005 09:09 AM
Finding Dynamic controls mpdillon General .NET 0 March 30th, 2005 01:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.