Skip to content

Replies

0
Amol
Amol answered on May 16, 2008 10:20 AM

hi,
  what I have done is added a CheckBox in template column header and called javascript function to check/uncheck all the checkboxes in the cell template this works fine, but I cant access checkboxes inside grid added in celltemplate. here is HTML and C# code which I am using.

<Bands><igtbl:UltraGridBand>

<

AddNewRow Visible="NotSet" View="NotSet"></AddNewRow>

<

Columns>

 

 

<igtbl:TemplatedColumn Key="selectall" >

<Header Caption="Select" >

<RowLayoutColumnInfo OriginX="1" />

</Header>

<HeaderTemplate>

<asp:CheckBox ID="cbSelectAll" runat="server" onclick="BLOCKED SCRIPTcheckall()" />

<asp:Label ID="lbl_select" runat="server" Text="Select"></asp:Label>

</HeaderTemplate><CellTemplate>

<asp:CheckBox ID="CheckBox1" runat="server" Value="False" />

</CellTemplate>

<CellStyle HorizontalAlign="Center" ></CellStyle>

<HeaderStyle HorizontalAlign="Center" />

<Footer>

<RowLayoutColumnInfo OriginX="1" />

</Footer>

</igtbl:TemplatedColumn>

 

<igtbl:UltraGridColumn BaseColumnName="Name" Key="Name" IsBound="True" >

<Header Caption="Name" ></Header>

</igtbl:UltraGridColumn>

 

 

</

Columns>

 

<RowTemplateStyle BackColor="Window" BorderColor="Window" BorderStyle="Ridge">

<BorderDetails WidthBottom="3px" WidthLeft="3px" WidthRight="3px" WidthTop="3px" />

</RowTemplateStyle>

<RowEditTemplate>

<br />

 

</RowEditTemplate>

</

igtbl:UltraGridBand></Bands>

and following is the scriptfunction checkall()

{

 

var frm = document.forms[0];for (i=0;i<frm.elements.length;i++)

{

if (frm.elementsIdea.name.lastIndexOf("CheckBox1")!= -1)

{

frm.elementsIdea.checked = document.getElementById(

"UltraWebGrid1_ctl01_cbSelectAll").checked;//document.getElementById(id).checked;

}

}

}

 and following is the code for checking which text boxes are checked or uncheked.for (int i = 0; i < UltraWebGrid1.Rows.Count; i++)

{

Response.Write(UltraWebGrid1.RowsIdea.Cells[0].Value);

}

this code returns me always blank value though i have tick some of the checkboxes.

 Plz help me.

Thanks.