Skip to main content

Posts

Showing posts from June, 2013

The 'Nc.Common.Security.CustomRoleProvider' requires a database schema compatible with schema version '1'

Error : The 'Nc.Common.Security.CustomRoleProvider' requires a database schema compatible with schema version '1'. However, the current database schema is not compatible with this version. You may need to either install a compatible schema with aspnet_regsql.exe (available in the framework installation directory), or upgrade the provider to a newer version. Solution : There is a table called aspnet_schemaversions.  It requires some values to be able to validate the versions (duh).  When I added these values into the table, it started working. common 1 True health monitoring 1 True membership 1 True  personalization 1 True  profile 1 True  role manager 1 True  

How to access webcam from asp.net

Hello, For webcam application you got to use the third party api......if interested check out the following links.....they are good and east api's and definitely you will feel comfortable with them.... Webcam model detection using flash..... http://www.bing.com/search?q=webcam+flash+site%3Aadobe.com&form=QBRE&filt=all A COM for webcam services..... http://www.codeproject.com/KB/cpp/webcamcsharp.aspx webcam application using WPF.... http://www.bing.com/search?q=webcam+wpf&form=OSDSRC More Info http://weblogs.asp.net/nleghari/articles/webcam.aspx http://weblogs.asp.net/gunnarpeipman/archive/2013/01/30/using-jquery-webcam-plugin-with-asp-net-mvc.aspx http://stackoverflow.com/questions/6579407/jquery-webcam-plugin-save-image-without-php

Validation within user control

Create a property on your new user control that sets the validation group on the contained validator. Then from your markup, all you need to do is just set the ValidationGroup property on the control, and that'll roll to the validators contained in the user control. You likely don't need the interface or inheriting from BaseValidator unless you are creating JUST a validation user control. Sample Code  public string ValidationGroup { get { return MyRequiredFieldValidator.ValidationGroup; } set { MyRequiredFieldValidator.ValidationGroup = value; } }

Fileupload control css in asp.net

The input file tag (which is the base of FileUpload control ) is a robust control because of different security purposes so you can't change it's look and feel or values easily http://the-echoplex.net/log/how-to-style-a-html-file-upload-control-using-css-and-javascript http://filamentgroup.com/lab/jquery_custom_file_input_book_designing_with_progressive_enhancement/

How to make asp:TextBox to enter only numbers and round up to two decimal points

function isNumberKey(sender, evt) {     var txt = sender.value;     var dotcontainer = txt.split('.');     var charCode = (evt.which) ? evt.which : event.keyCode;     if (!(dotcontainer.length == 1 && charCode == 46) && charCode > 31 && (charCode < 48 || charCode > 57))         return false;     return true; } This function will not allow user to enter anything other than numbers. So the ASPX markup of the textbox should looks like below Now, since we allow only numbers in that textbox, we can perform the round up operation for the value. For that, we can use the below javascript function function mathRoundForTaxes(source) {     var txtBox = document.getElementById(source);     var txt = txtBox.value;     if (!isNaN(txt) && isFinite(txt) && txt.length != 0) {        var rounded = Math.round(txt * 100) / 100;        txtBox.value = rounded.toFixed(2);     } } This function will round up the entered numeric value. So altogether, fin

How to Convert image to a byte array in ASP.Net

Following example shows how to take the byte representation of an image. How to convert image into byte[] and byte[] to image using C# in ASP.NET using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; namespace WebApplication2 {     public partial class _Default : System.Web.UI.Page     {         protected void Page_Load(object sender, EventArgs e)         {             string strPhoto = (@"C:\\Webcam.jpg");             FileStream fs = new FileStream(strPhoto, FileMode.Open, FileAccess.Read);             Byte[] imgByte = new byte[fs.Length];             fs.Read(imgByte, 0, System.Convert.ToInt32(fs.Length));         }     } } source reference from  : http://blogs.msdn.com/b/vijay/archive/2007/07/20/how-to-convert-image-into-byte-and-byte-to-image-using-c-in-asp-net.aspx

Google Search In ASP NET

< body >      < form   id ="form1"   runat ="server">      < div >          < asp : TextBox   ID ="TextBox1"   runat ="server"   Width ="300px"></ asp : TextBox >          < asp : Button   ID ="btnSearch"   runat ="server"   Text ="Google Search"   OnClick ="Button1_Click"   />< br   />          < asp : DataList   ID ="dlSearch"   runat ="server"   Width ="600px">              < ItemTemplate >                  < asp : LinkButton   ID ="LinkButton1"   runat ="server"   Text =' <% # Eval("Title")  %> ' PostBackUrl =' <% # Eval("Url")  %> '></ asp : LinkButton >< br   />                  < asp : Label   ID ="Label1"   runat ="server"   Text =' <% # Eval("Content")  %> '></ asp : La

Crop an image when uploading to the server in ASP.NET

To crop an image when saving it to the server through asp:FileUpload control, we can use the below code. Here I’m using the Clone method of the Bitmap class and I’ve specified my area from the Rectangle. It actually creates a copy of the image within the specified area by the Rectangle. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Drawing; namespace WebApplication1 {     public partial class About : System.Web.UI.Page     {         protected void Page_Load(object sender, EventArgs e)         {         }         protected void Button1_Click(object sender, EventArgs e)         {             int x, y, width, height;             x = y = 0; //X, Y values for crop the image.             width = 300;             height = 300;             Rectangle cropArea = new Rect

Ajax control toolkit tabcontainer css

Here I going to explain How to apply custom css to Ajax control toolkit tabcontainer css ,  Applying Css to TabContainer Previous Post I was Explained about    Difference Between ASP.NET WebForms and ASP.NET MVC ,  Responsive web Design              Apply the Css using the  TabContainer Property   CssClass="MyTabStyle" , If you want to change you can change  the css .          . MyTabStyle . ajax__tab_header { font-family : "Helvetica Neue" , Arial , Sans-Serif ; font-size : 14px ; font-weight : bold ; display : block ; } . MyTabStyle . ajax__tab_header . ajax__tab_outer { border-color : #222 ; color : #222 ; padding-left : 10px ; margin-right : 3px ; border : solid 1px #d7d7d7 ; } . MyTabStyle . ajax__tab_header . ajax__tab_inner { border-color : #666 ;

Conversion of 24 hours (format) time to 12 hours (format) time and vice versa using Javascript

function ConvertTo24HoursFormat ( timeIn12HoursFormat ){ var tempDate = new Date ( "19/01/2012 " + timeIn12HoursFormat . toString ()); if (! IsValid12HoursTimeFormat ( timeIn12HoursFormat ) || tempDate == "Invalid Date" ) { alert ( "Invalid time, please check..." ); return ; } return tempDate . toTimeString (). split ( ":" )[ 0 ] + ":" + tempDate . toTimeString (). split ( ":" )[ 1 ]; } function ConvertTo12HoursFormat ( timeIn24HoursFormat ) { var tempDate = new Date ( "19/01/2012 " + timeIn24HoursFormat . toString ()); if (! IsValid24HoursTimeFormat ( timeIn24HoursFormat ) || tempDate == "Invalid Date" ) { alert ( "Invalid time, please check..." ); return ; } var parsedTime = parseInt ( GetNumericValue ( tempDate . toTimeString (). s