Sunday, May 17, 2015

ASP.NET Get radio button value in javascript

Radio button html

 <input type="radio" name="mxCard" id="mxcard" data-id="<%=mxcard.MxFormaterCreditCard%>" value="<%=mxcard.MxFormaterCreditCard%>" />  

get radio button value in java script

  var selectedVal = "";  
         var selected = $('input[type=radio][name=mxCard]:checked').val();  
         if (selected) {  
           // Do something  

Wednesday, May 6, 2015

Detect browser language and other information in ASP.NET

If you just want to detect browser language you can use this

  CultureInfo ci;  
       if (userLanguages.Count() > 0)  
           ci = new CultureInfo(userLanguages[0]);  
         catch (CultureNotFoundException)  
           ci = CultureInfo.InvariantCulture;  
         ci = CultureInfo.InvariantCulture;  

if you want to get more details then use this

   string browser = HttpContext.Request.Browser.Browser;  
       string version = HttpContext.Request.Browser.Version;  
       string type = HttpContext.Request.Browser.Type;  
       string platform = HttpContext.Request.Browser.Platform;  
       string userAgent = HttpContext.Request.UserAgent;  
       string[] userLang = HttpContext.Request.UserLanguages;  
       var userLanguages = Request.UserLanguages;  

For MVC use this in your Home controller action.

Tuesday, May 5, 2015

Session value show in html ASP.NET

Set the value:

  HttpContext.Current.Session["CVVAndOTPRequiredCardMessage"] = cardNoMessage;  
         HttpContext.Current.Session["CVVAndOTPRequiredCardMessage2"] = cardNoMessage2;  

Show session value in html:


vfpoledeb.1 provider is not registered on the local machine

Have u Install VFP Ole DB Provider in your System ? If No then Please Install it from following link.