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

RadGrid not displaying data even though data is coming over to the aspx

3 Answers 423 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 06 Nov 2012, 11:04 PM
Hi,

I have a unique problem.

I have two grids, I planned to populate them the same way using ObjectDataSource.
The first one populates fine. And for the second one I am using another ObjectDataSource which takes the parameter from the first RadGrid. Till here it works fine. It goes to the DB and gets the data based on the selected datakey from the first RadGrid.

Now the problem is that data does not show up in the second RadGrid. I can see the data in break mode, it just does not render on the page.

Any help would be much appreciated.
Below is the whole Aspx page.

Thank you,
-Sam


<%@ Page Title="" Language="C#" MasterPageFile="~/KIDMaster.Master" AutoEventWireup="false"
    CodeBehind="RadGrid.aspx.cs" Inherits="KID_Admin_CSharp.RadGrid" %>


<%@ Register TagPrefix="tk" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ObjectDataSource ID="InterviewLocationObjectDataSource" runat="server" TypeName="KID_Admin_CSharp.DAL.KIDDAL"
        SelectMethod="getInterviewMainData">
        <SelectParameters>
            <asp:FormParameter Name="viewIndicator" FormField="valueIndicator" DefaultValue="1" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <tk:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true">
        <AjaxSettings>
            <tk:AjaxSetting AjaxControlID="grid">
                <UpdatedControls>
                    <tk:AjaxUpdatedControl ControlID="grid" />
                </UpdatedControls>
            </tk:AjaxSetting>
        </AjaxSettings>
    </tk:RadAjaxManager>
    <tk:RadGrid ID="grid" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
        CellSpacing="0" GridLines="None" Skin="Transparent" DataSourceID="InterviewLocationObjectDataSource"
        AlternatingItemStyle-BackColor="ControlLight" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true"
        OnSelectedIndexChanged="grid_SelectedIndexChanged">
        <ClientSettings EnablePostBackOnRowClick="true" EnableRowHoverStyle="true">
            <Selecting AllowRowSelect="true" />
        </ClientSettings>
        <MasterTableView DataKeyNames="intvw_seqno" ClientDataKeyNames="intvw_seqno, loc_seqno">
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <Columns>
                <tk:GridButtonColumn CommandName="Select" Text="Select" UniqueName="Select">
                </tk:GridButtonColumn>
                <tk:GridTemplateColumn HeaderText="Location Name">
                    <ItemTemplate>
                        <%# Eval("loc_location") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Date">
                    <ItemTemplate>
                        <%# Eval("intvw_dt_end")%>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Time">
                    <ItemTemplate>
                        <%# Eval("StartTime") %>
                        -
                        <%# Eval("EndTime") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </tk:RadGrid>
    <asp:ObjectDataSource ID="InterviewObjectDataSource" runat="server" TypeName="KID_Admin_CSharp.BLL.KIDBLL"
        SelectMethod="getInterviewData" UpdateMethod="updateInterviewData" DeleteMethod="deleteInterviewData">
        <SelectParameters>
         <asp:ControlParameter ControlID="grid" DbType="String" Name="intvw_seqno" PropertyName="SelectedValues['intvw_seqno']"/>
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Type="Object" Name="UpdateValues" />
        </UpdateParameters>
        <UpdateParameters>
            <asp:Parameter Type="String" Name="netID" />
        </UpdateParameters>
        <DeleteParameters>
            <asp:Parameter Name="intvw_seqno" Type="String" />
        </DeleteParameters>
    </asp:ObjectDataSource>
    
    <asp:HiddenField ID="interviewSeqNo" runat="server" />




<tk:RadGrid ID="DetailRadgrid" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Skin="Transparent"
        DataSourceID="InterviewObjectDataSource" AlternatingItemStyle-BackColor="ControlLight"
        AllowAutomaticUpdates="true" AllowAutomaticDeletes="true">
        <MasterTableView EditMode="PopUp">
            <Columns>
                <tk:GridEditCommandColumn EditText="Details" />
                <tk:GridTemplateColumn HeaderText="Location Name">
                    <ItemTemplate>
                        <%# Eval("loc_location") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Date">
                    <ItemTemplate>
                        <%# Eval("intvw_dt_end") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Time">
                    <ItemTemplate>
                        <%# Eval("StartTime") %>
                        -
                        <%# Eval("EndTime") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Max Enrollment">
                    <ItemTemplate>
                        <%# Eval("intvw_max_enrollment") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Status">
                    <ItemTemplate>
                        <%# Eval("intvw_status").ToString() == "True" ? "Active" : "Inactive" %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
                <tk:GridTemplateColumn HeaderText="Locked">
                    <ItemTemplate>
                        <%#Eval("intvw_lock").ToString() == "True" ? "Locked" : "Unlocked"%>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
                </tk:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </tk:RadGrid>
</asp:Content>

3 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 09 Nov 2012, 11:59 AM
Hello Sam,

If you select you select second time the first grid and make Postback do you see the previous data in the second grid, or is it still empty? Try to rebind the second grid on Page_PreRender.
Check this demo that shows how to setup Master-Detail grids:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/selectedvalue/defaultcs.aspx

Kind regards,
Vasil
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.
0
Sam
Top achievements
Rank 1
answered on 09 Nov 2012, 04:09 PM
Hello Vasil,

Thanks for your reply on this thread.

I am binding the second grid in the row's selected index change event of the first grid. But somehow the page is not getting refreshed and I cannot see the data that is already present on the page. I will give it a try by binding it in the pre-render event as you suggested and let you know the outcome.

If you look at my post I have mentioned that I have the data for the second grid coming back from the server, its just not rendering it.

Anyway, I solved it by using an updatepanel. Now the problem is no more there.

Thank you,
-Sam
0
phani
Top achievements
Rank 1
answered on 17 May 2020, 06:36 AM

Hi Sam i am having the same problem.Can you explain it how to overcome this problem with Updatepanel.

Thanks

Phani

Tags
Grid
Asked by
Sam
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Sam
Top achievements
Rank 1
phani
Top achievements
Rank 1
Share this question
or