Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
105
How to get all rows and controls of webdatagrid server side
posted

Hello 

I am using Infragistics version v15.2

I am facing issues to get all the cell values on a button click event.

//Aspx code

<ig:WebDataGrid ID="FunAreaGrid" runat="server"
style="z-index: 100; left: 152px; position: absolute; top: 120px"
tabIndex="2" runat="server" Width="422" Height="100"
DataKeyFields="Functionalarea" AutoGenerateColumns="False">
<Columns>
<ig:TemplateDataField Key="FunctionalArea">
<ItemTemplate>
<asp:HiddenField ID ="hFunctionalArea" runat ="server" Value='<%# DataBinder.Eval((Container).DataItem, "Functionalarea") %>' />
</ItemTemplate>
<Header Text="FunctionalArea" />
</ig:TemplateDataField>
<ig:TemplateDataField Key="Title">
<ItemTemplate>
<asp:Label ID="CompanyNameLabel" runat="server"><%# DataBinder.Eval((Container).DataItem, "Title") %></asp:Label>
</ItemTemplate>
<Header Text="Title" />
</ig:TemplateDataField>
<ig:TemplateDataField Key="Checked" CssClass ="alignedCenter" >
<ItemTemplate>
<asp:CheckBox ID="chkActive" runat ="server" Checked ='<%# DataBinder.Eval((Container).DataItem, "Active") %>' />
</ItemTemplate>
<Header Text="Active" CssClass ="alignedCenter" />
</ig:TemplateDataField>
<ig:TemplateDataField Key="statChecked" CssClass ="alignedCenter" >
<ItemTemplate>
<asp:CheckBox ID="chkStatChecked" runat ="server" Checked ='<%# DataBinder.Eval((Container).DataItem, "STATTaskSort") %>' />
</ItemTemplate>
<Header Text="STATTaskSort" CssClass ="alignedCenter" />
</ig:TemplateDataField>
</Columns>
</ig:WebDataGrid>

//Cs code to bind the grid

FunAreaGrid.DataSource = Dt
FunAreaGrid.DataBind()

//Button Click event to save the configuration

foreach (GridRecord row in WebDataGrid1.Rows)
{
CheckBox chkActive= (CheckBox)row.Items[0].FindControl("chkActive");
bool ischecked = chkActive.Checked;

// Save the configuration

}

 I am not getting the control and also debugger is not coming inside the foreach loop.

Thanks,

Srikant

Parents
  • 16310
    Offline posted

    Hi,

    I do not have enough details to assume what the issue may be. To help you with this I have prepared a sample that iterates through the grid rows on button click event in the same way as you try to do with the for loop. It works fine in the sample. I suggest to compare mine with your sample. If it does not help you can try to modify mine to reproduce the issue and send it back for investigation.

Reply Children
No Data