Dear ALL,
i have one douts about my application.
this application i was developed by asp.net with vb.net.
my problem is,
i am trying to show my sql table data(ex: table name=test) into my web page.
and moreover in my table i have 2000 rows.
meanwhile i want to show all the rows where in that table on my web page.
But the problem is,
i displayed 2000 rows on my web page but its displaying too late which means after one minute only i got the result.
this is my problem.
Note : but if i have show just 20 rows then it will come very fast but 2000 rows will not.
please find my below source code and let me know where i made the mistake.
<b>design page: sample.aspx</b>
<pre lang="C#"><script type="text/javascript" language="javascript">
// ======================== //
// ===> Get Menu Items <=== //
// ======================== //
function GetMenuItems()
{
try
{
if (xmlHttp.readyState==4)
{
if (xmlHttp.status==200)
{
loggeduser=document.getElementById("hdnuser").value;
modefop=document.getElementById("hdnmode").value;
ValUser = document.getElementById("ValUser").value ;
var XmlData=xmlHttp.responseText;
if(XmlData.substring(0,1)=="<")
{
if (isShopaid==0)
{
ApplicationMenus.XMLDocument.loadXML(XmlData);
// ShowMenuPermision(isShopaid);
//document.getElementById("tabs1").style.display="inline";
}
}
else
throw "Invalid Xml"
if(isShopaid==0 && ApplicationMenus.xml != "")
BuildApplicationMenus(isShopaid);
//}
// if(isShopaid!=1)
LoadReportMenuItems(isShopaid);
document.getElementById("divProcess").style.visibility = "hidden";
ShowMenuPermision(isShopaid);
}
else
{
HandleAjaxError(xmlHttp,'divProcess');
}
}
}
catch (e)
{
ShowScriptError(e,"GetMenuItems");
}
}
// ===================================================== //
// ===> Build Application Menu Items in a Tree View <=== //
// ===================================================== //
function BuildApplicationMenus(id)
{
try
{
var Html = "<Table Id = 'Menu'"+id+" Border=0 class='sfont'>"
// =================== //
// ===> Main Menu <=== //
// =================== //
for(var Row = 0; Row < ApplicationMenus.XMLDocument.documentElement.childNodes.length; Row++)
{
if(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[2].nodeValue == 0)
{
if(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[3].nodeValue = -1)
{
if(AllowRep == 1 && modefop == "Add" )
Html += "<Tr><Td><img id=img"+ id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + " src='../images/plus.gif' onclick=show('"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "') style='cursor:hand;'></Td><Td><input type='checkbox' disabled='disabled' id='chk" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") +"' onclick=CheckAll('tbl" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "')>&nbsp;" + ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[1].nodeValue + "</Td></Tr>";
else
Html += "<Tr><Td><img id=img" + id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + " src='../images/plus.gif' onclick=show('"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "') style='cursor:hand;'></Td><Td><input type='checkbox' id='chk" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") +"' onclick=CheckAll('tbl" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "')>&nbsp;" + ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[1].nodeValue + "</Td></Tr>";
Html += "<Tr><Td></Td><Td><Table class='sfont' id = 'tbl" + id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "' style = display:none Border=0>"
// ========================= //
// ===> SubMenu Level 0 <=== //
// ========================= //
for(var SubRow = 0; SubRow < ApplicationMenus.XMLDocument.documentElement.childNodes.length; SubRow++)
{
if(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[2].nodeValue == ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue)
{
if((ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[3].nodeValue == "True") || (ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[3].nodeValue == 1))
{
if(AllowRep == 1 && modefop == "Add" )
Html += "<Tr><Td></Td><Td><img id=img" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + " src='../images/plus.gif' onclick=show('"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "') style='cursor:hand;'></Td><Td><input type='checkbox' disabled='disabled' id='chk" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "' onclick=CheckAll('tbl" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "');CheckParent('" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "','','')>&nbsp;" + ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[1].nodeValue + "</Td></Tr>";
else
Html += "<Tr><Td></Td><Td><img id=img" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + " src='../images/plus.gif' onclick=show('"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "') style='cursor:hand;'></Td><Td><input type='checkbox' id='chk" +id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "' onclick=CheckAll('tbl" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "');CheckParent('" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "','','')>&nbsp;" + ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[1].nodeValue + "</Td></Tr>";
Html += "<Tr><Td></Td><Td></Td><Td><Table class='sfont' id = 'tbl" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "' style = display:none Border=0>"
// ========================= //
// ===> SubMenu Level 1 <=== //
// ========================= //
for(var SubRow1 = 0; SubRow1 < ApplicationMenus.XMLDocument.documentElement.childNodes.length; SubRow1++)
{
if(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[2].nodeValue == ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue)
{
if((ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[3].nodeValue == "True") || (ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[3].nodeValue == 1))
{
if(AllowRep == 1 && modefop == "Add" )
Html += "<Tr><Td></Td><Td></Td><Td><img id=img" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue," ","") + " src='../images/plus.gif' onclick=show('"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue," ","") + "') style='cursor:hand;'></Td><Td><input type='checkbox' disabled='disabled' id='chk" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue," ","") + "' onclick=CheckAll('tbl" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue," ","") + "');CheckParent('"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "','" + id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "','')>&nbsp;" + ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[1].nodeValue + "</Td></Tr>";
else
Html += "<Tr><Td></Td><Td></Td><Td><img id=img" +id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue," ","") + " src='../images/plus.gif' onclick=show('"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue," ","") + "') style='cursor:hand;'></Td><Td><input type='checkbox' id='chk"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue," ","") + "' onclick=CheckAll('tbl" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue," ","") + "');CheckParent('"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "','" + id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "','')>&nbsp;" + ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[1].nodeValue + "</Td></Tr>";
Html += "<Tr><Td></Td><Td></Td><Td></Td><Td><Table class='sfont' id = 'tbl" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue," ","") + "' style = display:none>"
// ========================= //
// ===> SubMenu Level 2 <=== //
// ========================= //
for(var SubRow2 = 0; SubRow2 < ApplicationMenus.XMLDocument.documentElement.childNodes.length; SubRow2++)
{
if(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow2].attributes[2].nodeValue == ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue)
{
if(AllowRep == 1 && modefop == "Add" )
Html += "<Tr><Td></Td><Td></Td><Td></Td><Td><input type='checkbox' disabled='disabled' id='chk" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow2].attributes[0].nodeValue," ","") + "' onclick=CheckParent('"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "','" + id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "','" + id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue," ","") + "')>&nbsp;" + ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow2].attributes[1].nodeValue + "</Td></Tr><Tr><Td></Td></Tr>";
else
Html += "<Tr><Td></Td><Td></Td><Td></Td><Td><input type='checkbox' id='chk" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow2].attributes[0].nodeValue," ","") + "' onclick=CheckParent('" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "','" + id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "','" + id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue," ","") + "')>&nbsp;" + ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow2].attributes[1].nodeValue + "</Td></Tr><Tr><Td></Td></Tr>";
}
}
Html += "</Table></Td></Tr>"
}
else
{
if(AllowRep == 1 && modefop == "Add" )
Html += "<Tr><Td></Td><Td></Td><Td><img src='../images/transparent.gif'></Td><Td><input type='checkbox' disabled='disabled' id='chk"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue," ","") + "' onclick=CheckParent('"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "','" + id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "','')>&nbsp;" + ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[1].nodeValue + "</Td></Tr><Tr><Td></Td></Tr>";
else
Html += "<Tr><Td></Td><Td></Td><Td><img src='../images/transparent.gif'></Td><Td><input type='checkbox' id='chk" +id+ replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[0].nodeValue," ","") + "' onclick=CheckParent('"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "','" + id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "','')>&nbsp;" + ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow1].attributes[1].nodeValue + "</Td></Tr><Tr><Td></Td></Tr>";
}
}
}
Html += "</Table></Td></Tr>"
}
else
{
if(AllowRep == 1 && modefop == "Add" )
Html += "<Tr><Td></Td><Td><img src='../images/transparent.gif'></Td><Td><input type='checkbox' disabled='disabled' id='chk"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "' onclick=CheckParent('"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "','','')>&nbsp;" + ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[1].nodeValue + "</Td></Tr><Tr><Td></Td></Tr>";
else
Html += "<Tr><Td></Td><Td><img src='../images/transparent.gif'></Td><Td><input type='checkbox' id='chk"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[0].nodeValue," ","") + "' onclick=CheckParent('"+id + replaceAll(ApplicationMenus.XMLDocument.documentElement.childNodes[Row].attributes[0].nodeValue," ","") + "','','')>&nbsp;" + ApplicationMenus.XMLDocument.documentElement.childNodes[SubRow].attributes[1].nodeValue + "</Td></Tr><Tr><Td></Td></Tr>";
}
}
}
Html += "</Table></Td></Tr>"
}
}
}
Html += "\n</Table>";
document.getElementById("divAppMenus"+isShopaid).innerHTML = Html;
}
catch (e)
{
ShowScriptError(e,"BuildApplicationMenus(id)");
}
};
// ========================================= //
// ===> Replace strA with strb in text <=== //
// ========================================= //
function replaceAll(text, strA, strB)
{
try
{
while(text.indexOf(strA) != -1)
{
text = text.replace(strA,strB);
}
return text;
}
catch (e)
{
ShowScriptError(e, "replaceAll(text, strA, strB)");
}
}
// ======================================== //
// ===> Selection Changed in Drop Down <=== //
// ======================================== //
function SelectionChanged(isSelected)
{
try
{
if(isSelected==1)
{
document.getElementById("divAppMenus0").innerHTML="";
document.getElementById("divAppMenus1").innerHTML="";
}
loggeduser=document.getElementById("hdnuser").value;
ValUser = document.getElementById("ValUser").value ;
modefop=document.getElementById("hdnmode").value;
if(document.getElementById("cmbGroupName").options[document.getElementById("cmbGroupName").value].text != "Select GroupName")
{
var t = new Date();
LogInUser = document.getElementById("hdnuser").value;
document.getElementById("divProcess").style.visibility="visible";
xmlHttp = new ActiveXobject("Microsoft.XMLHTTP");
xmlHttp.onreadystatechange=GetMenuItems;
// xmlHttp.open('POST', '../masterutil/GetMasterGroup.aspx?User=' + document.getElementById("cmbGroupName").options[document.getElementById("cmbGroupName").value].text + "&t=" + t + "&LogInUser="+ LogInUser + "&ReqMode="+ isShopaid, true);
xmlHttp.open('POST', '../masterutil/test.aspx?User=' + document.getElementById("cmbGroupName").options[document.getElementById("cmbGroupName").value].text + "&t=" + t + "&LogInUser="+ LogInUser + "&ReqMode="+ isShopaid, true);
var strxml="SelectionChangeApp_" + document.getElementById("cmbGroupName").options[document.getElementById("cmbGroupName").value].text;
xmlHttp.send(strxml);
}
}
// }
catch (e)
{
ShowScriptError(e, "SelectionChanged(isSelected)");
}
};
</script></pre>
<select class="tBox" id="cmbGroupName" style="width: 183px;" onchange="SelectionChanged(1);"
name="cmbGroupName" runat="server">
<option value="0" selected>Select GroupName</option>
</select>
<b>code behind page: page name test.aspx.vb</b>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Helper.IsValidSession(Request, Application) Then
'Response.Write(Helper.Message4InvalidSession)
Response.Write("Session Expired")
' GoTo resEnd
' Response.End()
'Exit Sub
End If
Dim R As StreamReader
Dim xmlString As String
Dim ClientData As String
Dim Result As String = ""
Dim LogInUser As String
Try
usernm = "Admin"
lgusr = Request.QueryString("lguser")
LogInUser = Request.QueryString("LogInUser")
If Not Request.QueryString("ReqMode") Is Nothing Then
ReqMode = Request.QueryString("ReqMode")
End If
'==================================
'===> Loading Data from Client <===
'==================================
Usr = Request.QueryString("User")
getdt = Format(Helper.GetDateTime(), "yyyy-MM-dd hh:MM:ss")
Userby = LogInUser
R = New StreamReader(Request.InputStream)
ClientData = R.ReadToEnd
R.Close()
'=========================
'===> Open Connection <===
'=========================
Con = Helper.GetConnection
If Con.State <> ConnectionState.Open Then
Con.Open()
End If
' ElseIf ClientData.Substring(0, 18) = "SelectionChangeApp" Then
If ClientData.Substring(0, 18) = "SelectionChangeApp" Then
'====================================================
'===> Gets All Application Menus with Permission <===
'====================================================
Dim ClientDataArr As String()
Dim AppPermissions As DataTable
Dim UG As UserGroup
'===================================
'===> Get All Application Menus <===
'===================================
MenuItems = MasterHelper.GetMenuKeyTable(Con, ReqMode)
' MenuItems = MasterHelper.GetMenuKeyTable(Con)
'==================================================
'===> Gets Application Menus for the UserGroup <===
'==================================================
ClientDataArr = Split(ClientData, "_")
UG = New UserGroup("GroupName = '" & ClientDataArr(1) & "'", Con)
If UG.Permission = "" Then
UG.Permission = "0"
End If
If ReqMode = 0 Then
AppPermissions = UG.GetAppMenuPermissions()
ElseIf ReqMode = 1 Then
AppPermissions = UG.GetAppMenuPermissions4Shopaid()
End If
'=======================================================
'===> Creates Application Menu Xml with Permissions <===
'=======================================================
Menu = New XmlDocument
Menu.LoadXml("<Menu></Menu>")
For Each DR In MenuItems.Rows
SubMenu = Menu.CreateElement("SubMenu")
SubMenu.SetAttribute("MenuID", DR("MenuID"))
SubMenu.SetAttribute("Caption", Replace(DR("Caption"), "&", ""))
SubMenu.SetAttribute("ParentID", DR("ParentID"))
SubMenu.SetAttribute("HasChild", DR("HasChild"))
If AppPermissions.Select("MenuID = " + DR("MenuID").ToString + "").Length > 0 Then
SubMenu.SetAttribute("Checked", 1)
Else
SubMenu.SetAttribute("Checked", 0)
End If
Menu.DocumentElement.AppendChild(SubMenu)
Next
Result = Menu.OuterXml
Else
Result = "Invalid Mode"
End If
Catch Ex As Exception
Result = Helper.FormatErrorMessage(Ex, ErrorMsgFormat.WindowFormat)
Finally
If Not Con Is Nothing Then Con.Close()
End Try
Response.Write(Result)
Response.End()
End Sub
thanks to all.