Umesh K.
Umesh K.

Reputation: 311

How to fire Click event of Check Box in asp.Net MVC Razor

I have a check box for "IsQuantityAvailable" for selecting if a seller have availability of commodities and on CLICK of this chkBox I have to show a TextBox for entering quantity of commodity.Please suggest a solution using MVC Razor...Thanks!!

Upvotes: 5

Views: 23965

Answers (1)

amarnath chatterjee
amarnath chatterjee

Reputation: 1962

As mario suggested, the solution hasn't much to do with razor, however this might help. Create the checkbox using Html.Checkbox or Html.CheckboxFor if u have strict model binding. Add onclick eventhandler to checkbox while adding

@Html.Checkbox( "somename", new { @onclick="function-to-open-dialog()"})

Implementation of "function-to-open-dialog" will depend upon what you are using at client site. If its jquery then it could be simple call like $("#DialogId").dialog("open")

Upvotes: 9

Related Questions