Click here to Skip to main content
15,909,835 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
JavaScript
function BindGridViewA() {
	var txtValue = $("#<%=txtAssets.ClientID%>").val();
	var LgrGrpId = window.location.search.toString();

	$.getJSON('BalanceSheet1.ashx?LgrGrpType=A&Search=' + txtValue + '', function (BankStatement) {
		debugger;
		var data = BankStatement;
		var AltColor = "#FAF9F2";
		if (LgrGrpId != '') {

			var queryStringColl = null;

			//Get querystring from url
			var requestUrl = window.location.search.toString();

			if (requestUrl != '') {
				//window.location.search returns the part of the URL
				//that follows the ? symbol, including the ? symbol
				requestUrl = requestUrl.substring(1);

				queryStringColl = new Array();

				//Get key:value pairs from querystring
				var kvPairs = requestUrl.split('&');

				for (var i = 0; i < kvPairs.length; i++) {
					var kvPair = kvPairs[i].split('=');
					LgrGrpId = kvPair[1];
				}
			}
		}
		$("#<%=gdvAssets.ClientID%>").empty();
		$("#<%=gdvAssets.ClientID%>").append("<tr style='font-weight:bold;background-color:#96CDCD'><th>Assets</th><th align='right'></th></tr>");
		for (var i = 0; i < data.length; i++) {
			if (AltColor == "#FAF9F2") {
				AltColor = "white";
			}
			else {
				AltColor = "#FAF9F2";
			}
			$("#<%=gdvAssets.ClientID%>").append("<tr style='background-color:" + AltColor + ";border-removed 1px solid #E7DFBD;'>" +
            '<td><a href="../Account/BalanceSheet.aspx?LgrGrpId=' + data[i].LgrGrpId + '">' + data[i].Name + '</a></td>' +
            '<td align="right">' + commaSeparateNumber(data[i].DrAmount) + '</td>' +
            '</tr>');
			if (LgrGrpId != '') {
				$.getJSON('BalanceSheet1.ashx?LgrGrpType=L&LgrGrpId=' + LgrGrpId + '', function (Lgrs) {
					var data1 = Lgrs;
					for (var h = 0; h < data1.length; h++) {

						if (data[i].LgrGrpId == LgrGrpId) {
							$("#<%=gdvAssets.ClientID%>").append("<tr>" +
                            '<td align="Left">     ' + data1[h].Name + '</td>' +
                            '<td align="Left">' + commaSeparateNumber(data1[h].DrAmount) + '</td>' +
                            '</tr>');
						}

					}
				});
			}
		}
	});
}

In above Code i am Calling Value 2 Times Using Json Function Now Problem Is That when i am calling second time that time i get the value but not display but if i see with debugger then everthing working fine. So Tell me what is the problem?
Posted
Updated 16-Dec-14 1:59am
v2
Comments
ZurdoDev 16-Dec-14 7:47am    
I don't understand what your problem is.
Member 10453691 16-Dec-14 8:02am    
In these json "$.getJSON('BalanceSheet1.ashx?LgrGrpType=L&LgrGrpId=' + LgrGrpId + '', function (Lgrs)"

dispaly the data when i see with debugger and If i Refresh Without Debugger then data load but not display .
ZurdoDev 16-Dec-14 8:12am    
$.getJSON has nothing to do with displaying data. You need to step into that code and see what is happening.
Member 10453691 16-Dec-14 8:13am    
my code side is nothing i manage everthing in aspx page and i m pass data from ashx file.
ZurdoDev 16-Dec-14 8:23am    
You are making this very hard. We're trying to help you but you aren't being clear about what you need help with. Remember, we can't see anything other than the little you have posted here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900