Wednesday, December 22, 2010

All Check Boxes check of Respective inner repeater

Step : 1

function CheckAllRoleCheckBoxesParent(obj)
{
//alert(2);
//debugger;
chk = document.documentElement.getElementsByTagName('input');
var Parent=obj.attributes['Parent'].nodeValue;


for(var i=0; i {
if(chk[i].attributes["type"].nodeValue == "checkbox")
{
if(chk[i].attributes['Parent1'] != null)
{
//alert('checkbox');
if(chk[i].attributes['Parent1'].nodeValue==Parent)
{
//alert(chk[i].attributes['rolecode'].nodeValue + '=' + rc);
//chk[i].checked=obj.checked;
chk[i].click();
}
}

}

}
}


Strep : 2

<input id="chk" runat="server" type="checkbox" value='<%#Eval("Location")%>'
onclick="javascript:CheckAllRoleCheckBoxesParent(this);" Parent='<%#Eval("id")%>'/>
<%#Eval("Location")%>


Step:3

protected string Parent1;


Step :4

On Item Databound ofParent

Parent1 = DataBinder.Eval(e.Item.DataItem, "id").ToString();