Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!!

like image 425
Umesh K. Avatar asked May 02 '12 19:05

Umesh K.


1 Answers

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")

like image 145
amarnath chatterjee Avatar answered Nov 19 '22 20:11

amarnath chatterjee