How To Select Multiple Rows in Rad Grid.

2 posts, 0 answers
  1. Sairam
    Sairam avatar
    56 posts
    Member since:
    May 2013

    Posted 04 May 2013 Link to this post

    I am New in Using the Rad Controls, I have requirement, like this  I Have One grid “RadGrid1” in that “I am  Putting the  Another grid “Radgrid2” but, In Rad Grid  Data Source is  “Dynamically created Data Table and with checkbox,  My   requirement is ,  In Insert , when user want to select the row ,we don’t want to allow him ,     But when ,The user clicks On the   Check Box , we allows the user select the row


    Bank.aspx

        <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" OnNeedDataSource="RadGrid1_NeedDataSource"
            AllowSorting="True" PageSize="10" AllowCustomPaging="True" AllowPaging="True"
            OnPageIndexChanged="RadGrid1_PageIndexChanged" OnPageSizeChanged="RadGrid1_PageSizeChanged"
            OnInsertCommand="RadGrid1_InsertCommand" OnUpdateCommand="RadGrid1_UpdateCommand"
            OnItemCreated="RadGrid1_ItemCreated" OnDeleteCommand="RadGrid1_DeleteCommand"
            GridLines="Both" AutoGenerateColumns="False" Skin="Office2007" ShowStatusBar="True"
            CellSpacing="0" CssClass="MainGrid" Width="500px" OnItemDataBound="RadGrid1_ItemDataBound"
            EnableHeaderContextMenu="true">
            <EditItemStyle BackColor="Gray" />
            <GroupingSettings CaseSensitive="false" />
            <MasterTableView CommandItemDisplay="TopAndBottom" AutoGenerateColumns="false" DataKeyNames="id,BankRoutingNumber,BankAccountNumber"
                InsertItemPageIndexAction="ShowItemOnCurrentPage" EditMode="EditForms" GridLines="None"
                TableLayout="Auto" AllowCustomSorting="true" Width="500px">
                <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                <CommandItemStyle CssClass="lnkNormal" />
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                <RowIndicatorColumn Visible="true" FilterControlAltText="Filter RowIndicator column">
                </RowIndicatorColumn>
                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                </ExpandCollapseColumn>
                <ItemStyle ForeColor="#424242" Font-Size="12px" />
                <AlternatingItemStyle Height="10px" BackColor="#EAEAEA" ForeColor="#424242" Font-Size="12px" />
                <HeaderStyle HorizontalAlign="Left" Height="5px" />
                <CommandItemStyle Height="5px" />
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" FooterText="EditCommand footer"
                        EditImageUrl="images/Edit.gif" UniqueName="id" HeaderStyle-Width="30px" />
                    <telerik:GridTemplateColumn DataField="BankRoutingNumber" HeaderText="Bank Routing Number"
                        SortExpression="BankRoutingNumber" UniqueName="BankRoutingNumber" AutoPostBackOnFilter="true"
                        CurrentFilterFunction="EqualTo" ItemStyle-HorizontalAlign="Left" FilterControlWidth="80px"
                        HeaderStyle-Width="135px" HeaderStyle-BackColor="LightGray" HeaderStyle-Font-Size="12px">
                        <ItemTemplate>
                            <%#Eval("BankRoutingNumber")%>
                        </ItemTemplate>
                        <InsertItemTemplate>
                            <telerik:RadTextBox ID="rtBankRoutingNumber1" runat="server" Width="150px" MaxLength="9"
                                onkeypress="return isNumberKey(event)" OnTextChanged="RadGrid1_TextChanged1"
                                AutoPostBack="true" onclick="shouldConfirm = true;">
                            </telerik:RadTextBox>
                            <asp:RequiredFieldValidator ID="rfvBankRoutingNumber1" runat="server" ErrorMessage=" Bank Routing Number is required"
                                ControlToValidate="rtBankRoutingNumber1" Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
                        </InsertItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadTextBox ID="rtBankRoutingNumber" runat="server" Text='<%# Eval("BankRoutingNumber") %>'
                                Width="150px" OnTextChanged="RadGrid1_TextChanged" AutoPostBack="true" MaxLength="9"
                                onkeypress="return isNumberKey(event)" onclick="shouldConfirm = true;">
                            </telerik:RadTextBox>
                            <asp:RequiredFieldValidator ID="rfvBankRoutingNumber" runat="server" ErrorMessage="Bank Routing Number is required"
                                ControlToValidate="rtBankRoutingNumber" Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="BankAccountNumber" SortExpression="BankAccountNumber"
                        HeaderText="Bank Account Number" UniqueName="BankAccountNumber" AutoPostBackOnFilter="true"
                        CurrentFilterFunction="EqualTo" ItemStyle-HorizontalAlign="Left" FilterControlWidth="80px"
                        HeaderStyle-Width="140px" HeaderStyle-BackColor="LightGray" HeaderStyle-Font-Size="12px">
                        <ItemTemplate>
                            <%#Eval("BankAccountNumber")%>
                        </ItemTemplate>
                        <InsertItemTemplate>
                            <telerik:RadTextBox ID="rtBankAccountNumber1" runat="server" MaxLength="16" Width="150px"
                                onkeypress="return isNumberKey(event)" onclick="shouldConfirm = true;">
                            </telerik:RadTextBox>
                            <asp:RequiredFieldValidator ID="rfvMainBankAccountNumber" runat="server" ErrorMessage="Account Number is required"
                                ControlToValidate="rtBankAccountNumber1" Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator Display="Dynamic" ControlToValidate="rtBankAccountNumber1"
                                ID="RegularExpressionValidator3" ValidationExpression="^[0-9]{9,16}$" ForeColor="Red"
                                runat="server" ErrorMessage="Minimum 9 and Maximum 16 Numbers Required"></asp:RegularExpressionValidator>
                        </InsertItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadTextBox ID="rtBankAccountNumber" runat="server" ReadOnly="false" MaxLength="16"
                                Text='<%# Eval("BankAccountNumber") %>' Width="150px" onkeypress="return isNumberKey(event)"
                                onclick="shouldConfirm = true;">
                            </telerik:RadTextBox>
                            <asp:RequiredFieldValidator ID="rfveditMainBankAccountNumber" runat="server" ErrorMessage="Account Number is required"
                                ControlToValidate="rtBankAccountNumber" Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator Display="Dynamic" ControlToValidate="rtBankAccountNumber"
                                ID="rertBankAccountNumber" ValidationExpression="^[0-9]{9,16}$" ForeColor="Red"
                                runat="server" ErrorMessage="Minimum 9 and Maximum 16 Numbers Required"></asp:RegularExpressionValidator>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="BankAccountNumbeVerr" SortExpression="BankAccountNumbeVerr"
                        HeaderText="Confirm Account Number" UniqueName="BankAccountNumberVer" Visible="false"
                        CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true" ItemStyle-HorizontalAlign="Left"
                        FilterControlWidth="80px" HeaderStyle-Width="80px" HeaderStyle-BackColor="LightGray"
                        HeaderStyle-Font-Size="12px">
                        <ItemTemplate>
                            <%#Eval("BankAccountNumber")%>
                        </ItemTemplate>
                        <InsertItemTemplate>
                            <telerik:RadTextBox ID="rtBankAccountNumberVer" runat="server" ReadOnly="false" MaxLength="16"
                                Width="150px" onclick="shouldConfirm = true;">
                            </telerik:RadTextBox>
                            <asp:RequiredFieldValidator ID="rfvrtBankAccountNumberVer" runat="server" ErrorMessage="Confirm Account Number is required"
                                ControlToValidate="rtBankAccountNumberVer" Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
                            <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="Account number not match"
                                ControlToCompare="rtBankAccountNumber1" ControlToValidate="rtBankAccountNumberVer"
                                Display="Dynamic" ForeColor="Red"></asp:CompareValidator>
                        </InsertItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadTextBox ID="rtBankAccountNumberVer1" runat="server" ReadOnly="false"
                                MaxLength="16" Width="150px" Text='<%# Eval("BankAccountNumber") %>' onclick="shouldConfirm = true;">
                            </telerik:RadTextBox>
                            <asp:RequiredFieldValidator ID="rfvrtBankAccountNumberVer" runat="server" ErrorMessage="Confirm Account Number is required"
                                ControlToValidate="rtBankAccountNumberVer1" Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
                            <asp:CompareValidator ID="CompareValidator" runat="server" ErrorMessage="Account number not match"
                                ControlToCompare="rtBankAccountNumber" ControlToValidate="rtBankAccountNumberVer1"
                                Display="Dynamic" ForeColor="Red"></asp:CompareValidator>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="BankName" HeaderText="Bank Name" SortExpression="BankName"
                        UniqueName="BankName" AutoPostBackOnFilter="true" ItemStyle-HorizontalAlign="Left"
                        FilterControlWidth="80px" HeaderStyle-Width="300px" HeaderStyle-BackColor="LightGray"
                        HeaderStyle-Font-Size="12px">
                        <ItemTemplate>
                            <%#Eval("BankName")%>
                        </ItemTemplate>
                        <InsertItemTemplate>
                            <telerik:RadTextBox ID="rtBankName1" runat="server" Width="150px" ReadOnly="false"
                                Enabled="false" onclick="shouldConfirm = true;">
                            </telerik:RadTextBox>
                            <asp:RequiredFieldValidator ID="rfvBankName1" runat="server" ErrorMessage="Bank Name is required"
                                ControlToValidate="rtBankName1" Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
                        </InsertItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadTextBox ID="rtBankName" runat="server" Text='<%# Eval("BankName") %>'
                                Width="150px" ReadOnly="false" onclick="shouldConfirm = true;" Enabled="false">
                            </telerik:RadTextBox>
                            <asp:RequiredFieldValidator ID="rfvBankName" runat="server" ErrorMessage="Bank Name is required"
                                ControlToValidate="rtBankName" Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Bank Type" Visible="false" UniqueName="BankType"
                        SortExpression="BankType" HeaderStyle-BackColor="LightGray">
                        <InsertItemTemplate>
                            <telerik:RadGrid ID="RgList" runat="server" AutoGenerateColumns="false" AllowMultiRowSelection="true"
                                ShowHeader="false" Width="148px">
                                <MasterTableView AutoGenerateColumns="false">
                                    <Columns>
                                        <telerik:GridTemplateColumn>
                                            <ItemTemplate>
                                                <%#Eval("CheckList") %></ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridClientSelectColumn />
                                    </Columns>
                                </MasterTableView>
                                <ClientSettings>
                                    <Selecting AllowRowSelect="true" />
                                </ClientSettings>
                            </telerik:RadGrid>
                        </InsertItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadGrid ID="RgList1" runat="server" AutoGenerateColumns="false" AllowMultiRowSelection="true"
                                ShowHeader="false" Width="148px">
                                <MasterTableView AutoGenerateColumns="false">
                                    <Columns>
                                        <telerik:GridTemplateColumn>
                                            <ItemTemplate>
                                                <%#Eval("CheckList") %></ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridClientSelectColumn />
                                    </Columns>
                                </MasterTableView>
                                <ClientSettings>
                                    <Selecting AllowRowSelect="true" />
                                </ClientSettings>
                            </telerik:RadGrid>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" UniqueName="BankRoutingNumber"
                        ConfirmText="Are you sure you want to delete the selected row?" ConfirmTitle="Bank Details Delete"
                        ImageUrl="images/Delete.gif" ConfirmDialogHeight="100px" ConfirmDialogWidth="300px"
                        ConfirmDialogType="RadWindow" />
                </Columns>
                <EditFormSettings InsertCaption="New bank details" CaptionDataField="BankRoutingNumber"
                    CaptionFormatString="Edit properties of bank details">
                    <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                    <EditColumn UniqueName="id" ButtonType="ImageButton" CancelImageUrl="images/Cancel.gif"
                        UpdateImageUrl="images/update.gif" InsertImageUrl="images/update.gif">
                    </EditColumn>
                    <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
                    <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
                </EditFormSettings>
            </MasterTableView>
            <ValidationSettings CommandsToValidate="PerformInsert,Update" />
            <ClientSettings AllowColumnsReorder="true" EnableRowHoverStyle="true">
                <Selecting AllowRowSelect="true" />
                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" ScrollHeight="250px"
                    FrozenColumnsCount="2"></Scrolling>
                <Selecting AllowRowSelect="true" />
                <Resizing AllowColumnResize="true" AllowRowResize="false" ResizeGridOnColumnResize="true"
                    ClipCellContentOnResize="true" EnableRealTimeResize="false" AllowResizeToFit="true" />
                <selecteditemstyle cssclass="rgSelectedRow"></selecteditemstyle>
                <filtermenu enableimagesprites="False">
            </filtermenu>
        </telerik:RadGrid>

    Bank.Aspx.cs

    Dynamically Created

    CheckBoX with Data for  RgList1,RgList is
     protected void GetCheckListData(out DataSet local_ds)
        {
            local_ds = null;
            DataTable TblCheckList = new DataTable();
            DataColumn CheckList = new DataColumn("CheckList");
            CheckList.DataType = System.Type.GetType("System.String");
            TblCheckList.Columns.Add(CheckList);
            DataRow RwInvoice = TblCheckList.NewRow();
            DataRow RwDirectDeposit = TblCheckList.NewRow();
            DataRow RwChecks = TblCheckList.NewRow();
            DataRow RwFees = TblCheckList.NewRow();
            DataRow RwTaxes = TblCheckList.NewRow();
            RwInvoice[CheckList] = "Invoices";
            RwDirectDeposit[CheckList] = "Direct Deposits";
            RwChecks[CheckList] = "Checks";
            RwFees[CheckList] = "Fees";
            RwTaxes[CheckList] = "Taxes";
            TblCheckList.Rows.Add(RwInvoice);
            TblCheckList.Rows.Add(RwDirectDeposit);
            TblCheckList.Rows.Add(RwChecks);
            TblCheckList.Rows.Add(RwFees);
            TblCheckList.Rows.Add(RwTaxes);
            DataSet AddDs = new DataSet();
            AddDs.Tables.Add(TblCheckList);
            local_ds = AddDs;
        }


    Insert Details

     protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
        {
            string strCustomerID = Session["CustomerID"].ToString();
            string username = Session["LoginID"].ToString();
            //Session["status"] = null;
            MySqlCommand cmd = new MySqlCommand("uspInsertCustomerBankDetails", con);
            cmd.CommandType = CommandType.StoredProcedure;
            GridEditableItem item = e.Item as GridEditableItem;
            Hashtable values = new Hashtable();
            item.ExtractValues(values);
            RadTextBox BankName = (RadTextBox)item.FindControl("rtBankName1");
            RadTextBox BankAccountNumber = (RadTextBox)item.FindControl("rtBankAccountNumberVer");
            RadTextBox BankRoutingNumber = (RadTextBox)item.FindControl("rtBankRoutingNumber1");
            RadGrid radChkList = (RadGrid)item.FindControl("RgList");

            string s = "Yes";
            string n = "No";
           

            if (radChkList.MasterTableView.Items[0].Selected==true)
            {

                OutputInvoices1 = s;
            }
            else
            {
                OutputInvoices1 = n;
            }
            if (radChkList.MasterTableView.Items[1].Selected == true)
            {

                OutputDirectDeposits2 = s;
            }

            else
            {
                OutputDirectDeposits2 = n;
            }
            if (radChkList.MasterTableView.Items[2].Selected == true)
            {

                OutputChecks3 = s;
            }
            else
            {
                OutputChecks3 = n;
            }
            if (radChkList.MasterTableView.Items[3].Selected == true)
            {

                OutputFees4 = s;
            }
            else
            {
                OutputFees4 = n;
            }
            if (radChkList.MasterTableView.Items[4].Selected == true)
            {

                OutputTaxes5 = s;
            }
            else
            {
                OutputTaxes5 = n;
            }

            DataSet ds = new DataSet();
            strServiceID = Session["ServiceID"].ToString();
            strFedTaxid = Session["FedTaxID"].ToString();
            oCustDetail.ServiceID = strServiceID;
            oCustDetail.FedTaxID = strFedTaxid;
            local_strStoreProName = "uspCustomerCompanyGetList";
            oCustDetail.Select(out ds, local_strStoreProName);
            if (ds != null)
            {
                oCustDetail.CompanyName = ds.Tables[0].Rows[0]["CompanyName"].ToString();
            }
            oCustDetail.ServiceID = strServiceID;
            oCustDetail.FedTaxID = strFedTaxid;
            oCustDetail.BankName = BankName.Text;
            oCustDetail.CustomerID = strCustomerID;
            oCustDetail.LoginID = username;
            oCustDetail.BankRoutingNO = BankRoutingNumber.Text;
            oCustDetail.BankAccNo = BankAccountNumber.Text;
            oCustDetail.Invoices = OutputInvoices1.ToString();
            oCustDetail.DirectDeposits = OutputDirectDeposits2.ToString();
            oCustDetail.Checks = OutputChecks3.ToString();
            oCustDetail.Fees = OutputFees4.ToString();
            oCustDetail.Taxes = OutputTaxes5.ToString();
            if (oCustDetail.Invoices != "No" || oCustDetail.DirectDeposits != "No" || oCustDetail.Checks != "No" || oCustDetail.Fees != "No" || oCustDetail.Taxes != "No")
            {
                string sp_ch = "uspGetBankType1";
                DataSet ds_ch = new DataSet();
                oCustDetail.CheckBankDetails(out ds_ch, sp_ch);

                if (ds_ch != null)
                {
                    for (int i = 0; i < ds_ch.Tables[0].Rows.Count; i++)
                    {
                        if (ds_ch.Tables[0].Rows[i]["Invoices"].ToString() == "Yes" && oCustDetail.Invoices == "Yes")
                        {
                            oCustDetail.Invoices = "No";
                            ii = 1;
                        }
                        if (ds_ch.Tables[0].Rows[i]["DirectDeposits"].ToString() == "Yes" && oCustDetail.DirectDeposits == "Yes")
                        {
                            oCustDetail.DirectDeposits = "No";
                            dd = 1;
                        }
                        if (ds_ch.Tables[0].Rows[i]["Checks"].ToString() == "Yes" && oCustDetail.Checks == "Yes")
                        {
                            oCustDetail.Checks = "No";
                            c = 1;
                        }
                        if (ds_ch.Tables[0].Rows[i]["Taxes"].ToString() == "Yes" && oCustDetail.Taxes == "Yes")
                        {
                            oCustDetail.Taxes = "No";
                            t = 1;
                        }
                        if (ds_ch.Tables[0].Rows[i]["Fees"].ToString() == "Yes" && oCustDetail.Fees == "Yes")
                        {
                            oCustDetail.Fees = "No";
                            f = 1;
                        }
                        if (ii == 1 || dd == 1 || c == 1 || t == 1 || f == 1)
                        {
                            cou++;
                        }
                    }
                }
                if (cou != 0)
                {
                    //string scriptstring = "radalert('Another record already exists with Yes ', 250, 80,'Bank Details Insert');";
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "radalert", scriptstring, true);
                    RadWindowManager1.RadAlert("Another record already exists with Yes.", 300, 110, "Bank Details Insert", null);
                }
                if (cou == 0)
                {
                    oCustDetail.Invoices = OutputInvoices1.ToString();
                    oCustDetail.DirectDeposits = OutputDirectDeposits2.ToString();
                    oCustDetail.Checks = OutputChecks3.ToString();
                    oCustDetail.Fees = OutputFees4.ToString();
                    oCustDetail.Taxes = OutputTaxes5.ToString();
                    if (oCustDetail.customerBankDetailsadd())
                    {
                        Session["AuditDetails"] = Session["AuditDetails"] + "BankDetails Adedd to Customer-'" + Session["Companyname"].ToString() + "', ";
                        string strAuditDetails = Session["AuditDetails"].ToString();

                        //string scriptstring = "radalert('  Bank Details Added Successfully', 250, 80,'Bank Details Insert');";
                        //ScriptManager.RegisterStartupScript(this, this.GetType(), "radalert", scriptstring, true);
                        RadWindowManager1.RadAlert("Bank Details Added Successfully.", 300, 110, "Bank Details Insert", null);
                    }
                    else
                    {
                        //string scriptstring = "radalert(' Bank details already exist.', 250, 80,'Bank Details Insert');";
                        //ScriptManager.RegisterStartupScript(this, this.GetType(), "radalert", scriptstring, true);
                        RadWindowManager1.RadAlert("Bank details already exist.", 300, 110, "Bank Details Insert", null);
                    }

                }
            }
            else
            {
                oCustDetail.Invoices = OutputInvoices1.ToString();
                oCustDetail.DirectDeposits = OutputDirectDeposits2.ToString();
                oCustDetail.Checks = OutputChecks3.ToString();
                oCustDetail.Fees = OutputFees4.ToString();
                oCustDetail.Taxes = OutputTaxes5.ToString();
                if (oCustDetail.customerBankDetailsadd())
                {
                    Session["AuditDetails"] = Session["AuditDetails"] + "Bank Details Adedd to Customer-'" + Session["Companyname"].ToString() + "', ";
                    string strAuditDetails = Session["AuditDetails"].ToString();

                    //string scriptstring = "radalert('  Bank Details Inserted Successfully', 250, 80,'Bank Details Insert');";
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "radalert", scriptstring, true);
                    RadWindowManager1.RadAlert("Bank Details Inserted Successfully.", 300, 110, "Bank Details Insert", null);
                }
                else
                {
                    //string scriptstring = "radalert(' Bank details already exist.', 250, 80,'Bank Details Insert');";
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "radalert", scriptstring, true);
                    RadWindowManager1.RadAlert("Bank details already exist.", 300, 110, "Bank Details Insert", null);
                }
            }
        }

    Item Data Bound Event
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem item = e.Item as GridEditableItem;
                DataSet DsCheckList;
                GetCheckListData(out DsCheckList);
                if (e.Item.OwnerTableView.IsItemInserted)
                {
                   
                    RadGrid radChkList1 = (RadGrid)item.FindControl("RgList");
                    radChkList1.DataSource = DsCheckList;
                    radChkList1.DataBind();
                    DsCheckList.Clear();

                }
    }
        #endregion

    Please Give me replay  ....
  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 07 May 2013 Link to this post

    Hello Sairam,

    I see that you are using two RadGrids to create your insert/edit form.
    You could use only RadGrid1 and create custom edit form for it. In your case in this custom edit form you could add textboxes for account number and bank name. The checkbox list could be RadListBox. RadListBox could use different data sources and the data in it could be from dynamically created data source. To display checkboxes for the items in the list you should set the CheckBoxes property to true:
    <telerik:RadListBox ID="RadListBox1" runat="server" CheckBoxes="true"></telerik:RadListBox>

    Then you can get the items with activated checkboxes and use them in your logic. Demo on getting the checked items could be found here.

    More information on custom insert/edit forms for RadGrid could be found in this and this help topic. Also demo illustrating edit form templates could be found here.

    I am also attaching working project with sample RadGrid and custom insert form.

    All the best,
    Victor
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top