Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 June 23rd, 2008, 04:56 AM
Authorized User
Join Date: Dec 2006
Location: , , .
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default Binding properties to controls


My control has a public property called 'DisableBackground'.
private bool _disableBackground;
private string _targetControl;

public bool DisableBackground
  get { return _disableBackground; }
  set { _disableBackground = value; }
public string TargetControl
  get { return _targetControl; }
  set { _targetControl = value; }
I set the value on the property when I use the control from an aspx page.
 <Controls:ModalWindow runat="server" TargetControl="btnTrigger" DisableBackground="true" />
I want to bind that property to the control
        <ajaxToolkit:ModalPopupExtender ID="windowExtender" 
         TargetControlID="<%# this.TargetControl %>" 
         PopupControlID="panelWindow" />
I know that in the code behind I can find the control and then assign a value to the property.
if (_disableBackground)
  AjaxControlToolkit.ModalPopupExtender popup = (AjaxControlToolkit.ModalPopupExtender)this.FindControl("windowExtender");
  popup.BackgroundCssClass = "modalBackground";
popup.TargetControlID = _targetControl;
I was wondering if there is a simple way I can just bind the property to the control. All the examples I can find bind repeating data to the control but I just want to bind a single property or a few properties.

Thanks in advance,


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
Binding Controls zulf Infopath 0 October 8th, 2007 11:22 PM
Binding controls Boris Kofman VB Databases Basics 1 January 20th, 2007 01:16 PM
Access templated controls properties tony_j_hug ASP.NET 2.0 Basics 5 October 17th, 2005 10:44 AM
Accessing Properties in User Controls andyj00 Classic ASP Professional 1 May 21st, 2005 02:52 PM
default properties on controls Duncan Pro VB.NET 2002/2003 3 November 15th, 2003 02:32 PM

All times are GMT -4. The time now is 06:48 AM.

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