0

我有一个带有 NestedViewTemplate 的 RadGrid,其中有一个 RadTabStrip。我正在做的是将 UserControls(ascx) 文件加载到我在 RadMultiPage 中创建的每个选项卡中。选项卡是静态的,但用户控件是动态加载的。他们并没有一直出现。这是他们所在的主页。

<asp:Panel runat="server" ID="myPanel">
<telerik:RadGrid ID="gdDocket" runat="server" ShowGroupPanel="True" GridLines="None"
    CellSpacing="0" ActiveItemStyle-BackColor="#0066FF" Width="1000" AutoGenerateEditColumn="True"
    OnInsertCommand="gdDocket_InsertCommand" OnNeedDataSource="gdDocket_NeedDataSource"
    OnUpdateCommand="gdDocket_UpdateCommand" OnItemCommand="gdDocket_ItemCommand"
    Skin="Web20" OnItemCreated="gdDocket_ItemCreated" 
    onitemdatabound="gdDocket_ItemDataBound">
    <ActiveItemStyle BackColor="#0066FF"></ActiveItemStyle>
    <PagerStyle Mode="NumericPages"></PagerStyle>
    <GroupHeaderItemStyle BackColor="SlateGray" ForeColor="White" />
    <HeaderStyle Wrap="false" />
    <MasterTableView HierarchyDefaultExpanded="false" Width="100%" EditMode="PopUp" BorderWidth="1px" CellPadding="1"
        CellSpacing="1" CommandItemDisplay="Top" GridLines="Both" DataKeyNames="claim_num,docket_id"
        AutoGenerateColumns="false" HorizontalAlign="NotSet" GroupLoadMode="Server" >
        <NestedViewTemplate>
            <asp:Panel runat="server" ID="InnerContainer" Visible="true">
                <telerik:RadTabStrip runat="server" ID="TabStip1" AutoPostBack="true" EnableViewState="true" 
                MultiPageID="Multipage1" SelectedIndex="0" ClickSelectedTab="True" OnTabClick="TabStrip1_TabClick">
                    <Tabs>
                        <telerik:RadTab runat="server" Value="Full" Text="Full Claim" PageViewID="FullClaimPage">
                        </telerik:RadTab>
                        <telerik:RadTab runat="server" Value="Remand" Text="Remand History" PageViewID="RemandsPage">
                        </telerik:RadTab>
                        <telerik:RadTab runat="server" Value="Comments" Text="Docket Comments" PageViewID="DocketComments">
                        </telerik:RadTab>
                    </Tabs>
                </telerik:RadTabStrip>
                <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">
                    <telerik:RadPageView runat="server" ID="FullClaimPage" Width="460px">
                            <asp:Panel ID="pFullClaim" runat="server" Width="100%" />                                                         
                    </telerik:RadPageView>
                    <telerik:RadPageView runat="server" ID="RemandsPage">
                        <asp:Panel ID="pRemandHistory" runat="server" Width="100%" />
                    </telerik:RadPageView>
                    <telerik:RadPageView runat="server" ID="DocketComments">
                        <asp:Panel ID="pDocketComments" runat="server" Width="100%" />
                    </telerik:RadPageView>
                </telerik:RadMultiPage>
            </asp:Panel>
        </NestedViewTemplate>
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <SelectFields>
                    <telerik:GridGroupByField FieldAlias="-Docket_Status" FieldName="Docket_Status_Descr"
                        FormatString="{0:D}" HeaderValueSeparator=" : "></telerik:GridGroupByField>
                </SelectFields>
                <GroupByFields>
                    <telerik:GridGroupByField FieldName="Docket_Status_Descr" SortOrder="Descending">
                    </telerik:GridGroupByField>
                </GroupByFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
        </RowIndicatorColumn>
        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"
                HeaderStyle-Width="25">
                <HeaderStyle Width="25px" />
                <ItemStyle CssClass="MyImageButton"></ItemStyle>
            </telerik:GridEditCommandColumn>
            <telerik:GridTemplateColumn SortExpression="docket_id" UniqueName="docket_id" DataField="docket_id"
                Resizable="true" Visible="true" Display="false">
                <ItemTemplate>
                    <asp:Label ID="lblDocketID" runat="server" Text='<%#Eval("docket_id") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <asp:Label ID="lblAddDocketID" runat="server" Text='<%#Eval("docket_id") %>'></asp:Label>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="lblEditDocketID" runat="server" Text='<%#Eval("docket_id") %>'></asp:Label>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="claimant_name" UniqueName="claimant_name"
                DataField="claimant_name" HeaderText="Claimant" Resizable="true" HeaderStyle-Width="125">
                <ItemTemplate>
                    <asp:Label ID="lblClaimant" runat="server" Text='<%#Eval("claimant_name") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <asp:Label ID="lblAddClaimant" runat="server" Text='<%#Eval("claimant_name") %>'></asp:Label>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="lblEditClaimant" runat="server" Text='<%#Eval("claimant_name") %>'></asp:Label>
                </EditItemTemplate>
                <HeaderStyle Width="125px" />
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Docket_Date" UniqueName="Docket_Date"
                DataField="Docket_Date" HeaderText="Docket Dt" Resizable="true">
                <ItemTemplate>
                    <asp:Label ID="lblDocketDate" runat="server" Text='<%#Eval("Docket_Date", "{0:M/d/yyy}") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadDatePicker ID="dpAddDocketDate" runat="server" Width="90">
                    </telerik:RadDatePicker>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <telerik:RadDatePicker ID="dpEditDocketDate" runat="server" Width="90" DbSelectedDate='<%#Eval("Docket_Date") %>'>
                    </telerik:RadDatePicker>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="claim_num" UniqueName="claim_num" DataField="claim_num"
                HeaderText="JCN" Resizable="true">
                <ItemTemplate>
                    <asp:Label ID="lblJCN" runat="server" Text='<%#Eval("claim_num") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="txtAddJCN" runat="server" Text='<%#Eval("claim_num") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvCarrier" runat="server" ErrorMessage="Invalid Claim Number"
                        ControlToValidate="txtAddJCN" Display="Dynamic"></asp:RequiredFieldValidator>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtEditJCN" runat="server" Text='<%#Eval("claim_num") %>'></asp:TextBox>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Docket_Comment" UniqueName="Docket_Comment"
                DataField="PTDRB_Comment" HeaderText="Docket Comment" Resizable="true" Visible="false">
                <ItemTemplate>

                </ItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="txtAddDocketComment" runat="server"></asp:TextBox>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtEditDocketComment" runat="server"></asp:TextBox>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Docket_Status" UniqueName="Docket_Status"
                DataField="Docket_Status_Descr" HeaderText="Docket Status" Resizable="true" DataType="System.String"
                HeaderStyle-Width="175">
                <ItemTemplate>
                    <asp:Label ID="lblDocketStatus" runat="server" Text='<%#Eval("Docket_Status_Descr") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadComboBox ID="cboAddDocketStatus" EnableLoadOnDemand="true" DataTextField="Docket_Status_Descr"
                        AutoPostBack="true" DataValueField="Docket_Status_ID" runat="server" Width="250"
                        SelectionMode="Single" OnItemsRequested="cboAddDocketStatus_ItemsRequested">
                    </telerik:RadComboBox>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <telerik:RadComboBox ID="cboEditDocketStatus" EnableLoadOnDemand="true" DataTextField="Docket_Status_Descr"
                        AutoPostBack="true" DataValueField="Docket_Status_ID" Text='<%#Eval("Docket_Status_descr") %>'
                        runat="server" Width="250" SelectionMode="Single" DataCheckedField='<%#Eval("Docket_Status_id")  %>'
                        OnItemsRequested="cboAddDocketStatus_ItemsRequested">
                    </telerik:RadComboBox>
                </EditItemTemplate>
                <HeaderStyle Width="175px" />
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="accident_date" UniqueName="accident_date"
                DataField="accident_date" HeaderText="DOI" Resizable="true" ReadOnly="true">
                <ItemTemplate>
                    <asp:Label ID="lblInjuryDate" runat="server" Text='<%#Eval("accident_date", "{0:M/d/yyy}") %>'></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Claim_Admin" UniqueName="Claim_Admin"
                DataField="Claim_Admin" HeaderText="Claim Admin" Resizable="true" Visible="false"
                ReadOnly="true">
                <ItemTemplate>
                    <asp:Label ID="lblClaimAdmin" runat="server" Text='<%#Eval("Claim_Admin") %>'></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Carrier" UniqueName="Carrier" DataField="Carrier"
                HeaderText="Carrier" Resizable="true" Visible="false" ReadOnly="true">
                <ItemTemplate>
                    <asp:Label ID="lblCarrier" runat="server" Text='<%#Eval("Carrier") %>'></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Self_Insured" UniqueName="Self_Insured"
                DataField="Self_Insured" HeaderText="Self Insured" Resizable="true" Visible="false"
                ReadOnly="true">
                <ItemTemplate>
                    <asp:Label ID="lblSelfInsured" runat="server" Text='<%#Eval("Self_Insured") %>'></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Payment_Received" UniqueName="Payment_Received"
                DataField="Payment_Received" HeaderText="Payment Received" Resizable="true" DataType="System.String"
                Visible="false">
                <ItemTemplate>
                    <asp:Label ID="lblPaymentReceived" runat="server" Text='<%#Eval("Payment_Received_descr") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadComboBox ID="cboAddPaymentReceived" EnableLoadOnDemand="true" DataTextField="Payment_Received"
                        AutoPostBack="true" DataValueField="Payment_Received" runat="server" Width="50"
                        SelectionMode="Single" OnItemsRequested="cboAddPaymentReceived_ItemsRequested">
                    </telerik:RadComboBox>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <telerik:RadComboBox ID="cboEditPaymentReceived" EnableLoadOnDemand="true" DataTextField="Payment_Received"
                        AutoPostBack="true" DataValueField="Payment_Received" Text='<%#Eval("Payment_Received_descr")  %>'
                        runat="server" Width="50" SelectionMode="Single" DataCheckedField='<%#Eval("Payment_Received")  %>'
                        OnItemsRequested="cboAddPaymentReceived_ItemsRequested">
                    </telerik:RadComboBox>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Petition_Date" UniqueName="Petition_Date"
                DataField="Petition_Date" HeaderText="Petition Dt" Resizable="true">
                <ItemTemplate>
                    <asp:Label ID="lblPetitionDate" runat="server" Text='<%#Eval("Petition_Date", "{0:M/d/yyy}") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadDatePicker ID="dpAddPetitionDate" runat="server" Width="90">
                    </telerik:RadDatePicker>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <telerik:RadDatePicker ID="dpEditPetitionDate" runat="server" Width="90" DbSelectedDate='<%#Eval("Petition_Date") %>'>
                    </telerik:RadDatePicker>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Date_Received" UniqueName="Date_Received"
                DataField="Date_Received" HeaderText="Date Rec" Resizable="true">
                <ItemTemplate>
                    <asp:Label ID="lblDateReceived" runat="server" Text='<%#Eval("Date_Received", "{0:M/d/yyy}") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadDatePicker ID="dpAddDateReceived" runat="server" Width="90">
                    </telerik:RadDatePicker>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <telerik:RadDatePicker ID="dpEditDateReceived" runat="server" Width="90" DbSelectedDate='<%#Eval("Date_Received") %>'>
                    </telerik:RadDatePicker>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Remand" UniqueName="Remand" DataField="remanded_from_descr"
                HeaderText="Remanded From" Resizable="true" DataType="System.String" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="lblRemand" runat="server" Text='<%#Eval("remanded_from_descr") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadComboBox ID="cboAddRemand" EnableLoadOnDemand="true" DataTextField="remanded_from_descr"
                        AutoPostBack="true" DataValueField="Remanded_From_ID" runat="server" Width="70"
                        SelectionMode="Single" OnItemsRequested="cboAddRemand_ItemsRequested">
                    </telerik:RadComboBox>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <telerik:RadComboBox ID="cboEditRemand" EnableLoadOnDemand="true" DataTextField="remanded_from_descr"
                        AutoPostBack="true" DataValueField="Remanded_From_ID" Text='<%#Eval("remanded_from_descr")  %>'
                        runat="server" Width="70" SelectionMode="Single" OnItemsRequested="cboAddRemand_ItemsRequested"
                        DataCheckedField='<%#Eval("Remand_From_ID")  %>'>
                    </telerik:RadComboBox>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Remand_Date" UniqueName="Remand_Date"
                DataField="Remand_Date" HeaderText="Remand Date" Resizable="true" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="lblRemandDate" runat="server" Text='<%#Eval("Remand_Date", "{0:M/d/yyy}") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadDatePicker ID="dpAddRemandDate" runat="server" Width="90">
                    </telerik:RadDatePicker>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <telerik:RadDatePicker ID="dpEditRemandDate" runat="server" Width="90" DbSelectedDate='<% #Eval("Remand_Date") %>'>
                    </telerik:RadDatePicker>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Remand_Comment" UniqueName="Remand_Comment"
                DataField="Remand_Comment" HeaderText="Remand Comment" Resizable="true" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="lblRemandComment" runat="server" Text='<%#Eval("Remand_Comment") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="txtAddRemandComment" runat="server"></asp:TextBox>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtEditRemandComment" runat="server" Text='<%#Eval("Remand_Comment") %>'
                        AccessKey='<%#Eval("remand_comment_id") %>'></asp:TextBox>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Settlement_Date" UniqueName="Settlement_Date"
                DataField="Settlement_Date" HeaderText="Settlement Date" Resizable="true" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="lblSettlementDate" runat="server" Text='<%#Eval("Settlement_Date", "{0:M/d/yyy}") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadDatePicker ID="dpAddSettlementDate" runat="server" Width="90">
                    </telerik:RadDatePicker>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <telerik:RadDatePicker ID="dpEditSettlementDate" runat="server" Width="90" DbSelectedDate='<%#Eval("Settlement_Date") %>'>
                    </telerik:RadDatePicker>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn SortExpression="Settlement_Comment" UniqueName="Settlement_Comment"
                DataField="Settlement_Comment" HeaderText="Settlement Comment" Resizable="true"
                Visible="false">
                <ItemTemplate>
                    <asp:Label ID="lblSettlementComment" runat="server" Text='<%#Eval("Settlement_Comment") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="txtAddSettlementComment" runat="server"></asp:TextBox>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtEditSettlementComment" runat="server" Text='<%#Eval("Settlement_Comment") %>'
                        AccessKey='<%#Eval("settlement_comment_id") %>'></asp:TextBox>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn UniqueName="DocketHistory" HeaderText="Docket">
                <ItemTemplate>
                    <asp:Button ID="btnHistory" runat="server" Text="History" CommandName="DocketHistory" />
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
        <EditFormSettings ColumnNumber="3" CaptionFormatString="Edit details for Admin Claim Num: {0}"
            CaptionDataField="claim_num">
            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
            </EditColumn>
            <FormTableStyle GridLines="Horizontal" CellPadding="2" CellSpacing="0" Height="110px">
            </FormTableStyle>
            <FormMainTableStyle GridLines="None" CellPadding="3" CellSpacing="0" Width="100%">
            </FormMainTableStyle>
            <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
            <FormTableItemStyle Wrap="False"></FormTableItemStyle>
            <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
            <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
        </EditFormSettings>
        <HeaderStyle Wrap="False" />
    </MasterTableView>
    <ClientSettings ReorderColumnsOnClient="True" AllowColumnsReorder="True" Selecting-AllowRowSelect="false">
        <Selecting AllowRowSelect="True"></Selecting>
        <Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True"
            ResizeGridOnColumnResize="False"></Resizing>
    </ClientSettings>
    <GroupingSettings ShowUnGroupButton="false"></GroupingSettings>
    <FilterMenu EnableImageSprites="False">
    </FilterMenu>
</telerik:RadGrid>
</asp:Panel>

这是我背后的代码:

    public void LoadTabs(GridNestedViewItem viewitem)
    {
            //Find the first panel in the outer grid
            //Panel panel = ((GridNestedViewItem)item.ChildItem).FindControl("InnerContainer") as Panel;
            Panel panel = viewitem.FindControl("InnerContainer") as Panel;
            GridDataItem item = viewitem.ParentItem;

            if (panel != null)
            {

                //item.GetDataKeyValue("claim_num");
                //item.GetDataKeyValue("docket_id");

                //string s = item["docket_id"].ToString();

                ////Admin Claim Number
                //Label lblJCN = (Label)item["claim_num"].FindControl("lblJCN");

                //Label lblJCN = ((DataRowView)item.DataItem).Row["docket_id"].ToString();

                //string claim_num = ((DataRowView)item.DataItem).Row["claim_num"].ToString(); 

                string claim_num = item.GetDataKeyValue("claim_num").ToString();
                string docket_id = item.GetDataKeyValue("docket_id").ToString();

                //Docket ID
               // Label lblDocketID = (Label)item["docket_id"].FindControl("lblDocketID");

                //int docket_id = Convert.ToInt32(lblDocketID.Text);

                //string docket_id = ((DataRowView)item.DataItem).Row["docket_id"].ToString();

                Dictionary<string, string> paramValues = new Dictionary<string, string>();

                paramValues.Add("claim_num", claim_num);
                paramValues.Add("docket_id", docket_id.ToString());
                paramValues.Add("comment_type_id", "3");


                BaseUserControl ucFC = (BaseUserControl)LoadControl("UserControls\\UCFullClaim.ascx");
                Panel pFullClaim = Utility.FindControlRecursive(panel, "pFullClaim") as Panel;

                ucFC.ParamsValue = new Hashtable(paramValues);
                ucFC.LoadDataSet();
                pFullClaim.Controls.Add(ucFC);

                BaseUserControl ucRH = (BaseUserControl)LoadControl("UserControls\\UCRemandHistory.ascx");
                Panel pRemandHistory = Utility.FindControlRecursive(panel, "pRemandHistory") as Panel;


                ucRH.ParamsValue = new Hashtable(paramValues);
                ucRH.LoadDataSet();
                ucRH.ID = "ucRH";
                pRemandHistory.Controls.Add(ucRH);

                BaseUserControl ucDC = (BaseUserControl)LoadControl("UserControls\\UCComments.ascx");
                Panel pDocketComments = Utility.FindControlRecursive(panel, "pDocketComments") as Panel;

                ucDC.ParamsValue = new Hashtable(paramValues);
                ucDC.LoadDataSet();
                pDocketComments.Controls.Add(ucDC);
            }

        }



    protected void gdDocket_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridNestedViewItem)
        {
            LoadTabs(e.Item as GridNestedViewItem);
        }
    }
4

1 回答 1

0

没关系,我发现了我的问题。我没有绑定我的详细信息视图的数据源

于 2013-03-11T15:15:35.933 回答