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

IEnumerable Binding can not fire Add New Record

2 Answers 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Al
Top achievements
Rank 1
Al asked on 20 Sep 2011, 10:43 PM
Hi,

I'm getting frustrated using Telerik RadGrid, i just create a simple page with 
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
    <telerik:RadGrid ID="rg" runat="server" AutoGenerateColumns="false"
OnNeedDataSource="TestNeedDataSource">
        <MasterTableView  CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage"
            EditMode="PopUp" >
            <Columns>
                <telerik:GridBoundColumn DataField="Id" />
                <telerik:GridBoundColumn DataField="Name" />
            </Columns>
            <EditFormSettings PopUpSettings-Modal="true" PopUpSettings-Width="600"
                PopUpSettings-ScrollBars="Auto" PopUpSettings-Height="600"
                EditFormType="Template" >
                <FormTemplate>
                    <table>
                        <tr>
                            <td>Test</td>
                        </tr>
                    </table>
                </FormTemplate>
            </EditFormSettings>
        </MasterTableView>
    </telerik:RadGrid>
</telerik:RadAjaxPanel>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />

And my code behind :

public IEnumerable<IDictionary> GenerateData()
    {
        for (var i = 0; i < 15; i++)
        {
            var dict = new Dictionary<string, object>();
            dict["ID"] = Guid.NewGuid();
            dict["Name"] = "Name_" + i;
            yield return dict;
        }
    }
    protected void TestNeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        rg.DataSource = GenerateData().ToDataSource();
    }

Every time i click Add New Record, it call the ajax loading panel, but it doesn't open my popup modal. It does nothing.

Is there anything wrong with my code ? Or is it impossible to do this kind of binding with RadGrid ?

Thanks in advance

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 Sep 2011, 10:47 AM
Hello,

Your code is working fine at my end. Have you used any 'RadAjaxManager control ' in your page? The issue may be caused by your AJAX settings. Please paste you complete code for more help.

-Shinu.
0
Al
Top achievements
Rank 1
answered on 21 Sep 2011, 11:04 AM
Yes, I did use the RadAjaxManager.

Actually i use the extension to have the possibility to bind an IDictionary to the datagrid, as described here :
http://www.simple-talk.com/dotnet/.net-framework/dynamically-generating--typed-objects-in-.net/

I used the DataSourceCreator.cs so I can use IEnumerable.ToDataSource()

Tags
Grid
Asked by
Al
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Al
Top achievements
Rank 1
Share this question
or