Pages

Saturday, January 29, 2011

Maintain Scroll position in div

This javascript is useful for maintaining scroll position in Panel or div tag...

Following code in Script Tag....
window.onload = function(){
var strCook = document.cookie;
if(strCook.indexOf("!~")!=0){
var intS = strCook.indexOf("!~");
var intE = strCook.indexOf("~!");
var strPos = strCook.substring(intS+2,intE);
document.getElementById("divTest").scrollTop = strPos;
}
}
function SetDivPosition(){
var intY = document.getElementById("divTest").scrollTop;
document.title = intY;
document.cookie = "yPos=!~" + intY + "~!";
}


Following code in body


< div id="divTest" width:150px;height:200px;overflow:auto" onscroll="SetDivPosition()">
--Gridview (or more data)
</div>

Tuesday, January 11, 2011

Check boxes in List box

1.Drop CheckBoxList control on your page.
2.Surround it with
element.
3.Set Overflow style of
to "auto" and size as you like.
Ex

< div style="BORDER: thin solid; OVERFLOW: auto; WIDTH: 100px; HEIGHT: 100px">
< asp:checkboxlist id="CheckBoxList1" runat="server">