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
955
Getting JScript error when using a BoundCheckBoxField after a postback event.
posted

I receive the following error each time a BoundCheckBoxField is checked or Unchecked aftrer a postback event:("Microsoft JScript runtime error: Sys.ArgumentTypeException: Object of type 'Boolean' cannot be converted to type 'String'. Parameter name: value"). This happens each time after the Save button is clicked or an asp:Checkbox is clicked to refresh the page to show only the items checked. Code below:  PLEASE HELP!!

ASP Source                      :

<ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="568px" Width="1106px"

        StyleSetName="ElectricBlue" AutoGenerateColumns="False"

    DataSourceID="Sql_Manage_DataSource" BorderStyle="Ridge"

        DataMember="DefaultView" DataKeyFields="Row_ID">

        <Columns>

            <ig:BoundDataField DataFieldName="Row_ID" Hidden="False" Key="Row_ID" Width="70px" DataType="System.Int32" >

                <Header Text="Record #"/>

<Header Text="Record #"></Header>

            </ig:BoundDataField>

            <ig:BoundCheckBoxField DataFieldName="Removed" Key="Removed" Width="70px"

                DataType="System.Boolean" >

                <Header Text="Remove" />

<Header Text="Remove"></Header>

             </ig:BoundCheckBoxField>

            <ig:BoundDataField DataFieldName="Member_ID" Key="Membe_ID" Width="85px">

                <Header Text="MemberID" />

<Header Text="MemberID"></Header>

            </ig:BoundDataField>

            <ig:BoundDataField DataFieldName="Group_ID" Key="Group_ID" Width="80px">

                <Header Text="GroupID" />

<Header Text="GroupID"></Header>

            </ig:BoundDataField>

            <ig:BoundDataField DataFieldName="Site_ID" Hidden="True" Key="Site_ID">

                <Header Text="Site_ID" />

<Header Text="Site_ID"></Header>

            </ig:BoundDataField>

            <ig:BoundDataField DataFieldName="SSN" Key="SSN" Width="80px">

                <Header Text="SSN" />

<Header Text="SSN"></Header>

            </ig:BoundDataField>

            <ig:BoundDataField DataFieldName="Last_Name" Key="Last_Name" Width="90px">

                <Header Text="Last Name" />

<Header Text="Last Name"></Header>

            </ig:BoundDataField>

            <ig:BoundDataField DataFieldName="First_Name" Key="First_Name" Width="90px">

                <Header Text="First Name" />

<Header Text="First Name"></Header>

            </ig:BoundDataField>

            <ig:BoundDataField DataFieldName="CHP_Address" Key="CHP_Address" Width="250px">

                <Header Text="CHP Address" />

<Header Text="CHP Address"></Header>

            </ig:BoundDataField>

            <ig:BoundDataField DataFieldName="USPS_Address" Key="USPS_Address"

                Width="250px">

                <Header Text="USPS Address" />

<Header Text="USPS Address"></Header>

            </ig:BoundDataField>

            <ig:BoundDataField DataFieldName="State_Address" Key="State_Address"

                Width="250px">

                <Header Text="State Address" />

<Header Text="State Address"></Header>

            </ig:BoundDataField>

        </Columns>

        <Behaviors>

            <ig:EditingCore BatchUpdating="True">

                <Behaviors>

                    <ig:CellEditing>

                      <ColumnSettings>

                            <ig:EditingColumnSetting ColumnKey="Row_ID" ReadOnly="true" />

                            <ig:EditingColumnSetting ColumnKey="Removed" ReadOnly="False" />

                            <ig:EditingColumnSetting ColumnKey="Member_ID" ReadOnly="true" />

                            <ig:EditingColumnSetting ColumnKey="Group_ID" ReadOnly="true" />

                            <ig:EditingColumnSetting ColumnKey="SSN" ReadOnly="true" />

                            <ig:EditingColumnSetting ColumnKey="Last_Name" ReadOnly="True" />

                            <ig:EditingColumnSetting ColumnKey="First_Name" ReadOnly="True" />

                            <ig:EditingColumnSetting ColumnKey="CHP_Address" ReadOnly="True" />

                            <ig:EditingColumnSetting ColumnKey="USPS_Address" ReadOnly="True" />

                             <ig:EditingColumnSetting ColumnKey="State_Address" ReadOnly="True" />

                        </ColumnSettings>

                    </ig:CellEditing>

                    <ig:RowEditingTemplate CancelButton="buttonCancel" OKButton="buttonOK">

                        <ClientBindings>

                             <ig:RowEditingClientBinding ColumnKey="Row_ID" ControlID="control_Row_ID"

                               GetValueJavaScript="$get({ClientID}).value"

                                SetValueJavaScript="$get({ClientID}).value={value}" />

                            <ig:RowEditingClientBinding ColumnKey="Removed" ControlID="control_Removed"

                              GetValueJavaScript="$get({ClientID}).value"

                              SetValueJavaScript="$get({ClientID}).value={value}" />

                            <ig:RowEditingClientBinding ColumnKey="Membe_ID" ControlID="control_Membe_ID"

                                GetValueJavaScript="$get({ClientID}).value"

                                SetValueJavaScript="$get({ClientID}).value={value}" />

                            <ig:RowEditingClientBinding ColumnKey="Group_ID" ControlID="control_Group_ID"

                                GetValueJavaScript="$get({ClientID}).value"

                                SetValueJavaScript="$get({ClientID}).value={value}" />

                            <ig:RowEditingClientBinding ColumnKey="SSN" ControlID="control_SSN"

                                GetValueJavaScript="$get({ClientID}).value"

                                SetValueJavaScript="$get({ClientID}).value={value}" />

                            <ig:RowEditingClientBinding ColumnKey="Last_Name" ControlID="control_Last_Name"

                                GetValueJavaScript="$get({ClientID}).value"

                                SetValueJavaScript="$get({ClientID}).value={value}" />

                            <ig:RowEditingClientBinding ColumnKey="First_Name"

                                ControlID="control_First_Name" GetValueJavaScript="$get({ClientID}).value"

                                SetValueJavaScript="$get({ClientID}).value={value}" />

                            <ig:RowEditingClientBinding ColumnKey="CHP_Address"

                                ControlID="control_CHP_Address" GetValueJavaScript="$get({ClientID}).value"

                                SetValueJavaScript="$get({ClientID}).value={value}" />

                            <ig:RowEditingClientBinding ColumnKey="USPS_Address"

                                ControlID="control_USPS_Address" GetValueJavaScript="$get({ClientID}).value"

                                SetValueJavaScript="$get({ClientID}).value={value}" />

                            <ig:RowEditingClientBinding ColumnKey="State_Address"

                                ControlID="control_State_Address" GetValueJavaScript="$get({ClientID}).value"

                                SetValueJavaScript="$get({ClientID}).value={value}" />

                        </ClientBindings>

                        <Template>

                            <div style="background-color:white;border:1px solid black;">

                                Membe_ID:

                                <asp:TextBox ID="control_Membe_ID" runat="server"></asp:TextBox>

                                <br/>

                                Group_ID:

                                <asp:TextBox ID="control_Group_ID" runat="server"></asp:TextBox>

                                <br/>

                                SSN:

                                <asp:TextBox ID="control_SSN" runat="server"></asp:TextBox>

                                <br/>

                                Last_Name:

                                <asp:TextBox ID="control_Last_Name" runat="server"></asp:TextBox>

                                <br/>

                                First_Name:

                                <asp:TextBox ID="control_First_Name" runat="server"></asp:TextBox>

                                <br/>

                                CHP_Address:

                                <asp:TextBox ID="control_CHP_Address" runat="server"></asp:TextBox>

                                <br/>

                                USPS_Address:

                                <asp:TextBox ID="control_USPS_Address" runat="server"></asp:TextBox>

                                <br/>

                                State_Address:

                                <asp:TextBox ID="control_State_Address" runat="server"></asp:TextBox>

                                <br/>

                                <asp:Button ID="buttonOK" runat="server" OnClientClick="return" Text="OK"

                                    UseSubmitBehavior="False" />

                                <asp:Button ID="buttonCancel" runat="server" CausesValidation="False"

                                    OnClientClick="return" Text="Cancel" UseSubmitBehavior="False" />

                            </div>

                        </Template>

                    </ig:RowEditingTemplate>

                </Behaviors>

            </ig:EditingCore>

            <ig:ColumnResizing>

            </ig:ColumnResizing>

            <ig:VirtualScrolling>

            </ig:VirtualScrolling>

            <ig:Paging PageSize="50">

            </ig:Paging>

            <ig:Selection ColumnSelectType="Single">

            </ig:Selection>

        </Behaviors>

        <Templates>

            <ig:ItemTemplate ID="WebDataGrid1Template1" runat="server"

                TemplateID="TempRemoved">

            </ig:ItemTemplate>

        </Templates>

    </ig:WebDataGrid>

   

        <table>

        <tr>

        <td class="style13" align="right" valign="bottom">

            <asp:Button id="cmdSave" runat="server" Text="Save All"

                style="margin-left: 0px" Width="153px"></asp:Button>

        </td>

    <td valign="middle" class="style14">

    <asp:CheckBox id="chkView" runat="server" Font-Bold="True" Text="View Removed" AutoPostBack="True"

            ForeColor="#000099" CssClass="ig_ElectricBlueEditSelected" Width="120px"

            Height="17px"></asp:CheckBox>

        </td>

        <td valign="middle" class="style15">

            <asp:Label id="lblRowCount" runat="server" Font-Bold="True" ForeColor="#000099"></asp:Label>

        </td>

           </tr>

</table>

<asp:SqlDataSource ID="Sql_Manage_DataSource" runat="server"

    ConnectionString="<%$ ConnectionStrings:CHPAddressVerificationConnectionString %>"

    SelectCommand="usp_GetGrid" SelectCommandType="StoredProcedure"

        UpdateCommand="usp_upd_tblUSPS_File" UpdateCommandType="StoredProcedure">

    <SelectParameters>

        <asp:ControlParameter ControlID="chkView" Name="Removed" PropertyName="Checked" Type="Boolean" />

    </SelectParameters>

    <UpdateParameters>

        <asp:Parameter Name="Row_ID" Type="Int32"  />

        <asp:Parameter Name="Removed" Type="Boolean" />

    </UpdateParameters>

</asp:SqlDataSource>

VB Code Behind                    :

Imports System

Imports System.Data

Imports Infragistics.Web.UI.GridControls

Partial Class ManageData

    Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

  DirectCast(WebDataGrid1.Columns("Removed"), BoundCheckBoxField).ValueConverter = New DecimalBooleanConverter

End Sub

End Class

Public Class DecimalBooleanConverter

    Implements IBooleanConverter

    Public ReadOnly Property DefaultFalseValue1 As Object Implements Infragistics.Web.UI.GridControls.IBooleanConverter.DefaultFalseValue

        Get

            Return 0D

        End Get

    End Property

    Public ReadOnly Property DefaultTrueValue1 As Object Implements Infragistics.Web.UI.GridControls.IBooleanConverter.DefaultTrueValue

        Get

            Return 20.1D

        End Get

    End Property

    Public Function IsFalse1(ByVal value As Object) As Boolean Implements Infragistics.Web.UI.GridControls.IBooleanConverter.IsFalse

        If value = Nothing Then

            Return True

        End If

        Return DirectCast(value, Decimal) <= 20D

    End Function

    Public Function IsTrue1(ByVal value As Object) As Boolean Implements Infragistics.Web.UI.GridControls.IBooleanConverter.IsTrue

        If value = Nothing Then

            Return False

        End If

        Return DirectCast(value, Decimal) > 20D

    End Function

End Class

Error at JScript Function:

Number.parseLocale = function Number$parseLocale(value) {

    /// <summary locid="M:J#Number.parseLocale" />

    /// <param name="value" type="String"></param>

    /// <returns type="Number"></returns>

    var e = Function._validateParams(arguments, [

        {name: "value", type: String}

    ], false);

    if (e) throw e;

    return Number._parse(value, Sys.CultureInfo.CurrentCulture);

 

Parents
No Data
Reply
  • 955
    Offline posted

    This problem is partial resolved!

    After searching a little more into the generated JScript, I discoverd the the error initiated from evaluating the input parameter of the update stored procedure used in the SQLDataSource. After setting the parameter property "ConvertEmptyStringtoNull" to "False" and setting the default value to "False" the went away. However, I now have to click the save button twice to see the saved changes in the grid. Somehow the first page postback  after clicking the save button is not excuting the Select procedure set in the SQLDataSource.  

    Do I need to add a select statement in my update procedure to display the changes in te grid?

     

    Thank you for any help!   

     

     

Children
No Data