Reputation: 73
I have a text box in my form. I have a class TicketUser where i have accessors set to return a a value in my label. Im trying to get the value from the text box inside the label. I'm trying to get firstName to return a value of txtfirstName.Text from my form. Can someone please guide me in the right direction please. Im pretty new to asp.net
public class TicketUser
{
public string firstName;
public string lastName;
public string username;
TicketForm form = new TicketForm();
//property accessors
public string CreateAccountMessage
{
get
{
return "Congratulations" + firstName + "Your account has been created. Your username is" + username;
}
set
{
CreateAccountMessage = value;
}}
//CreateAccount method
public string CreateAccount()
{
return CreateAccountMessage;
}}}
Upvotes: 0
Views: 120
Reputation: 464
I hope i got you correct because you need to some details about what you are trying to do and what are the results. Make and Object of TicketUser in the code behind file of the form and set
t = new TicketUser();
t.firstName=txtfirstName.Text;
t.lastName=txtlastName.Text;
t.userName=txtUsername.Text;
Upvotes: 1
Reputation:
Change this:
public string firstName = "";
public string lastName = "";
public string username = "";
Upvotes: 1