i have a div dvContent. i have included your modified code. i am getting 3 alerts. but data is not getting refreshed. so what could be the problem genius?.actually i have jsut changed the database
path in your blog and included timer concept also. but there also it is not refreshing. please man
making impossible into possible is possible when we have determination,dedication,devotion.
i am getting the html if i use alert(GetNodeData(Grid));
let me explain the situation what i am trying so for now. i have 3 rows in my table. so when i run this sample my 3 rows are getting displyed.there is no problem in that.then i am addding the fourth row in the database manually.so now my table have 4 rows.
but here the three rows only displayed. the latest added 4 th row is not getting displayed. so the old values mainted strongly. please help me friend.
making impossible into possible is possible when we have determination,dedication,devotion.
nope, i am getting the old values only. the newly added(4th row) row i am not getting in the alert. it maintains the old values only. what's wrong with this friend?
making impossible into possible is possible when we have determination,dedication,devotion.
<div id=ctl00_ctl00_bcr_bcr_PostForm__QuoteText>nope, i am getting the old values only. the newly added(4th row) row i am not getting in the alert. it maintains the old values only. what's wrong with this friend?</div>
Sorry net was down
Then something is wrong server side try to debug and see
Hi friend, i came to home from office. can you please give your mail id.so that i could send the .cs code t o you. is this possible for you? please.i tried to debug fro mthe server side.but i couldn't fine the bug. so can you please. if not i will post
the server side code for your refrence. can u ?
making impossible into possible is possible when we have determination,dedication,devotion.
born2win
Member
89 Points
411 Posts
Re: call serverside code in javascript with timer
Feb 24, 2009 07:52 AM|LINK
Hi Friend,
i am getting 3 alerts.(Level1,Level2,Level3). then what could be the problem. why the data is not refreshed? please
if you give your mail id i will forward my sample application which i am trying.so that it would be very easy for you to solve the issue genius.
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: call serverside code in javascript with timer
Feb 24, 2009 08:10 AM|LINK
Check if you have a div dvContent
and I have modified the function use it now and let me know if all alerts fire??
function ParseXML(xml){
if (xml!=null){
alert("Level1");
var Error = xml.getElementsByTagName('ERROR')[0];
if (Error == null || GetNodeData(Error) == "False"){
alert("Level2"); var Pager = xml.getElementsByTagName('PAGER')[0]; var Grid = xml.getElementsByTagName('GRID')[0];if (Grid != null && Pager!= null){
document.getElementById (
"dvContent").innerHTML = GetNodeData(Grid); alert("Level3");}
}
else{
document.getElementById ("lblError").innerText = GetNodeData(Error);}
}
}
Contact me
born2win
Member
89 Points
411 Posts
Re: call serverside code in javascript with timer
Feb 24, 2009 08:20 AM|LINK
Hi Friend,
i have a div dvContent. i have included your modified code. i am getting 3 alerts. but data is not getting refreshed. so what could be the problem genius?.actually i have jsut changed the database path in your blog and included timer concept also. but there also it is not refreshing. please man
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: call serverside code in javascript with timer
Feb 24, 2009 08:26 AM|LINK
Yes Be patient we are near to it
Replace
alert("Level3");
with
alert(GetNodeData(Grid));
and let we know can you html in the alert or not?
Contact me
born2win
Member
89 Points
411 Posts
Re: call serverside code in javascript with timer
Feb 24, 2009 08:34 AM|LINK
hi friend,
i am getting the html if i use alert(GetNodeData(Grid));
let me explain the situation what i am trying so for now. i have 3 rows in my table. so when i run this sample my 3 rows are getting displyed.there is no problem in that.then i am addding the fourth row in the database manually.so now my table have 4 rows. but here the three rows only displayed. the latest added 4 th row is not getting displayed. so the old values mainted strongly. please help me friend.
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: call serverside code in javascript with timer
Feb 24, 2009 08:47 AM|LINK
Do you get 4 rows here alert(GetNodeData(Grid)); in the alert
Contact me
born2win
Member
89 Points
411 Posts
Re: call serverside code in javascript with timer
Feb 24, 2009 08:53 AM|LINK
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: call serverside code in javascript with timer
Feb 24, 2009 11:50 AM|LINK
Sorry net was down
Then something is wrong server side try to debug and see
Contact me
born2win
Member
89 Points
411 Posts
Re: call serverside code in javascript with timer
Feb 24, 2009 01:02 PM|LINK
Hi friend, i came to home from office. can you please give your mail id.so that i could send the .cs code t o you. is this possible for you? please.i tried to debug fro mthe server side.but i couldn't fine the bug. so can you please. if not i will post the server side code for your refrence. can u ?
born2win
Member
89 Points
411 Posts
Re: call serverside code in javascript with timer
Feb 25, 2009 01:55 AM|LINK
Hi Khan,
here is my .cs code. i tried with the debug mode. but i couldn't find the problem where it exists.
.cs code
protected void Page_Load(object sender, EventArgs e) { { if ((Request.QueryString["Page"] != null)) { DataTable dtget1 = new DataTable(); dtget1= GetData("SELECT CustomerID, CompanyName, ContactName, ContactTitle, City FROM Customers"); string strResults = PopulateGrid(dtget1); StringBuilder strResponse = new StringBuilder(); strResponse.Append("<RESPONSE><VALUES><ERROR>False</ERROR><PAGER><![CDATA["); strResponse.Append("]]></PAGER><GRID><![CDATA["); strResponse.Append(strResults); strResponse.Append("]]></GRID></VALUES></RESPONSE>"); Response.Clear(); Response.ContentType = "text/xml"; Response.Write(strResponse.ToString()); Response.End(); } else { DataTable dtget = new DataTable(); dtget= GetData("SELECT CustomerID, CompanyName, ContactName, ContactTitle, City FROM Customers"); dvContent.InnerHtml = PopulateGrid(dtget); } } } private DataTable GetData(string strQuery) { DataTable dt = new DataTable(); dt.Rows.Clear(); SqlConnection con = new SqlConnection("server=10.87.145.120;Database=NORTHWND;Uid=sa;pwd=infosys"); SqlCommand cmd = new SqlCommand(strQuery, con); SqlDataAdapter sda = new SqlDataAdapter(); cmd.CommandType = CommandType.Text; try { con.Open(); sda.SelectCommand = cmd; sda.Fill(dt); } catch (Exception ex) { return dt; } finally { con.Close(); cmd.Dispose(); sda.Dispose(); } return dt; } private string PopulateGrid(DataTable dtGrid) { StringBuilder strResults = new StringBuilder(); strResults.Append(" <table id = 'tblContent' cellpadding = '0' cellspacing = '0' width = '800px'>"); strResults.Append("<tr class = 'rowstyle'>"); for(int i=0;i"<td class = 'rowcell'>"); strResults.Append(dtGrid.Rows[i]["CustomerID"].ToString()); strResults.Append("</td>"); strResults.Append("<td class = 'rowcell'>"); strResults.Append(dtGrid.Rows[i]["CompanyName"].ToString()); strResults.Append("</td>"); strResults.Append("<td class = 'rowcell'>"); strResults.Append(dtGrid.Rows[i]["ContactName"].ToString()); strResults.Append("</td>"); strResults.Append("<td class = 'rowcell'>"); strResults.Append(dtGrid.Rows[i]["ContactTitle"].ToString()); strResults.Append("</td>"); strResults.Append("<td class = 'rowcell'>"); strResults.Append(dtGrid.Rows[i]["City"].ToString()); strResults.Append("</td>"); strResults.Append("</tr>"); } strResults.Append("</table>"); return strResults.ToString(); }