PC Review


Reply
Thread Tools Rate Thread

How to bind a class property to a textbox

 
 
cbtechlists@gmail.com
Guest
Posts: n/a
 
      26th Feb 2008
I have a person class that has a 'name' property. I want to bind that
property to a textbox on an ASP.NET form.

In a winform, I can do something like this:

dim nameBinding as binding = new binding("text", me.person, "name",
true)
me.nameTB.databindings.add(nameBinding)

Is there an equivalent in ASP.NET?

Thanks,

Chris
 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      27th Feb 2008
<asp:textbox runat="server" text=<%# person.Name %> />

Look here for details:
http://msdn2.microsoft.com/en-us/library/bda9bbfx(VS.71).aspx

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


<(E-Mail Removed)> wrote in message
news:bb1279be-a07e-45b9-8f71-(E-Mail Removed)...
>I have a person class that has a 'name' property. I want to bind that
> property to a textbox on an ASP.NET form.
>
> In a winform, I can do something like this:
>
> dim nameBinding as binding = new binding("text", me.person, "name",
> true)
> me.nameTB.databindings.add(nameBinding)
>
> Is there an equivalent in ASP.NET?
>
> Thanks,
>
> Chris



 
Reply With Quote
 
cbtechlists@gmail.com
Guest
Posts: n/a
 
      27th Feb 2008
Thanks, Eliyahu! Is there any way to do this in the code behind?



On Feb 27, 5:19*am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.org> wrote:
> <asp:textbox runat="server" text=<%# person.Name %> />
>
> Look here for details:http://msdn2.microsoft.com/en-us/library/bda9bbfx(VS..71).aspx
>
> --
> Eliyahu Goldin,
> Software Developer
> Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
>
> <cbtechli...@gmail.com> wrote in message
>
> news:bb1279be-a07e-45b9-8f71-(E-Mail Removed)...
>
>
>
> >I have a person class that has a 'name' property. I want to bind that
> > property to a textbox on an ASP.NET form.

>
> > In a winform, I can do something like this:

>
> > dim nameBinding as binding = new binding("text", me.person, "name",
> > true)
> > me.nameTB.databindings.add(nameBinding)

>
> > Is there an equivalent in ASP.NET?

>
> > Thanks,

>
> > Chris- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bind a class to Property Grid - No setter executed Hans Koller Microsoft VB .NET 0 27th Mar 2007 08:00 PM
Binding TextBox fields to Recordset problem, "Cannot bind to the property" mike11d11 Microsoft VB .NET 1 20th Oct 2006 06:45 AM
Re: i'm trying to bind the property of a class of mine to a textbox & i get errors Herfried K. Wagner [MVP] Microsoft VB .NET 0 18th Nov 2004 04:46 PM
i'm trying to bind the property of a class of mine to a textbox & i get errors Cordine Microsoft VB .NET 0 18th Nov 2004 01:21 PM
Bind textbox to a public property in business class moondaddy Microsoft Dot NET Framework Forms 4 16th Oct 2003 09:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:47 AM.