Here iam going to explain a snenario for the code related to datagrid ther by i will explain the code
"We are calling same Datagrid2 inside a Datagrid1 in each and every .There we kept the checkboxes in 2nd grid with check all option , but when we are going to select checkall option in grid2 there it is going to check all rows of datagrid1 to be checked but it should not happened if we say check all in datagrid1-2ndrow means it should check only the all checkboxes of datagrid2 in that particular row. I will attach the snapshot also . For that only iam going to give this please have alook and give your comments"
we need get the rowcount of 2nd and 1st grid, and should give id value to anchor tags od "CheckAll" that id should pass in the selectall() function code behind
hdnGridcount.Value = e.Item.ItemIndex + 2 'row index value rowCount = dsClientUsers.Tables(0).Rows.Count 'row count of 2nd grid
source code
<a id="ancselall" runat="server" visible="true" onclick="return SelectAll(id)" ><u>All | <span class="c2" style="cursor:pointer"> <a id="ancunselall" runat="server" visible="true" onclick="return UnSelectAll(id)" ><u>None
<asp:HiddenField id=hdnGridcount runat =server value=0 /> <asp:HiddenField id=hdnGrid2count runat =server value=0 /> <asp:HiddenField id=hdnGrid3count runat =server value=0 />
here is the javascript code
function SelectAll(id) { var chk; var intLength; var intgrid1index; var intgrid2index; var intIndex; var chkName; var strCnt; var checkid; var intgrid1; var intgrid2; var str; var intid ; var selectallid = id; intgrid1index = selectallid.substring(18,20);//depends on the id which you are giving to datagrid intgrid2index = selectallid.substring(40,42);//depends on the id which you are giving to datagrid intgrid2index++; intIndex = document.all["hdnGridcount"].value; strCnt = document.all["hdnGrid2count"].value; intgrid1 = 'dgrdDefineGrps$ctl' + intgrid1index; intgrid2 = '$dgrdClientUsers$ctl0'+ intgrid2index; intLength = document.frmDefineGroups.length; for(j=0;j for(i=0;i if(document.frmDefineGroups.elements[i].name == intgrid1 + intgrid2 +'$chkClient') { var chk; chk = document.frmDefineGroups.elements[i]; if(document.frmDefineGroups.elements[i].type == "checkbox") { chk.checked=true; } else { chk.checked=false; } } } intgrid2index++; if(intgrid2index>9) { intgrid2 = '$dgrdClientUsers$ctl'+ intgrid2index; } else { intgrid2 = '$dgrdClientUsers$ctl0'+ intgrid2index; } } return true; } function UnSelectAll(id) { var chk; var intLength; var intgrid1index; var intgrid2index; var intIndex; var chkName; var strCnt; var checkid; var intgrid1; var intgrid2; var str; var intid ; var selectallid = id; intgrid1index = selectallid.substring(18,20); intgrid2index = selectallid.substring(40,42); intgrid2index++; intIndex = document.all["hdnGridcount"].value; strCnt = document.all["hdnGrid2count"].value; intgrid1 = 'dgrdDefineGrps$ctl' + intgrid1index; intgrid2 = '$dgrdClientUsers$ctl0'+ intgrid2index; intLength = document.frmDefineGroups.length; for(j=0;j for(i=0;i if(document.frmDefineGroups.elements[i].name == intgrid1 + intgrid2 +'$chkClient') { var chk; chk = document.frmDefineGroups.elements[i]; if(document.frmDefineGroups.elements[i].type == "checkbox") { chk.checked=false; } else { chk.checked=true; } } } intgrid2index++; if(intgrid2index>9) { intgrid2 = '$dgrdClientUsers$ctl'+ intgrid2index; } else { intgrid2 = '$dgrdClientUsers$ctl0'+ intgrid2index; } } return true; }
Attachmentsscreen shot of the datagrid (17696-29611-Doc1.doc)
|
| Author: Mahesh Raj 07 Jun 2008 | Member Level: Gold Points : 1 |
This is very good information,Continue posting such useful articles.
|
| Author: John Fernandez 08 Jun 2008 | Member Level: Gold Points : 1 |
Very well written Article.Thanks for sharing this information.
|
| Author: Satyanarayan SushilKumar Bajoria 09 Jun 2008 | Member Level: Gold Points : 0 |
Hi, Very nice article,and it is very helpful too
|
| Author: Naresh 28 Jun 2008 | Member Level: Silver Points : 1 |
Thanku you Very Much Of Kamala Devi Garu if u know any openings in Dotnet please plaese tell me yar
|