dimanche 23 avril 2017

Calling a function on a HTML check box change without submission using C#

I am using Visual Studio 2015 to create a ASP.NET web site. I have a DIV that is hidden by default and I am trying to display it if the user checks a check box. I am wondering if there is a way using C# to immediately display the DIV as soon as the user checks the box. I can't seem to find a way to recognize the change in state without the form being first submitted. I can easily achieve this using JavaScript however this is for a uni assignment and requires functionality to be implemented in C#. This is the HTML for the checkBox:

<form id="form1" runat="server">
    Limit Stations To My Location<asp:CheckBox ID="limitOptions" runat="server" onClick="toggleOptions()" /> 
    <br /><br />
    <div id="locationOptions" runat="server" hidden="hidden">
        Radius (KM)<asp:TextBox ID="radius" runat="server" Text="100"></asp:TextBox>
        <asp:Button ID="updateList" runat="server" Text="Button" OnClick="updateList_Click"/>
    </div>

Any help would be greatly appreciated.




Aucun commentaire:

Enregistrer un commentaire