Re: Programatically create ASP.NET binding

Mont Rothstein <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.advanced
Message-ID <[email protected]>
Thanks.  This works.

-Mont


On Sun, Jan 25, 2009 at 11:07 PM, Dimitrios Toulakis <[email protected]>wrote:

> Setting the DataSource first appropriately in your code.
> There you use the DataTextField property for showing the text, and
> DataValueField property for the "real" name of your data source.
> Plus setting the "AutoPostback" to true.
> Declare also the "SelectedIndexChanged" event and hook this up to your
> dynamically created control.
>
> HTH
> Dimi
>
> >Does anyone know how to programatically create an ASP.net binding?
> >
> >What I want to do is bind to the Text property of a programatically
> created
> >DropDownList (and ultimately other controls).  I need bi-directional
> binding
> >so that when the user changes the values it propagates back.
> >
> >In the .aspx page I would use something like:
> >Text="<%#SomeObject.SomeProperty%>"
> >
> >Setting that exact string to the Text object in the .aspx.cs file gives an
> >error and I can't figure out another way to do this.
> >
> >Any suggestions are greatly appreciated.
> >
> >Thanks,
> >-Mont
> >
> >===================================
> >View archives and manage your subscription(s) at
> >http://peach.ease.lsoft.com/archives
>
> ===================================
> View archives and manage your subscription(s) at
> http://peach.ease.lsoft.com/archives
>

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.