code_junkie

Bind tag vs codebehind set, best practices

Nov 13th, 2011
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. public string Description {get; set;}
  2.  
  3. <asp:Literal ID="txtDescription" runat="server" Text='<%# Description %>' />
  4.  
  5. public string Description
  6. {
  7. get { return txtDescription.Text ; }
  8. set { txtDescription.Text = value; }
  9. }
  10.  
  11. <asp:Literal ID="txtDescription" runat="server" />
  12.  
  13. Text='<%# ((fn_SearchReminders)Container.DataItem).dtDateActivation.Value.ToString("yyyy-MM-dd - hh:mm") %>'
  14.  
  15. string iSomeView.Description
  16. {
  17. get { return txtDescription.Text ; }
  18. set { txtDescription.Text = value; }
  19. }
  20.  
  21. Person iSomeView.Person
  22. {
  23. get { return new Person { Name = txtName.Text, Phone = txtPhone.Text }; }
  24. set { txtName = value.Name; txtPhone.Text = value.Phone; }
  25. }
  26.  
  27. private void SetFormFields(Employee emp){
  28. lblName.Text = emp.Name;
  29. txtDateOfBirth.Text = emp.BirthDate.ToShortDateString();
  30. }
Add Comment
Please, Sign In to add comment