parsing in .net

fLr1988

New Member
if i wanted to parse server side html controls... how would i do it? like in classic asp i would do this<BR><BR><input=label value=http://aspmessageboard.com/archive/index.php/"The Date is "<%=now%>><BR><BR>how do i do something like this in .net?In the Page_Load event handler, set the value (via the Text property) of the Web control to the string you wish to have displayed in there.<BR><BR>First, you'd create a label text control with an id of lblDate, let's say:<BR><BR><asp:label runat="server" id="lblDate" /><BR><BR>Then, in your Page_Load event handler, simply set lblDate.Text to the string you're after:<BR><BR><script runat="server" language="vb"><BR> Sub Page_Load(sender as Object, e as EventArgs)<BR> lblDate.Text = "The Date is " & DateTime.Now<BR> End Sub<BR></script><BR><BR>Neat, eh?ok... but what if it's the TreeNodeSrc property of a treeview... i don't think it can be changed once it's been loaded. Any suggestions?Page_load doesn't actually fire when the page is loaded in the browser, it fires right before the page is created (which is before its even sent to the client). I.e. shouldn't be a problem.If you are trying to dynamically set the treenodesrc then this is the best way to do it:<BR><BR>Private Sub Page_Load(Src AS Object, E As EventArgs)<BR>If not IsPostBack then<BR>Dim varref as string = "Yoursrcnodehere"<BR>treeview1.TreeNodesrc = varref<BR>treeview1.Databind()<BR>else<BR>end if<BR>end sub<BR>
 
Back
Top