I’m passing the value of a variable in my.aspx.cs file to my .aspx file. When its in the aspx, the value of it gets changed and then needs to be returned back to the .aspx.cs file. However, it won’t let me change the value of the variable. Any suggestions?
.cs
private string dateLookup;
public string DateLookup
{
get { return dateLookup; }
set { dateLookup = value; }
}
.aspx
<script runat="server">
void Selection_Change(Object sender, EventArgs e)
{
"<%=DateLookup %>" = monthList.SelectedItem.Value;
}
</script>
You can assign the property like any other property:
The
<%= ... %>syntax is used to print any value on to the page.