Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8846945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:06:43+00:00 2026-06-14T12:06:43+00:00

Sir/Madam, I am going to develop a insert command by clicking Add to display

  • 0

Sir/Madam,

I am going to develop a insert command by clicking Add to display the RadTextbox as InsertItem Templates and click Add New Record after inputting all the datas INside the RadGrid

But when it goes into the testing, it is found that Getting the Items cannot be done and always show null

thw following is my code , please answer

     protected void btnAddRecord_grdFlex_performInsert(object sender, EventArgs e)
    {
        RadButton butt = sender as RadButton;

        foreach (GridDataItem dataItem in grdFlex.MasterTableView.Items)
        {

            RadTextBox textBox1 = (RadTextBox)(dataItem["Company"].FindControl("txtSubcomName"));
            RadTextBox textBox2 = (RadTextBox)(dataItem["FlexAcctCode"].FindControl("txtFlex"));
            RadComboBox ab= (RadComboBox)(dataItem["Company"].FindControl("cboCompany"));
            RadComboBox cd= (RadComboBox)(dataItem["FlexAcctCode"].FindControl("cboFlexAcctCode"));


            if (!String.IsNullOrEmpty(textBox1.Text))
            {
                ab.Items.Insert(1, new RadComboBoxItem(textBox1.Text));
                ab.SelectedIndex = 0;
                textBox1.Text = String.Empty;
            }

            if (!String.IsNullOrEmpty(textBox2.Text))
            {
                cd.Items.Insert(1, new RadComboBoxItem(textBox2.Text));
                cd.SelectedIndex = 0;
                textBox2.Text = String.Empty;
            }
        }
    }

   ASP://



         <telerik:RadGrid ID="grdFlex" runat="server" AutoGenerateColumns="False"

    ShowStatusBar="true" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
    AllowAutomaticUpdates="True" 
     EnableDynamicPageSize="False"
                        AllowMultiRowSelection="true" EnableToolbar="False" OnNeedDataSource="grdFlex_NeedDataSource"

                        Width="80%">
                        <MasterTableView CommandItemDisplay="TopAndBottom" EditMode="InPlace"  >
                            <CommandItemTemplate>
                                <div style="padding: 5px 5px;">
                                    <telerik:RadButton runat="server" Text="Add new" ID="btnAdd_grdFlex"  CommandName="InitInsert"
                                        Visible='<%# !grdFlex.MasterTableView.IsItemInserted %>'>
                                        <Icon PrimaryIconUrl="~/Image/Button/add.gif" PrimaryIconLeft="8" PrimaryIconTop="4" />
                                    </telerik:RadButton>
                                    &nbsp;&nbsp;
                                    <telerik:RadButton runat="server" AutoPostBack="false" Text="Delete" ID="btnDelete_grdFlex" 
                                        OnClientClicked="grdFlex_onDeleteClick" CausesValidation="false" Visible='<%# !grdFlex.MasterTableView.IsItemInserted %>'>
                                        <Icon PrimaryIconUrl="~/Image/Button/remove.gif" PrimaryIconLeft="8" PrimaryIconTop="4" />
                                    </telerik:RadButton>
                                    &nbsp;&nbsp;
                                    <telerik:RadButton runat="server" Text="Add New record" ID="btnAddRecord_grdFlex" CommandName="PerformInsert" OnCommand="btnAddRecord_grdFlex_performInsert" 
                                        Visible='<%# grdFlex.MasterTableView.IsItemInserted %>'>

                                        <Icon PrimaryIconUrl="~/Image/Button/yes.gif" PrimaryIconLeft="8" PrimaryIconTop="4" />
                                    </telerik:RadButton>
                                    &nbsp;&nbsp;
                                    <telerik:RadButton runat="server" Text="Cancel editing" ID="btnCancel_grdCancel" CommandName="CancelAll"
                                        Visible='<%# grdFlex.EditIndexes.Count > 0 || grdFlex.MasterTableView.IsItemInserted %>'>
                                        <Icon PrimaryIconUrl="~/Image/Button/cancel.gif" PrimaryIconLeft="8" PrimaryIconTop="4" />
                                    </telerik:RadButton>
                                    &nbsp;&nbsp;
                                </div>
                            </CommandItemTemplate>

 ...........

                                      <telerik:GridTemplateColumn UniqueName="Company"  HeaderText="Company">
                                <InsertItemTemplate>
                                <telerik:RadTextBox ID="txtSubcomName" runat="server" ></telerik:RadTextBox>
                                </InsertItemTemplate>
                                    <ItemTemplate>
                                        <telerik:RadComboBox ID="cboCompany" runat="server" Filter="Contains"   AppendDataBoundItems="true" AllowCustomText="True"
                                            Width="100%" SelectedValue='<%# Bind("Company") %>'>
                                            <Items>
                                                <telerik:RadComboBoxItem Text="Yau Lee Construction Co. Ltd" Value="YLC" />
                                                <telerik:RadComboBoxItem Text="Yau Lee Holdings" Value="YLH" />
                                            </Items>
                                        </telerik:RadComboBox>
                                    </ItemTemplate>
                                    <ItemStyle Width="200px" />
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn UniqueName="FlexAcctCode" HeaderText="Flex A/C Code">
                             <InsertItemTemplate>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:06:44+00:00Added an answer on June 14, 2026 at 12:06 pm

    I take it you based your code on the following example

    This demo is using automatic inserts which handles the value of the controls automatically as well as uses the datasource to insert into the database. In you case you want access to the controls through code.

    I had to simplify the code to get my point across. This should get what you need

    C#

    protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
    {
    var dataItem = e.Item as GridDataItem;
    var textBox = dataItem.findControl("txtSubcomName") as RadTextBox;
    //... get the rest of the controls like this
    textBox2.Text = textBox.Text;
    }
    

    ASP.net

    <telerik:RadGrid ID="RadGrid1" runat="server" 
            OnInsertCommand="RadGrid1_InsertCommand">
            <MasterTableView DataKeyNames="ID">
                <Columns>
                    <telerik:GridButtonColumn UniqueName="InsertColumn" ButtonType="ImageButton" CommandName="Insert">
                    </telerik:GridButtonColumn>
    <telerik:GridTemplateColumn UniqueName="Company"  HeaderText="Company">
                                    <InsertItemTemplate>
                                    <telerik:RadTextBox ID="txtSubcomName" runat="server" ></telerik:RadTextBox>
                                    </InsertItemTemplate>
                                        <ItemTemplate>
                                            <telerik:RadComboBox ID="cboCompany" runat="server" Filter="Contains"   AppendDataBoundItems="true" AllowCustomText="True"
                                                Width="100%" SelectedValue='<%# Bind("Company") %>'>
                                                <Items>
                                                    <telerik:RadComboBoxItem Text="Yau Lee Construction Co. Ltd" Value="YLC" />
                                                    <telerik:RadComboBoxItem Text="Yau Lee Holdings" Value="YLH" />
                                                </Items>
                                            </telerik:RadComboBox>
                                        </ItemTemplate>
                                        <ItemStyle Width="200px" />
                                    </telerik:GridTemplateColumn>
    ... rest of grid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sir/Madam I am going to create a a form with a reset button which
Respected sir/madam, I have a fortran exe which takes a input file and produces
Sir/Madam, I want to know where WSDL exists. Do user need to do interact
sir when i insert a long string data the table size comes out of
sir, when i click on Rename Day button jquery popop calender appears in my
Sir, Here i need to add geolocation from metadata to uiimage but after adding
how can i add collision effects on my sprites... sir i'm using sprite for
How to format XML node to match the following format? How to add new
Sir, these days i am improving my recursion skills but i am stuck in
Sir, I am doing the task on fetching the contents from the xml file.I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.