code_junkie

How to assign a method's output to a textbox value without code behind

Nov 10th, 2011
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. <%@ Page Language="VB" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <script runat="server">
  4. Public TextFromString As String = "test text test text"
  5. Public TextFromMethod As String = RepeatChar("S", 50) 'SubSonic.Sugar.Web.GenerateLoremIpsum(400, "w")
  6.  
  7. Public Function RepeatChar(ByVal Input As String, ByVal Count As Integer)
  8. Return New String(Input, Count)
  9. End Function
  10. </script>
  11. <html xmlns="http://www.w3.org/1999/xhtml">
  12. <head id="Head1" runat="server">
  13. <title>Test Page</title>
  14. </head>
  15. <body>
  16. <form id="form1" runat="server">
  17. <div>
  18. <%=TextFromString%>
  19. <br />
  20. <asp:TextBox ID="TextBox1" runat="server" Text="<%# TextFromString %>"></asp:TextBox>
  21. <br />
  22. <%=TextFromMethod%>
  23. <br />
  24. <asp:TextBox ID="TextBox2" runat="server" Text="<%# TextFromMethod %>"></asp:TextBox>
  25. </div>
  26. </form>
  27. </body>
  28. </html>
  29.  
  30. <asp:Label runat="server" ID="label1"><%=TextFromString%></asp:Label>
  31.  
  32. <asp:TextBox ID="TextBox3" runat="server">Hello</asp:TextBox>
  33.  
  34. <asp:TextBox ID="TextBox4" runat="server"><%=TextFromString%></asp:TextBox>
  35.  
  36. <%= TextFromMethod %>
  37.  
  38. <%# TextFromMethod %>
  39.  
  40. <%$ ConnectionStrings:Database %>
  41.  
  42. Private Function Page_Load(sender as Object, e as EventArgs)
  43. If Not IsPostback Then
  44. Me.DataBind()
  45. End If
  46. End Function
  47.  
  48. <input type="text" id="TextBox4" runat="server" value="<%=TextFromString%>" />
Add Comment
Please, Sign In to add comment