30 Aug 2013

How to Pan Card Validation in Asp.net.

Hello,

Below script helps to bind the user to enter the value in the textbox which
will validate pan card number in India.

In India Pan card no is 10 digit alpha numeric.
First 5 are alphabets only followed by 4 numeric and at last one alphabet.


To achieve this simply follow the following Steps

Write the below javascript function in the aspx page under head section :


<script type="text/javascript">
function Validation()
{
var txt_pan=document.getElementById('TextBox1').value;

var checkval=/^[A-Z]{5}\d{4}[A-Z]{1}$/;
if(checkval.test(txt_pan)== false)
{
  alert('Please enter valid pan number');
  return false;
}
}
</script>

In the Body Section of the .aspx page just bind the onClientclickevent of the button to the function above in the javascript to check the value of TextBox1
Take one texbox and button control on the page as shown below


<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="javascript:return Validation();" />

29 Aug 2013

How do I disable/enable a form element?

enable or disable a form element using the .prop() method: // Disable #div1
$( "#div1" ).prop( "disabled", true );
// Enable #div1
$( "#div").prop( "disabled", false );

How to Change colour on mouseover.

Hello.
The code to change colour (textbox,button,cell,tr etc). You can make a class in HTML design form and then call that function on code file.
Step 1:-
First of all make a css class as shown below:



<style type="text/css">

