Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics 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 June 6th, 2008, 07:48 AM
Authorized User
 
Join Date: Apr 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to AspNetGuy
Default Events for Control Inside DetailsView

Ok, maybe it's my lack of understanding, but ...

In VWD, when I highlight a TextBox control contained by a <ContentTemplate> but not contained by another container or control VWD shows me the events available to the TextBox, such as TextChanged. I can double click on the event and voila a method is created in the codebehind file.

When I move the TextBox inside a DetailsView control, I no longer have access to the events for the TextBox. I assume this has to do with the architecture of the DetailsView.

How do I get access to a control's events when the control is inside a DetailsView?

If you want to point me to a tutorial that explains this cool. I haven't been able to find anything.

Thanks in advance for any help given.

 
Old June 6th, 2008, 09:24 AM
Authorized User
 
Join Date: Apr 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to AspNetGuy
Default

Just to clarify a point.

I see that I can code the event directly on the control when in Source View, but my question is: Even when I select the TextBox control in Source View when the control is contained within a DetailsView control, the "lightning bolt" does not show in the Properties Window. Is this normal behavior, or do I have something configured incorrectly?

Thanks.

 
Old June 6th, 2008, 12:22 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,

You need to change the Field with the TextBox to a TemplateField. Then you can edit that template, select the TextBox and then the Events are available.

Steps:

1. Open the Smart Tasks panel for the DetailsView control and choose Edit Fields.

2. Select the Field with the TextBox and choose Convert this field into a TemplateField and click OK

3. Open the Smart Tasks panel for the DetailsView control again and choose Edit Templates

4. From the DropDown on the Smart Tasks panel choose Edit Item Template

5. Now select the TextBox control.

Hope this helps,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old June 6th, 2008, 02:09 PM
Authorized User
 
Join Date: Apr 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to AspNetGuy
Default

Imar,

Thanks for the suggestion. However, the fields were already templated. As I mentioned in the first post, it was a lack of understanding. Your post showing how to get at the events by Editing the templates works great.

Thanks.






Similar Threads
Thread Thread Starter Forum Replies Last Post
DetailsView Control on ManageCategories.aspx pinch BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 October 6th, 2007 09:15 PM
DetailsView Control Showkkath ASP.NET 1.x and 2.0 Application Design 2 August 21st, 2006 07:49 AM
Problem with updating the detailsview control rakesh225 ASP.NET 2.0 Professional 1 August 2nd, 2006 10:45 AM
Capturing toolbar events inside a dialog class pazzuzu Visual C++ 0 October 13th, 2004 01:35 AM





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