Grid and Form integration

2 posts, 0 answers
  1. Adrian
    Adrian avatar
    7 posts
    Member since:
    Jan 2013

    Posted 22 Jun 2015 Link to this post

    I'm trying to write a grid and form where the form will display the data for the line selected on the grid.   

    Grid and DS

    <telerik:RadGrid ID="GridPeople" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SQLDSPeople" GroupPanelPosition="Top">
        <ClientSettings EnablePostBackOnRowClick="true">
            <Selecting AllowRowSelect="True" />
        <MasterTableView DataSourceID="SQLDSPeople">
                <telerik:GridBoundColumn DataField="person_ref" visible="false" UniqueName="person_ref" />
                <telerik:GridBoundColumn DataField="forename1" FilterControlAltText="Filter" HeaderText="Forename" UniqueName="forename" />
                <telerik:GridBoundColumn DataField="surname" FilterControlAltText="Filter" HeaderText="Surname" UniqueName="surname" />
    <asp:SqlDataSource ID="SQLDSPeople"
        SelectCommand="SELECT [person_ref], [forename1     ], [surname] FROM [PERSON] " />

    With just this, everything works find, I can select different rows and the row highlights and the code behind event gets called.

    Here's the dataform and its DS.

    <telerik:RadDataForm ID="FormPerson" runat="server" DataKeyNames="person_ref" DataSourceID="SQLDSPerson">
            <div id="itemPlaceholder" runat="server"></div>
                    <asp:Label runat="server" ID="FirstNameLabel2" Text="First Name:"></asp:Label>
                    <telerik:RadTextBox runat="server" ID="FirstNameTextBox2" Text='<%# Bind("forename1")%>' MaxLength="20" />
                    <asp:Label runat="server" ID="LastNameLabel2" Text="Last Name:"></asp:Label>
                    <telerik:RadTextBox runat="server" ID="LastNameTextBox2" Text='<%# Bind("surname")%>' MaxLength="20" />
                    <telerik:RadButton ID="ButtonUpdate" Text="Update" runat="server" CommandName="Update" />
        <asp:SqlDataSource ID="SQLDSPerson"
            SelectCommand="SELECT [person_ref], [forename1], [surname] FROM [PERSON] WHERE ([person_ref] = @person_ref)"
            UpdateCommand="UPDATE [PERSON] SET [forename1] = @forename1, [surname] = @surname WHERE [person_ref] = @person_ref">
                <asp:ControlParameter ControlID="GridPeople" Name="person_ref" PropertyName="SelectedValue" Type="String" />
                <asp:Parameter Name="forename1" Type="String" />
                <asp:Parameter Name="surname" Type="String" />
                <asp:Parameter Name="person_ref" Type="String" />

    As soon as I add this, the grid select row stops working and no events are fired.  Also, the grid doesn't appear at all.

    Here's the code behind bits.

    Private Sub Page_Init1(sender As Object, e As EventArgs) Handles Me.Init
        SQLDSPeople.ConnectionString = MyConnStr
        SQLDSPerson.ConnectionString = MyConnStr
    End Sub
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
        End If
    End Sub
    Private Sub GridPeople_SelectedIndexChanged(sender As Object, e As EventArgs) Handles GridPeople.SelectedIndexChanged
    End Sub
    Private Sub FormPerson_ItemUpdated(sender As Object, e As Telerik.Web.UI.RadDataFormUpdatedEventArgs) Handles FormPerson.ItemUpdated
    End Sub

     Am I doing something wrong in the RadDataForm ?





  2. Eyup
    Eyup avatar
    2941 posts

    Posted 25 Jun 2015 Link to this post

    Hello Adrian,

    You can temporarily disable any AJAX on the page if present (RadAjaxManager, RadAjaxPanel, UpdatePanel, etc.) and enable your script debugger (FireBug or F12) to see whether there is script error interfering.

    In addition, you can check the following live samples:

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top