html binded variable to C#

32 views Asked by At

I have a variable called "selectedAssignment" that is binded in the html, and I want to access it from C#.

right now what I am doing is:

<asp:HiddenField runat="server" ID="assignmentName" Value="{{selectedAssignment.name}}"/>

And in C#:

String assignment = assignmentName.Value;

This works fine the first time, but then when the variable changes, the value stays the same (not only in the backend, but also in the html). Also, {{selectedAssignment.name}} does update in places where it's not a value attribute, like headers.

How can I make it update in the hiddenfield?

0

There are 0 answers