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

radgrid controlling datalist in a radwindow not working with asp:sqldatasource

2 Answers 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
keith
Top achievements
Rank 1
keith asked on 12 Jul 2011, 01:10 AM
I have an application that has a RadPageView embedded with a RadGrid. I would like the webpage to pop up a radwindow when user click a row on the Radgrid. In the Radwindow, I would like to show data in a Datalist. Somehow, the Radwindow opens with no data in it.

I am trying to do the similar to this sample: http://demos.telerik.com/aspnet-ajax/window/examples/internalcontent/defaultcs.aspx . The difference is I would like the radwindow to pop up in stead of showing in the beginning. Also, I would like to use the Datalist to format the data more flexibly than the Dataview.

Please help. Thanks in advance!

<telerik:RadPageView ID="RadPageView2" runat="server">
            <br />
            <div>     
                <asp:HiddenField ID="HiddenField1" Value="50125" runat="server" />
                 
                <telerik:RadGrid ID="RadGridClaimPayments" runat="server" AutoGenerateColumns="false" Skin="Office2007" Width="98%"
                    EnableViewState="true"  AutoGenerateHierarchy="false" OnDetailTableDataBind="RadGridClaimPayments_DetailTableDataBind" 
                    DataKeyNames="CheckNo">
                    <clientsettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true" >
                        <Scrolling AllowScroll="false" ScrollHeight="300px" UseStaticHeaders="false" />
                        <Selecting AllowRowSelect="true"/>
                        <ClientEvents OnRowSelected="RadGridClaimPayments_RowSelected" />
                    </clientsettings>
                    <mastertableview datakeynames="CheckNo" Name="CheckInfo" EnableViewState="true" ClientDataKeyNames="CheckNo" >
                        <Columns>
                            <telerik:GridBoundColumn DataField="TranYear" HeaderText="TranYear" ItemStyle-HorizontalAlign="Left"
                                ReadOnly="True" SortExpression="TranYear"  Visible="false"/>
                            <telerik:GridBoundColumn DataField="crdate" HeaderText="Check Date" ItemStyle-HorizontalAlign="Left"
                                ReadOnly="True" SortExpression="crdate" DataFormatString="{0:MM/dd/yyyy}" />
                            <telerik:GridBoundColumn DataField="CheckNo" HeaderText="Check No" ItemStyle-HorizontalAlign="Left"
                                ReadOnly="True" SortExpression="CheckNo" />
                            <telerik:GridBoundColumn DataField="amount" HeaderText="Check Amount" ItemStyle-HorizontalAlign="Left"
                                ReadOnly="True" SortExpression="amount" DataFormatString="{0:C}" />
                            <telerik:GridBoundColumn DataField="Status" HeaderText="Status" ItemStyle-HorizontalAlign="Left"
                                ReadOnly="True" SortExpression="Status" Visible="false" />
                            <telerik:GridBoundColumn DataField="payment" HeaderText="Check Description" ItemStyle-HorizontalAlign="Left"
                                ReadOnly="True" SortExpression="payment" />
                            <telerik:GridBoundColumn DataField="claimno" HeaderText="Claim No." ItemStyle-HorizontalAlign="Center"
                                ReadOnly="True" SortExpression="claimno" Visible="false" />
                            <telerik:GridBoundColumn DataField="lossdate" HeaderText="Loss Date" ItemStyle-HorizontalAlign="Left"
                                ReadOnly="True" SortExpression="lossdate" DataFormatString="{0:MM/dd/yyyy}" Visible="false" />
                            <telerik:GridBoundColumn DataField="reporteddate" HeaderText="Report Date" ItemStyle-HorizontalAlign="Left"
                                ReadOnly="True" SortExpression="reporteddate" DataFormatString="{0:MM/dd/yyyy}"
                                Visible="false" />
                            <telerik:GridBoundColumn DataField="Adjuster" HeaderText="Adjuster" ItemStyle-HorizontalAlign="Left"
                                ReadOnly="True" SortExpression="Adjuster" Visible="false" />
                            <telerik:GridBoundColumn DataField="OutstandingRes" HeaderText="Outstanding Res"
                                ItemStyle-HorizontalAlign="Left" ReadOnly="True" SortExpression="OutstandingRes"
                                DataFormatString="{0:C}" Visible="false" />
                        </Columns>
                        <GroupByExpressions>
                            <telerik:GridGroupByExpression>
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="TranYear" HeaderText="Year" />
                                </GroupByFields>
                                <SelectFields>
                                    <telerik:GridGroupByField FieldName="TranYear" HeaderText="Year" />
                                </SelectFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                        <detailtables >
                            <telerik:GridTableView runat="server" Name="CheckDetails" HierarchyLoadMode="ServerOnDemand" >
                                <ParentTableRelation>
                                 <telerik:GridRelationFields
                                    DetailKeyField="CheckNo"
                                    MasterKeyField="CheckNo" />
                                </ParentTableRelation>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="CheckNo" HeaderText="Check No" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="CheckNo" Visible="false"/>
                                    <telerik:GridBoundColumn DataField="checkgroup" HeaderText="Check Type" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="checkgroup"/>                                   
                                    <telerik:GridBoundColumn DataField="lossdate" HeaderText="Loss Date" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="lossdate" DataFormatString="{0:MM/dd/yyyy}" />                                   
                                    <telerik:GridBoundColumn DataField="insuredprimary" HeaderText="Insured" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="Insured" />
                                    <telerik:GridBoundColumn DataField="claimant" HeaderText="Claimant" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="claimant" />
                                    <telerik:GridBoundColumn DataField="companyname1" HeaderText="Insolvent Company" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="companyname1" />
                                    <telerik:GridBoundColumn DataField="claimno" HeaderText="Claimno" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="claimno" />
                                    <telerik:GridBoundColumn DataField="policyno" HeaderText="Policy Number" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="policyno" />
                                    <telerik:GridBoundColumn DataField="issuedt" HeaderText="Date Issued" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="issuedate" DataFormatString="{0:MM/dd/yyyy}" Visible="false"/>
                                    <telerik:GridBoundColumn DataField="payeeidno" HeaderText="IRS NO" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="IRSNO" />
                                    <telerik:GridBoundColumn DataField="checkamount" HeaderText="Amount" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="amount" DataFormatString="{0:C}" />
                                    <telerik:GridBoundColumn DataField="amounttext" HeaderText="Comments" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="amounttext" />                                   
                                    <telerik:GridBoundColumn DataField="mailtoname1" HeaderText="Address" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="mailtoname1" />
                                    <telerik:GridBoundColumn DataField="mailtoname2" HeaderText="Address1" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="mailtoname2" />
                                    <telerik:GridBoundColumn DataField="mailtoaddr1" HeaderText="Address3" ItemStyle-HorizontalAlign="Left"
                                        ReadOnly="True" SortExpression="mailtoaddr1" />
                                </Columns>
                            </telerik:GridTableView>
                        </detailtables>
                    </mastertableview>
                </telerik:RadGrid>
 
                 
                <telerik:RadWindow ID="CheckImageRadWin" runat="server" Title="Check Image Window" Width="900"
                    Height="536" VisibleOnPageLoad="false" Behaviors ="Minimize, Move, Resize, Maximize,Close"
                        OffsetElementID="RadGridClaimPayments" Left="140" Top="50" EnableShadow="true"  >
                    <ContentTemplate>
 
                        <div style="text-align: center; border-bottom-width: 8px;">
                            Check No: <asp:Label ID="lblcheckno" Runat="server" Visible="true"></asp:Label>
                             
                            <asp:Datalist ID="dlCheckImageInfo" runat="server" ShowHeader="true" Font-Size="Small"
                                BorderColor="black" CellPadding="3" GridLines="Both" DataSourceID="SqlDataSource1">
                                <HeaderTemplate>
                                    <table>
                                </HeaderTemplate>
                                <ItemTemplate>                                   
                                        <tr>
                                            <td colspan="2" rowspan="6">
                                            </td>
                                            <td>
                                                INSURED
                                            </td>
                                            <td>
                                                CLAIM NUMBER
                                            </td>                  
                                        </tr>
                                        <tr>
                                             <td>
                                                <%# DataBinder.Eval(Container.DataItem, "insuredprimary")%>
                                            </td>
 
                                            <td>
                                                <%# DataBinder.Eval(Container.DataItem, "claimno")%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                CLAIMANT
                                            </td>
                                            <td>
                                                POLICY NUMBER
                                            </td>
                     
                                        </tr>
                                        <tr>
                                            <td>
                                                <%# DataBinder.Eval(Container.DataItem, "claimant")%>
                                            </td>
                                            <td>
                                                <%# DataBinder.Eval(Container.DataItem, "policyno")%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                INSOLVENT COMPANY
                                            </td>
                                            <td>
                                                DATE ISSUED
                                            </td>                   
                                        </tr>
                                        <tr>
                                           <td>
                                                <%# DataBinder.Eval(Container.DataItem, "companyname1")%>
                                            </td>
                                            <td>
                                                <%# DataBinder.Eval(Container.DataItem, "issuedate")%>
                                            </td>
                                        </tr>
 
                                        <tr>
                                            <td>
                                                CHECK TYPE
                                            </td>
                                            <td>
                                                DATE OF LOSS
                                            </td
                                            <td>
                                                IN PAYMENT OF
                                            </td>
                                            <td>
                                                IRS NO
                                            </td>                   
                                        </tr>
                                        <tr>
                                            <td>
                                                <%# DataBinder.Eval(Container.DataItem, "checkgroup")%>
                                            </td>
                                            <td>
                                                <%# DataBinder.Eval(Container.DataItem, "lossdate")%>
                                            </td>
                                           <td>
                         
                                            </td>
                                            <td>
                                                <%# DataBinder.Eval(Container.DataItem, "payeeidno")%>
                                            </td>
                                        </tr>
 
                                        <tr>
                                            <td colspan="3" rowspan="2">
                                                <%# DataBinder.Eval(Container.DataItem, "amounttext")%>
                                            </td>
                                            <td>
                                                AMOUNT
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <%# DataBinder.Eval(Container.DataItem, "amount")%>
                                            </td>
                                        </tr>
                                    </table>
                                </ItemTemplate>
                                <FooterTemplate>
                                    </table>
                                </FooterTemplate>
                            </asp:Datalist>
                        </div>
                       <asp:ObjectDataSource  DataSourceMode="DataReader"
                            ID="SqlDataSource1"
                            runat="server"                   
                            SelectCommand = "spu_payment_checkprint_cfp_web"
                            SelectCommandType = "StoredProcedure"
                            ConnectionString ="<%$ ConnectionStrings:SiteSqlServer" %>">   
                            <SelectParameters>
                                <asp:ControlParameter Name="CheckNo" ControlID="RadGridClaimPayments" PropertyName="SelectedValue" Type="String" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                         
                    </ContentTemplate>
                </telerik:RadWindow>
            </div>
        </telerik:RadPageView>

2 Answers, 1 is accepted

Sort by
0
keith
Top achievements
Rank 1
answered on 12 Jul 2011, 06:59 PM
Please help. I've been dragged by this for days. Thanks.
0
Genti
Telerik team
answered on 15 Jul 2011, 09:34 AM
Hello Keith,

I am attaching a modified version of the demo that illustrates what you are trying to achieve.
In the beginning the RadWindow is not displayed on the page.
When the user selects an item an ajax postback is performed and I implement the ItemCommand to inject a script in the page that would make the RadWindow visible.


All the best,
Genti
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
keith
Top achievements
Rank 1
Answers by
keith
Top achievements
Rank 1
Genti
Telerik team
Share this question
or