c# - Possible to set TextBox text declaratively? -


I am trying to set the text property of a text box control as the value of the variable. I've found that the text property will be set, if I put it behind the code-page, which is what I'm trying to avoid.

I have tried to do all of the following, but with success:

   & Lt;% myTxt.Text = MyNamespace.MyClass.StaticString; & Gt%;  

Is this also possible and if so?

This is the best way to do this.

  & asp: textbox id = "myTxt" runat = "server" text = '& lt;% # MyNamespace.MyClass.StaticString% & gt; / & Gt;  

You said that you have tried to do this, but this couple will have to call DataBind () on your page. & Lt;% #%> is a databasing expression and when the databand () is called, the value will be filled.

You can call the databind on the text box, but calling on the page is better to get everything (works recursively) you want to be compatible and can only call it on the page 'Because it is possible that calling databases (sometimes) on the control can have negative consequences (duplicate data in the list, etc.).


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -