This is a migrated thread and some comments may be shown as answers.

Cannot bind checkbox in grid form template

5 Answers 198 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Felice
Top achievements
Rank 1
Felice asked on 24 Mar 2014, 06:00 AM
I am not able to bind this checkbox to a nullable bit in sql:
<EditFormSettings EditFormType="Template">
  <FormTemplate>
  <telerik:RadButton ID="btnToggle"  runat="server" ToggleType="CheckBox" ButtonType="LinkButton" Checked='<%# Bind("inBudgetPCS") %>' >
  <ToggleStates>
   <telerik:RadButtonToggleState Text="In Budget" PrimaryIconCssClass="rbToggleCheckboxChecked" />
   <telerik:RadButtonToggleState Text="Not in Budget" PrimaryIconCssClass="rbToggleCheckbox" />
 </ToggleStates>
</telerik:RadButton>
  </FormTemplate>
</EditFormSettings>
It keeps generating "Invalid cast exception"

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Mar 2014, 06:43 AM
Hi Felice,

Please try the following code snippet to bind the CheckBox.

ASPX:
<telerik:RadButton ID="btnToggle"  runat="server"
Checked='<%# (DataBinder.Eval(Container.DataItem,"inBudgetPCS") is DBNull ?false:Eval("inBudgetPCS")) %>' . . .>
 <ToggleStates>
 . . .
 </ToggleStates>
</telerik:RadButton>

Thanks,
Princy
0
Felice
Top achievements
Rank 1
answered on 24 Mar 2014, 06:58 AM
Hi Princy,
thanks a lot. I do not get errors with your snippet but after "inserting" the data the status of the checkbox is not kept. It does not write to the DB (SQL). I checked the value in the db field and it is still null.
0
Princy
Top achievements
Rank 2
answered on 24 Mar 2014, 07:07 AM
Hi Felice,

A solution would be to preset the default value of the control(s) when binding to a grid item on the RadGrid.InitInsertCommandName command.

C#:
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
  if ((e.CommandName == RadGrid.InitInsertCommandName)) 
  
    e.Canceled = true
    //Prepare an IDictionary with the predefined values 
    System.Collections.Specialized.ListDictionary newValues = new System.Collections.Specialized.ListDictionary(); 
 
    //set initial checked state for the checkbox on init insert 
    newValues["inBudgetPCS"] = false
 
    //Insert the item and rebind 
    e.Item.OwnerTableView.InsertItem(newValues); 
   
}

Thanks,
Princy
0
Felice
Top achievements
Rank 1
answered on 24 Mar 2014, 07:27 AM
No results!
Nothing happen. I post the entire code just in case there is something I cannot see. However, I tried with the above snippet and the value in the db stays null. 
Please note that there are 3 checkboxes on the code, for now I tried modifying only one, the "inBudgetPCS".
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="page_2.aspx.cs" Inherits="page_2" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="css/StyleSheet.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
        <div>
 
            <table class="tabBody">
                <tr>
                    <td class="cLeft"></td>
                    <td class="cCenter">
                        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                        </telerik:RadScriptManager>
                        Merged offer list</td>
                    <td class="cRight"></td>
                </tr>
                <tr>
                    <td class="cLeft"></td>
                    <td class="cCenter">
                        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellSpacing="-1" Culture="it-IT" DataSourceID="SqlDataSource1" GridLines="Both" Height="550px" PageSize="30" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" OnItemCommand="RadGrid1_ItemCommand">
                            <ExportSettings IgnorePaging="True">
                                <Pdf PageHeight="297mm" PageWidth="" PaperSize="A4">
                                </Pdf>
                            </ExportSettings>
                            <ClientSettings>
                                <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                            </ClientSettings>
                            <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="Id" DataSourceID="SqlDataSource1">
                                <CommandItemSettings ShowCancelChangesButton="True" ShowExportToExcelButton="True" ShowExportToPdfButton="True" ShowExportToWordButton="True" ShowSaveChangesButton="True" />
                                <RowIndicatorColumn Visible="False">
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn Created="True">
                                </ExpandCollapseColumn>
                                <Columns>
                                    <telerik:GridEditCommandColumn ButtonType="ImageButton">
                                    </telerik:GridEditCommandColumn>
                                    <telerik:GridBoundColumn DataField="Id" DataType="System.Int32" Display="False" FilterControlAltText="Filter Id column" HeaderText="Id" ReadOnly="True" SortExpression="Id" UniqueName="Id">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="projectName" FilterControlAltText="Filter projectName column" HeaderText="projectName" SortExpression="projectName" UniqueName="projectName">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="country" FilterControlAltText="Filter country column" HeaderText="country" SortExpression="country" UniqueName="country">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="customerName" FilterControlAltText="Filter customerName column" HeaderText="customerName" SortExpression="customerName" UniqueName="customerName">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="requestDate" DataType="System.DateTime" Display="False" FilterControlAltText="Filter requestDate column" HeaderText="requestDate" SortExpression="requestDate" UniqueName="requestDate" DataFormatString="{0:dd/MM/yyyy}">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="custDecDate" FilterControlAltText="Filter custDecDate column" HeaderText="custDecDate" SortExpression="custDecDate" UniqueName="custDecDate" DataType="System.DateTime" DataFormatString="{0:dd/MM/yyyy}">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="productType" FilterControlAltText="Filter productType column" HeaderText="productType" SortExpression="productType" UniqueName="productType">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="quantity" DataType="System.Int32" FilterControlAltText="Filter quantity column" HeaderText="quantity" SortExpression="quantity" UniqueName="quantity" Display="False">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridCheckBoxColumn DataField="forBid" DataType="System.Boolean" FilterControlAltText="Filter forBid column" HeaderText="forBid" UniqueName="forBid" SortExpression="forBid">
                                    </telerik:GridCheckBoxColumn>
                                    <telerik:GridCheckBoxColumn DataField="inBudgetPCS" DataType="System.Boolean" FilterControlAltText="Filter inBudgetPCS column" HeaderText="inBudgetPCS" SortExpression="inBudgetPCS" UniqueName="inBudgetPCS" Display="False">
                                    </telerik:GridCheckBoxColumn>
                                    <telerik:GridCheckBoxColumn DataField="inBudgetTT" DataType="System.Boolean" FilterControlAltText="Filter inBudgetTT column" HeaderText="inBudgetTT" SortExpression="inBudgetTT" UniqueName="inBudgetTT" Display="False">
                                    </telerik:GridCheckBoxColumn>
                                    <telerik:GridBoundColumn DataField="chancesPCS" HeaderText="chancesPCS" SortExpression="chancesPCS" Display="False" UniqueName="chancesPCS" FilterControlAltText="Filter chancesPCS column" DataType="System.Int32" DataFormatString="{0:}%">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="chancesTT" DataType="System.Int32" FilterControlAltText="Filter chancesTT column" HeaderText="chancesTT" SortExpression="chancesTT" UniqueName="chancesTT" Display="False" DataFormatString="{0:}%">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="valuePCS" DataType="System.Int32" FilterControlAltText="Filter valuePCS column" HeaderText="valuePCS" SortExpression="valuePCS" UniqueName="valuePCS" DataFormatString="{0:C0}">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="valueTT" DataType="System.Int32" FilterControlAltText="Filter valueTT column" HeaderText="valueTT" SortExpression="valueTT" UniqueName="valueTT" DataFormatString="{0:C0}">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="marginPCS" DataType="System.Int32" Display="False" FilterControlAltText="Filter marginPCS column" HeaderText="marginPCS" SortExpression="marginPCS" UniqueName="marginPCS" DataFormatString="{0:}%">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="marginTT" DataType="System.Int32" Display="False" FilterControlAltText="Filter marginTT column" HeaderText="marginTT" SortExpression="marginTT" UniqueName="marginTT" DataFormatString="{0:}%">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="notes" Display="False" FilterControlAltText="Filter notes column" HeaderText="notes" SortExpression="notes" UniqueName="notes">
                                        <ColumnValidationSettings>
                                            <ModelErrorMessage Text="" />
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridClientDeleteColumn ButtonType="ImageButton" FilterControlAltText="Filter column column" UniqueName="column">
                                    </telerik:GridClientDeleteColumn>
                                </Columns>
                                <EditFormSettings EditFormType="Template">
 
                                    <FormTemplate>
                                        <table class="auto-style1">
                                            <tr>
                                                <td class="auto-style2" colspan="5">
                                                    <asp:Label ID="Label1" runat="server" Text="Quotations - Power Electronics" Font-Bold="True" Font-Size="Large"></asp:Label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="auto-style2"> </td>
                                                <td class="auto-style7">
                                                    <asp:Label ID="Label7" runat="server" Text="Project Identification"></asp:Label>
                                                </td>
                                                <td> </td>
                                                <td>
                                                    <img alt="pcs_logo" class="auto-style13"
                                                        src="images/logo_pcs.gif" /></td>
                                                <td>
                                                    <img alt="logo_transtechnik" class="auto-style13
                "
                                                        src="images/logo_transtechnik.png" /></td>
                                            </tr>
                                            <tr>
                                                <td class="auto-style2">
                                                    <asp:Label ID="Label2" runat="server" Text="Project Name: "></asp:Label>
                                                </td>
                                                <td class="auto-style7">
                                                    <asp:TextBox ID="projectName" runat="server" Width="200px" Text='<%# Bind("projectName") %>'></asp:TextBox>
                                                </td>
                                                <td style="padding-left: 80px">
                                                    <asp:Label ID="Label12" runat="server" Text="In budget:"></asp:Label>
                                                </td>
                                                <td>
 
                                                    
 
 
 
 
 
 
 
                                                    <telerik:RadButton ID="inBudgetPCS"  runat="server" ToggleType="CheckBox" ButtonType="LinkButton" Checked='<%# (DataBinder.Eval(Container.DataItem,"inBudgetPCS") is DBNull ?false:Eval("inBudgetPCS")) %>' >
                                                        <ToggleStates>
                                                            <telerik:RadButtonToggleState Text="In Budget" PrimaryIconCssClass="rbToggleCheckboxChecked" />
                                                            <telerik:RadButtonToggleState Text="Not in Budget" PrimaryIconCssClass="rbToggleCheckbox" />
                                                        </ToggleStates>
                                                    </telerik:RadButton>
 
                                                </td>
                                                <td>
                                                    <telerik:RadButton ID="inBudgetTT"  runat="server" ToggleType="CheckBox" ButtonType="LinkButton" Checked='<%# Eval("inBudgetTT").ToString() == "TRUE" %>' >
                                                        <ToggleStates>
                                                            <telerik:RadButtonToggleState Text="In Budget" PrimaryIconCssClass="rbToggleCheckboxChecked" />
                                                            <telerik:RadButtonToggleState Text="Not in Budget" PrimaryIconCssClass="rbToggleCheckbox" />
                                                        </ToggleStates>
                                                    </telerik:RadButton>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="auto-style2">
                                                    <asp:Label ID="Label3" runat="server" Text="Country:"></asp:Label>
                                                </td>
                                                <td class="auto-style7">
                                                    <asp:TextBox ID="country" runat="server" Width="200px" Text='<%# Bind("country") %>'></asp:TextBox>
                                                </td>
                                                <td style="padding-left: 80px">
                                                    <asp:Label ID="Label15" runat="server" Text="Chances:"></asp:Label>
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="chancesPCS" runat="server" Width="128px" Text='<%# Bind("chancesPCS", "{0:}%") %>'></asp:TextBox>
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="chancesTT" runat="server" Width="128px" Text='<%# Bind("chancesTT", "{0:}%") %>'></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="auto-style2">
                                                    <asp:Label ID="Label18" runat="server" Text="Customer name:"></asp:Label>
                                                </td>
                                                <td class="auto-style7">
                                                    <asp:TextBox ID="customerName" runat="server" Width="200px" Text='<%# Bind("customerName") %>'></asp:TextBox>
                                                </td>
                                                <td style="padding-left: 80px">
                                                    <asp:Label ID="Label13" runat="server" Text="Total Value:"></asp:Label>
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="valuePcs" runat="server" Width="128px" Text='<%# Bind("valuePCS") %>'></asp:TextBox>
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="valueTT" runat="server" Width="128px" Text='<%# Bind("valueTT", "{0:C0}") %>'></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="auto-style10">
                                                    <asp:Label ID="Label4" runat="server" Text="Request Date:"></asp:Label>
                                                </td>
                                                <td class="auto-style11">
                                                    <telerik:RadDatePicker ID="RadDatePicker2" DbSelectedDate='<%# Bind("requestDate") %>' runat="server" DateInput-DateFormat="dd/MM/yyyy"></telerik:RadDatePicker>
 
                                                </td>
                                                <td style="padding-left: 80px">
                                                    <asp:Label ID="Label14" runat="server" Text="Margins:"></asp:Label>
                                                </td>
                                                <td class="auto-style12">
                                                    <asp:TextBox ID="marginPCS" runat="server" Width="128px" Text='<%# Bind("marginPCS", "{0:}%") %>'></asp:TextBox>
                                                </td>
                                                <td class="auto-style12">
                                                    <asp:TextBox ID="marginTT" runat="server" Width="128px" Text='<%# Bind("marginTT", "{0:}%") %>'></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="auto-style2">
                                                    <asp:Label ID="Label6" runat="server" Text="Customer decision Date:"></asp:Label>
                                                </td>
                                                <td class="auto-style7">
                                                    <telerik:RadDatePicker ID="RadDatePicker1" DbSelectedDate='<%# Bind("custDecDate") %>' runat="server" DateInput-DateFormat="dd/MM/yyyy"></telerik:RadDatePicker>
                                                </td>
                                                <td style="padding-left: 80px"> </td>
                                                <td> </td>
                                                <td> </td>
                                            </tr>
                                            <tr>
                                                <td class="auto-style5">
                                                    <asp:Label ID="Label5" runat="server" Text="Product Type:"></asp:Label>
                                                </td>
                                                <td class="auto-style8">
                                                    <asp:TextBox ID="productType" runat="server" Text='<%# Bind("productType") %>'></asp:TextBox>
                                                </td>
                                                <td class="auto-style6"></td>
                                                <td class="auto-style6"></td>
                                                <td class="auto-style6"></td>
                                            </tr>
                                            <tr>
                                                <td class="auto-style2">
                                                    <asp:Label ID="Label10" runat="server" Text="Quantity"></asp:Label>
                                                </td>
                                                <td class="auto-style7">
                                                    <asp:TextBox ID="quantity" runat="server" Text='<%# Bind("quantity") %>'></asp:TextBox>
                                                </td>
                                                <td> </td>
                                                <td> </td>
                                                <td> </td>
                                            </tr>
                                            <tr>
                                                <td class="auto-style2">
                                                    <asp:Label ID="Label11" runat="server" Text="Quote for bid/contract:"></asp:Label>
                                                </td>
                                                <td class="auto-style7">
                                                    <telerik:RadButton ID="forBid"  runat="server" ToggleType="CheckBox" ButtonType="LinkButton" Checked='<%# Eval("forBid").ToString() == "TRUE" %>' >
                                                        <ToggleStates>
                                                            <telerik:RadButtonToggleState Text="Customer has Contract" PrimaryIconCssClass="rbToggleCheckboxChecked" />
                                                            <telerik:RadButtonToggleState Text="Customer Bidding" PrimaryIconCssClass="rbToggleCheckbox" />
                                                        </ToggleStates>
                                                    </telerik:RadButton>
                                                </td>
                                                <td> </td>
                                                <td> </td>
                                                <td> </td>
                                            </tr>
                                            <tr>
                                                <td class="auto-style3">
                                                    <asp:Label ID="Label17" runat="server" Text="Notes:"></asp:Label>
                                                </td>
                                                <td class="auto-style9" colspan="4">
                                                    <asp:TextBox ID="notes" runat="server" Height="100px" TextMode="MultiLine" Width="600px"></asp:TextBox>
                                                </td>
                                            </tr>
 
                                        </table>
 
 
                                        <div class="row">
                                            <div>
                                                <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button>
                                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                                    CommandName="Cancel"></asp:Button>
                                            </div>
 
                                            <div class="cf"></div>
                                        </div>
 
                                    </FormTemplate>
 
 
 
 
 
 
                                    <EditColumn FilterControlAltText="Filter EditCommandColumn1 column" UniqueName="EditCommandColumn1">
                                    </EditColumn>
 
                                </EditFormSettings>
                                <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                            </MasterTableView>
                            <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                        </telerik:RadGrid>
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PMIcommConnectionString %>" DeleteCommand="DELETE FROM [bids] WHERE [Id] = @Id" InsertCommand="INSERT INTO [bids] ([projectName], [country], [requestDate], [custDecDate], [productType], [quantity], [forBid], [inBudgetPCS], [inBudgetTT], [chancesPCS], [chancesTT], [valuePCS], [valueTT], [marginPCS], [marginTT], [notes], [customerName]) VALUES (@projectName, @country, @requestDate, @custDecDate, @productType, @quantity, @forBid, @inBudgetPCS, @inBudgetTT, @chancesPCS, @chancesTT, @valuePCS, @valueTT, @marginPCS, @marginTT, @notes, @customerName)" SelectCommand="SELECT * FROM [bids] ORDER BY [country]" UpdateCommand="UPDATE [bids] SET [projectName] = @projectName, [country] = @country, [requestDate] = @requestDate, [custDecDate] = @custDecDate, [productType] = @productType, [quantity] = @quantity, [forBid] = @forBid, [inBudgetPCS] = @inBudgetPCS, [inBudgetTT] = @inBudgetTT, [chancesPCS] = @chancesPCS, [chancesTT] = @chancesTT, [valuePCS] = @valuePCS, [valueTT] = @valueTT, [marginPCS] = @marginPCS, [marginTT] = @marginTT, [notes] = @notes, [customerName] = @customerName WHERE [Id] = @Id">
                            <DeleteParameters>
                                <asp:Parameter Name="Id" Type="Int32" />
                            </DeleteParameters>
                            <InsertParameters>
                                <asp:Parameter Name="projectName" Type="String" />
                                <asp:Parameter Name="country" Type="String" />
                                <asp:Parameter Name="requestDate" DbType="Date" />
                                <asp:Parameter Name="custDecDate" DbType="Date" />
                                <asp:Parameter Name="productType" Type="String" />
                                <asp:Parameter Name="quantity" Type="Int32" />
                                <asp:Parameter Name="forBid" Type="Boolean" />
                                <asp:Parameter Name="inBudgetPCS" Type="Boolean" />
                                <asp:Parameter Name="inBudgetTT" Type="Boolean" />
                                <asp:Parameter Name="chancesPCS" Type="Int32" />
                                <asp:Parameter Name="chancesTT" Type="Int32" />
                                <asp:Parameter Name="valuePCS" Type="Int32" />
                                <asp:Parameter Name="valueTT" Type="Int32" />
                                <asp:Parameter Name="marginPCS" Type="Int32" />
                                <asp:Parameter Name="marginTT" Type="Int32" />
                                <asp:Parameter Name="notes" Type="String" />
                                <asp:Parameter Name="customerName" Type="String" />
 
                            </InsertParameters>
                            <UpdateParameters>
                                <asp:Parameter Name="projectName" Type="String" />
                                <asp:Parameter Name="country" Type="String" />
                                <asp:Parameter Name="requestDate" DbType="Date" />
                                <asp:Parameter Name="custDecDate" DbType="Date" />
                                <asp:Parameter Name="productType" Type="String" />
                                <asp:Parameter Name="quantity" Type="Int32" />
                                <asp:Parameter Name="forBid" Type="Boolean" />
                                <asp:Parameter Name="inBudgetPCS" Type="Boolean" />
                                <asp:Parameter Name="inBudgetTT" Type="Boolean" />
                                <asp:Parameter Name="chancesPCS" Type="Int32" />
                                <asp:Parameter Name="chancesTT" Type="Int32" />
                                <asp:Parameter Name="valuePCS" Type="Int32" />
                                <asp:Parameter Name="valueTT" Type="Int32" />
                                <asp:Parameter Name="marginPCS" Type="Int32" />
                                <asp:Parameter Name="marginTT" Type="Int32" />
                                <asp:Parameter Name="notes" Type="String" />
                                <asp:Parameter Name="Id" Type="Int32" />
                                <asp:Parameter Name="customerName" Type="String" />
                            </UpdateParameters>
                        </asp:SqlDataSource>
                    </td>
                    <td class="cRight"></td>
                </tr>
                <tr>
                    <td class="cLeft"></td>
                    <td class="cCenter"></td>
                    <td class="cRight"></td>
                </tr>
                <tr>
                    <td class="cLeft"></td>
                    <td class="cCenter"></td>
                    <td class="cRight"></td>
                </tr>
 
            </table>
 
 
 
 
 
        </div>
    </form>
</body>
</html>

and the cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
public partial class page_2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        /*
     if (Session["IsLogin"] == null)
     {
         Response.Redirect("Default.aspx");
     }
     */
    }
    
    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if ((e.CommandName == RadGrid.InitInsertCommandName))
        {
            e.Canceled = true;
            //Prepare an IDictionary with the predefined values
            System.Collections.Specialized.ListDictionary newValues = new System.Collections.Specialized.ListDictionary();
 
            //set initial checked state for the checkbox on init insert
            newValues["inBudgetPCS"] = false;
 
            //Insert the item and rebind
            e.Item.OwnerTableView.InsertItem(newValues);
        }
    }
}
0
Maria Ilieva
Telerik team
answered on 26 Mar 2014, 02:17 PM
Hi Felice,

In case the previously provided suggestions did not help it will be best if you could open a regular support ticket and send us sample isolated runnable version of your application which demonstrates the problem. Thus we will be able to debug it locally and advise you further.

Regards,
Maria Ilieva
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
Grid
Asked by
Felice
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Felice
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or