html - i have created a button that is generating a voucher number but it is not refreshing to come with new voucher number -


when button clicking, genrating random number want when button click comes new voucher number every time

this controller generating random number

   static random random = new random();    public list<string> randomvouchers()     {          int voucherstogenerate = 1;         int lengthofvoucher = 10;            list<string> generatedvouchers = new list<string>();         char[] keys = "abcdefghijklmnopqrstuvwxyz01234567890".tochararray();          while (generatedvouchers.count < voucherstogenerate)         {             string voucher = generatevoucher(keys, lengthofvoucher);             if (!generatedvouchers.contains(voucher))             {              generatedvouchers.add(voucher);                  return generatedvouchers;              }          }         return generatedvouchers;     }     private static string generatevoucher(char[] keys, int lengthofvoucher)     {          return enumerable             .range(1, lengthofvoucher) // for(i.. )              .select(k => keys[random.next(0, keys.length - 1)])  // generate new random char              .aggregate("", (e, c) => e + c); // join string     } 

this orders page :

<div id="vouchercode" style="display:none"> <ul>     @foreach (string strvouchers in viewbag.vouchers)     {         <li>@strvouchers</li>     } </ul></div> <button id="getvoucher">generatevoucher</button>  

this javascript code:

<script type="text/javascript"> $(function () {     $("#getvoucher").click(function () {            $("#vouchercode").dialog({               width: 460,             height: 200,             modal: true,            });      });  }); 


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -