27 Aug 2013

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<DataId> get_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;
});


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