.normalRow
{
background-color:Red;
cursor:pointer;

.highlightRow
{
background-color:white;
cursor:pointer;
}
</style>
Step 2:-
Now call this css in code file like (this is for table row TR):

 tr1.Attributes.Add("onmouseover", "this.className=('highlightRow');");
 tr1.Attributes.Add("onmouseout", "this.className=('normalRow');");

Write a 'C' program to animate a circle?

The program in ‘C’ Programming language to draw a circle on the screen and animate it is as follows:
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include <dos.h>

#define RADIUS 50
#define DELAY 20

void main()
{
            int x=0, y=0, gdriver=DETECT, gmode=4;
            clrscr();
            initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
            while(!kbhit())
            {
                        for(x=0, y=0; x<getmaxy() && !kbhit();)
                        {
                                    circle(x++, y++, RADIUS);
                                    delay(DELAY);
                                    cleardevice();
                        }

                        cleardevice();
            }

            getch();
            closegraph();

}

27 Aug 2013

What is ASP.NET MVC

ASP.NET is a development framework for building web pages and web sites with HTML, CSS, JavaScript and server scripting.
ASP.NET supports three different development models:
Web Pages, MVC (Model View Controller), and Web Forms.

The MVC Programming Model

MVC is one of three ASP.NET programming models.
MVC is a framework for building web applications using a MVC (Model View Controller) design:
  • The Model represents the application core (for instance a list of database records).
  • The View displays the data (the database records).
  • The Controller handles the input (to the database records).
The MVC model also provides full control over HTML, CSS, and JavaScript.


The MVC model defines web
applications with 3 logic layers:

The business layer (Model logic)
The display layer (View logic)
The input control (Controller logic)

The Model is the part of the application that handles the logic for the application data.
Often model objects retrieve data (and store data) from a database.
The View is the parts of the application that handles the display of the data.
Most often the views are created from the model data.
The Controller is the part of the application that handles user interaction.
Typically controllers read data from a view, control user input, and send input data to the model.
The MVC separation helps you manage complex applications, because you can focus on one aspect a time. For example, you can focus on the view without depending on the business logic. It also makes it easier to test an application.

What is C#?

C# is a modern, general-purpose object oriented programming language developed by Microsoft and approved by Ecma and ISO.
C# was developed by Anders Hejlsberg and his team during the development of .Net Framework.
C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows use of various high-level languages to be used on different computer platforms and architectures.
The following reasons make C# a widely used professional language:

  • Modern, general purpose programming language
  • Object oriented.
  • Component oriented.
  • Easy to learn.
  • Structured language.
  • It produces efficient programs.
  • It can be compiled on a variety of computer platforms.
  • Part of .Net Framework.

Strong Programming Features of C#

Although C# constructs closely follows traditional high level languages C and C++ and being an object oriented programming language, it has strong resemblance with Java, it has numerous strong programming features that make it endearing to multitude of programmers worldwide.
Following is the list of few important features:

  • Boolean Conditions
  • Automatic Garbage Collection
  • Standard Library
  • Assembly Versioning
  • Properties and Events
  • Delegates and Events Management
  • Easy to use Generics
  • Indexers
  • Conditional Compilation
  • Simple Multithreading
  • LINQ and Lambda Expressions
  • Integration with Windows

How to getting Data through web Services with jquery in asp.net c#.

In Html


<div id="div_id"></div>


In Jquery code  JqueryDatabind.js


$.fn.DataBind = function () {    
    var data = "{}";
    var url = "Testing.aspx/get_data";

    $(this).AjaxPOST(url, data, function (d) {
        if (typeof (d[0]) !== 'undefined') {
                $('#div_id').append(d[0].id.toString());
        }
    });
}


In Web Services Code

 public class DataId

 {

     public string id;
 }

[WebMethod]
public List<DataIdget_data()
{
  List<DataId> dataid= new List<DataId>();
  string query = "";
  try
  {
    // pass your Sql  connectionstring  Web.config
   SqlConnection con = new SqlConnection(Pass Your         ConnectionString );
   con.Open();
   query = "select dataid From YourTableName";
   SqlDataAdapter da = new SqlDataAdapter(query, con);
   DataSet ds = new DataSet();
   da.Fill(ds);
   

if(ds.Tables[0].Rows.Count>0)
   {
       DataListId data_list = new DataListId();

       data_list.id= ds.Tables[0].Rows[0]["dataid"].ToString();
       dataid.Add(data_list);
   }
   con.Close();
 }
 catch (Exception ex)
 {
 }
 return dataid;
}

How to export GridView data to excel in asp.net in C#.

 protected void btnexport_Click(object sender, EventArgs e)
 {
        string attachment = "attachment;         filename=RepurchaseRpt".xls";
        Response.Clear();
        Response.AddHeader("content-disposition", attachment);
        Response.Charset = "";
        Response.ContentType = "application/vnd.xls";
        System.IO.StringWriter stringWrite = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
        GridView1.RenderControl(htmlWrite);
        Response.Write(stringWrite.ToString());
        Response.End();
    }
    public override void VerifyRenderingInServerForm(Control control)
    {
    }

26 Aug 2013

What is a Web Service.?

Web services are small units of code designed to handle a limited set of tasks.
An example of a web service can be a small program designed to supply other applications with the latest stock exchange prices. Another example can be a small program designed to handle credit card payment.

Web services use the standard web protocols HTTP, XML, SOAP, WSDL, and UDDI.

• Web Services Standards (XML-based)
– SOAP (Simple Object Access Protocol)
– WSDL (Web Service Description Language)
– UDDI (Universal Description, Discovery, Integration)
– WS-I (integration), WS-Policy, WS-Security, etc.
• Chances and Challenges
– Application Wrappers to WS
– Web Services Compositions
– Holy Grail: large reusable library of WS with interoperability:
1,000 public WS ~ 1 Million private WS
– ROI (Return of Investments): > 10x ?
– Issues: Privacy, Security, Performance

example:-

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;

namespace WebServiceExample
{
    public class Service1 : System.Web.Services.WebService
    {
        public Service1()
        {
            
            InitializeComponent();
        }
        [WebMethod(Description="This Method prints HelloWorld")]
        public string HelloWorld()
        {
            return "Hello World";
        }
    }

}

How to create Datepicker in jquery

<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker </title>
<link rel="stylesheet" href="css/jquery-ui.css" />
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui.js"></script>
<link rel="stylesheet" href="csss/style.css" />
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" /></p>
</body>

How to set cookie expiration time in jquery

$.cookie("testing", "testvalue", { expires: 1 });

How to create cookie in jquery

$.cookie("testing", 1);

how to find url in jquery.



$(document).ready(function() {
   var url= window.location.pathname;
   var fullurl= window.location;
});


23 Aug 2013

Create autocomplete textbox in jquery

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <meta charset="utf-8" />
  <title>jQuery UI Autocomplete - Default functionality</title>
  <link rel="stylesheet" href="js/jquery-ui.css" />
  <script src="js/jquery-1.9.1.js"></script>
  <script src="js/jquery-ui.js"></script>
  <link rel="stylesheet" href="css/style.css" />
  <script>
  $(function() {
    var availableTags = [
      "ActionScript",
      "AppleScript",
      "Asp",
      "BASIC",
      "C",
      "C++",
      "Clojure",
      "COBOL",
      "ColdFusion",
      "Erlang",
      "Fortran",
      "Groovy",
      "Haskell",
      "Java",
      "JavaScript",
      "Lisp",
      "Perl",
      "PHP",
      "Python",
      "Ruby",
      "Scala",
      "Scheme"
    ];
    $( "#tags" ).autocomplete({
      source: availableTags
    });
  });
  </script>
</head>
<body>

<div class="ui-widget">
  <label for="tags">Tags: </label>
  <input id="tags" />
</div>


</body>
</html>




Create a table in jquery

In html page create a div like
<div id="div_id"></div>
and in jquery:
$('#div_id').append(  '<table>' );

 for(i=0;i<3;i++){
    $('#div_id').append( '<tr><td>' + 'result' +  i + '</td></tr>' );
}

 $('#div_id').append(  '</table>' );


20 Aug 2013

How to connection string in ASP.NET to SQL SER...

<connectionStrings>
    <add name="MyCon" connectionString="Data Source=SqlserverName;Initial Catalog
=YourDataBaseName;Integrated Security=True;" providerName="System.Data.SqlClient" />
  </connectionStrings>

How to get the current URL in jQuery?

To get the path, you can use:
var pathname = window.location.pathname;

On select change, get data attribute value

$('select').change(function(){
    alert($(this).data('id'));
});

<select>
    <option data-id="1">one</option>
    <option data-id="2">two</option>
    <option data-id="3">three</option>
</select>

How to Create WEBSITE DESIGN

Way2finder Technologies is a web design studio that offers corporate web design and custom web design. Our website designers offer cheap w...