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
35
Post Back Issue
posted

I have the following grid:

<ig:WebDataGrid ID="webdgRequest" runat="server" AutoGenerateColumns="False" Width="100%"
       Height="500px"  StyleSetName="Office2007Silver"
       DataKeyFields="ID" EnableDataViewState="True" oninitializerow="webdgRequest_InitializeRow"
       >
       <Columns>
           <ig:TemplateDataField Key="RowNumber" Width="50px">
                   <Header Text="RowNumber" />
                   <ItemTemplate>
                       <asp:Label ID="lblID" runat="server" Text='<%#Eval("RowNumber") %>'></asp:Label>
                   </ItemTemplate>
               </ig:TemplateDataField>
            
           <ig:TemplateDataField Key="checkField" Width="50px">
               <HeaderTemplate>
                   <div style="text-align: center;">
                        
               </HeaderTemplate>
               <ItemTemplate>
                   <div style="text-align: center;">
                      <asp:CheckBox ID="chkDeleted" runat="server" />
               </ItemTemplate>
           </ig:TemplateDataField>
           <ig:BoundDataField DataFieldName="Comments" Key="Comments" Width="100px">
               <Header Text="Comments" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="Request Type" Key="Request Type" Width="80px">
               <Header Text="Request Type" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="UserName" Key="UserName" Width="80px">
               <Header Text="Requested By" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="MakerDate" Key="MakerDate" Width="80px">
               <Header Text="Requested On" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="DepartmentName" Key="DepartmentName" Width="100px">
               <Header Text="Department" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="Region" Key="Region" Width="80px">
               <Header Text="Region" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="Location" Key="Location" Width="100px">
               <Header Text="Location" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="Branch" Key="Branch" Width="50px">
               <Header Text="Branch" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="AccountName" Key="AccountName" Width="100px">
               <Header Text="AccountName" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="AccountNumber" Key="AccountNumber" Width="80px">
               <Header Text="AccountNumber" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="ClientName" Key="ClientName" Width="100px">
               <Header Text="Requested Reporting Group" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="ClientGroups" Key="ClientGroups" Width="100px">
               <Header Text="Linked Reporting Groups" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="AccountID" Key="AccountID" Hidden="True">
               <Header Text="AccountID" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="ID" Hidden="True" Key="ID" Width="0px">
               <Header Text="ID" />
           </ig:BoundDataField>
           <ig:BoundDataField DataFieldName="UserID" Hidden="True" Key="UserID" Width="0px">
               <Header Text="UserID" />
           </ig:BoundDataField>
           <ig:BoundDataField Hidden="true" Width="0px" CssClass="hideMyColumn" DataFieldName="CheckerPermission"
               Key="CheckerPermission">
               <Header Text="CheckerPermission" />
           </ig:BoundDataField>
       </Columns>
       <Behaviors>
           <ig:EditingCore>
               <Behaviors>
                   <ig:CellEditing Enabled="True">
                       <ColumnSettings>
                           <ig:EditingColumnSetting ColumnKey="Request Type" ReadOnly="True" />
                           <ig:EditingColumnSetting ColumnKey="UserName" ReadOnly="True" />
                           <ig:EditingColumnSetting ColumnKey="MakerDate" ReadOnly="True" />
                           <ig:EditingColumnSetting ColumnKey="Branch" ReadOnly="True" />
                           <ig:EditingColumnSetting ColumnKey="AccountName" ReadOnly="True" />
                           <ig:EditingColumnSetting ColumnKey="AccountNumber" ReadOnly="True" />
                           <ig:EditingColumnSetting ColumnKey="AccountID" ReadOnly="True" />
                           <ig:EditingColumnSetting ColumnKey="ClientName" ReadOnly="True" />
                           <ig:EditingColumnSetting ColumnKey="UserID" ReadOnly="True" />
                       </ColumnSettings>
                   </ig:CellEditing>
               </Behaviors>
           </ig:EditingCore>
           <ig:Sorting>
           </ig:Sorting>
           <ig:Selection ColumnSelectType="Single" RowSelectType="Single" Enabled="true">
           </ig:Selection>
           <ig:ColumnResizing />
           <ig:Filtering />
           <ig:RowSelectors Enabled="true">
           </ig:RowSelectors>
           <ig:Activation Enabled="true">
           </ig:Activation>
           <ig:VirtualScrolling>
           </ig:VirtualScrolling>
       </Behaviors>
   </ig:WebDataGrid>


I add the following functionaility to the checkbox within the InitialIzeRow handler

protected void webdgRequest_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)
    {
        string Id = ((Label)e.Row.Items[0].FindControl("lblID")).Text;
        var chkBox = (CheckBox)e.Row.Items[1].FindControl("chkDeleted");
        if (chkBox != null && Id != null)
           chkBox.Attributes.Add("onClick", "return getClickedRow(" + Id + ",'" + chkBox.ClientID + "');");
 
    }

Which in turn calls the following Javascript each time the check box state is changed:

<script type="text/javascript">
 
    function getObj(name) {
        if (document.getElementById) // test if browser supports document.getElementById
        {
            this.obj = document.getElementById(name);
            this.style = document.getElementById(name).style;
        }
        else if (document.all) // test if browser supports document.all
        {
            this.obj = document.all[name];
            this.style = document.all[name].style;
        }
        else if (document.layers) // test if browser supports document.layers
        {
            this.obj = document.layers[name];
            this.style = document.layers[name].style;
        }
    }
 
 
    function getClickedRow(rowClicked, checkBoxID) {
        var params;
        var clientSideCheckBoxID = new getObj(checkBoxID);
        if (clientSideCheckBoxID.obj.checked == true) {
            params = rowClicked + '-' + 'checked'; // We can split this string on the server side to determine how we need to update the data source
            __doPostBack('<%= webdgRequest.ClientID %>', params);
        } else {
             params = rowClicked + '-' + 'unchecked'; // We can split this string on the server side to determine how we need to update the data source
             __doPostBack('<%= webdgRequest.ClientID %>', params);
        }
    }
</script>


However when I try to do the post back, I keep getting PageRequestManagerServerErrorException.

What could be causing this?

Kind Regards