Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 8th, 2006, 12:30 PM
Authorized User
Join Date: Nov 2005
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default FormView Label problem...

I'm having no success with a bound label in a FormView. I want the label to display the date and time when a record is edited. I've tried the Item_Updated event but nothing happens to the label. Any thoughts?

Protected Sub FormView1_ItemUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewUpdatedEventArgs ) Handles FormView1.ItemUpdated
        Dim datetime As Date
        Dim DateLabel As Label
        DateLabel = CType(FormView1.Row.FindControl("DateLabel"), Label)
        datetime = Now()
        If DateLabel Is Nothing Then
            DateLabel = New Label
            DateLabel.Text = datetime.ToLongTimeString()
            DateLabel.Text = datetime.ToLongTimeString()
        End If

    End Sub

Even if I just set the DateLabel.Text= "Hello" in the event handler, the label doesn't change in the FormView. If the bound control is Null and I exclude the If Then statement in the code, there's not even a null exception error that's thrown, causing me to think that the event is not even firing. However, if I use the FormView1_DataBinding event, the label does get updated but with every databinding event of the FormView, even if an update has occurred or not. I have no clue.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch. 4 - Adding FormView control problem donesquire BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 2 August 6th, 2010 03:56 AM
Problem in asp label vickytarun ASP.NET 1.0 and 1.1 Basics 2 November 3rd, 2007 06:17 AM
FormView/ObjectDataSource/DropDownList Problem davidanderson ASP.NET 2.0 Professional 3 April 14th, 2007 02:50 AM
DropDownList Inside FormView Problem frogosteve ASP.NET 2.0 Basics 0 April 12th, 2007 10:30 AM
Set Session to FormView Label sterreyl ASP.NET 2.0 Basics 0 March 29th, 2007 11:16 AM

All times are GMT -4. The time now is 11:53 AM.

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