Bind controls to class properties

E

Emanuele

How can I set/get values of a webform from the values of the properties of a
class? Does exist some function that do it?

gracias;)
 
P

Paul Glavich [MVP - ASP.NET]

I am not sure I fully understand your request. Could you provide an example
scenario to better illustrate what you would like to do.
 
K

Karl

Not 100% sure I understand, but you should be able to do:

VB.Net -->
<%# Ctype(Container.DataItem, YOURCLASS).PROPERTY %>

C#
<%# ((YOURCLASS)Container.DataItem).PROPERTY %>

You might need to <%@ Import NameSpace="namespace.of.your.class" %> at the
top

Karl
 
E

Emanuele

ok.. it solves 50% of my problem... now I need to update values of my object
(all the properties of the class) from the values of the textboxes of my
page...

Example:

MyClass.Name ----> txtName.text
MyClass.Surname ----> txtSurname.text
MyClass.Address ----> txtAddress.text

thank's!
 
K

Karl

The only way to do that is manually as far as I know. When the save button
is hit, you need to get your object and manually update it

MyClass.Name = txtName.text

there's no mapping available.

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top