First, let’s explain the previous ASP usage of <%= %>, which is also practical in ASP.NET. <%# %> is a usage introduced in ASP.NET, but this usage is not used in ASP.
For example:
For example, in the background form.vb, I defined a variable (to be global)
public istg_xo as string="ABC"
Then I can call this variable anywhere in the foreground from.aspx....
<javascript>
var xx=<%=istg_xo%> <!--Get the variable of istg_xo in the background-->
alter<xx> <!--The output shows whether the value is obtained-->
</javascript>
For another example, if I have a datatable in the background, I now want to take out the variables of each field in this datatable in the foreground...
Backend.cs (C#)
string message=string.empty;
public getmessage()
{
for (int lint_row=0; lint_row<datatable.rows.count;lint_row++)
{
message+="message["+lint_row.tostring()+"]="+idtb_temp.rows(lint_rows).item("xx1").tostring()+";";
//Generate client message array for front-end call...
}
}
The front desk uses the same method to retrieve this array....
The usage of <%# %> is relatively simple....
For example, I have a dataset in the background... Then I can call the contents of any field in this dataset in the front desk...
usage:
text='<%#DataBinder.Eval(Container.DataItem,“DataSet field name”%>'