JSON (JavaScript Object Notation) is a lightweight data-interchange format. For
more information About JSON Please see
http://www.json.org/
jQuery is a library that makes it quicker and easier to build JavaScript
webpages and web application.
The jQuery library actually comes in 2 forms.
- Uncompressed .js
- Minified .js
For more information about jQuery and its plugin
http://plugins.jquery.com/
In this project we use Newtonsoft.Json library makes working with JavaScript and
JSON formatted data in .NET simple. Quickly read and write JSON using the
JsonReader and JsonWriter or serialize your .NET objects with a single method
call using the JsonSerializer.
For more Information about Json.NET http://json.codeplex.com/
Your aspx Page like
<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD
XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>JSON
Example By Jayendra</title>
<styletype="text/css">
.style1
{
width: 100%;
}
.style2
{
width: 64px;
}
</style>
<scriptlanguage="javascript"type="text/javascript"src="JScript/jquery-1.2.6.js"></script>
<scripttype="text/javascript">
$(document).ready(function()
{
$('#<%=ddlState.ClientID %>').change(function()
{
var
id = $('#<%=ddlState.ClientID %>').val();
if
(id != "--Select State--") {
$('#<%=ddlCity.ClientID %>').html("");
$.getJSON("Responce.aspx?id="
+ id, function(citys) {
$.each(citys, function()
{
$('#<%=ddlCity.ClientID
%>').append($("<option></option>").val(this['ID']).html(this['CityName']));
});
});
}
});
$('#<%=ddlCity.ClientID %>').change(function()
{
var
cityid = $('#<%=ddlCity.ClientID %>').html();
alert(cityid);
});
});
</script>
</head>
<body>
<formid="form1"runat="server">
<div>
<tableclass="style1">
<tr>
<tdclass="style2">
State:
</td>
<td>
<asp:DropDownListID="ddlState"runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<tdclass="style2">
City:
</td>
<td>
<asp:DropDownListID="ddlCity"runat="server">
</asp:DropDownList>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

sameer dasPosted May 25, 2013, 9:02 PM
thanks
Shahid RazaeditedPosted Sep 7, 2012, 9:03 AMEdited Sep 7, 2012, 9:04 AM
fine...
Biswarup SahaPosted Jul 16, 2012, 6:06 AM
Thanks..