More in this section

Forums / Developing with Sitefinity / Create custom field : FieldControl

Create custom field : FieldControl

2 posts, 0 answered
  1. Nuno
    Nuno avatar
    9 posts
    04 Jan 2013
    30 Jan 2013
    Link to this post
    Hello again,
    I'm trying to create a Custom Field Control with a RadGrid (with options to edit, delete and insert) but without success. The events of RadGrid doesn't fire...
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" EnableAJAX="true">
            <telerik:RadGrid ID="rgCosts" runat="server"  EnableViewState="true"
                AllowPaging="false" AllowSorting="false" AllowFilteringByColumn="false">
                <MasterTableView CommandItemDisplay="Top" AutoGenerateColumns="false" DataKeyNames="Id"
                        <telerik:GridEditCommandColumn ButtonType="ImageButton">
                        <telerik:GridButtonColumn ConfirmText="Delete this item?" ConfirmDialogType="RadWindow"
                            ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" ConfirmDialogHeight="100px"
                        <telerik:GridTemplateColumn DataField="Id" HeaderText="Id" UniqueName="Id"
                                <telerik:RadTextBox ID="RadTextBox1" runat="server" Text='<%# Bind("Id") %>'
                                <telerik:RadTextBox ID="RadTextBox1" runat="server" Text='<%# Eval("Id") %>'
                                    ReadOnly="true" Width="150px">
                        <telerik:GridBoundColumn DataField="Title" HeaderText="Title" UniqueName="Title">
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">

    protected virtual RadGrid RadGridViewControl
                    return this.Container.GetControl<RadGrid>("rgCosts", true);
    protected override void InitializeControls(GenericContainer container)
                this.RadGridViewControl.NeedDataSource += RadGridViewControl_NeedDataSource;
                this.RadGridViewControl.DeleteCommand += RadGridViewControl_DeleteCommand;
                this.RadGridViewControl.InsertCommand += RadGridViewControl_InsertCommand;
                this.RadGridViewControl.UpdateCommand += RadGridViewControl_UpdateCommand;
    protected void RadGridViewControl_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
                ParticipationCostCollection p = new ParticipationCostCollection();
                p.Add(new ParticipationCostItem() { Id = Guid.NewGuid(), Title = "the title", Observations = "qwerty", ValueCompanyC = 25, ValueCompanyNC = 30 });
                p.Add(new ParticipationCostItem() { Id = Guid.NewGuid(), Title = "the title 2", Observations = "asdfg", ValueCompanyC = 45, ValueCompanyNC = 50 });
                this.RadGridViewControl.DataSource = p;
            protected void RadGridViewControl_UpdateCommand(object sender, GridCommandEventArgs e)
            protected void RadGridViewControl_InsertCommand(object sender, GridCommandEventArgs e)
            protected void RadGridViewControl_DeleteCommand(object sender, GridCommandEventArgs e)

    Thanks for the help
  2. Jen Peleva
    Jen Peleva avatar
    568 posts
    10 Nov 2016
    01 Feb 2013
    Link to this post
    Hello Nuno,

    Are you creating a field control or a custom control? Did you followed our documenation about creating field controls?

    Also, in every module you are able to add custom fields from type Long Text, which are practically RadEditors. Why do you need to create your own field?

    Kind regards,
    Jen Peleva
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered