1

我对RadGridView有一个简单的问题

标题列与行中的列不匹配。贝娄我添加了 RadGridVew 的图像。 RadGridView 的图像

这是RadGridview的代码:

<telerik:RadGrid ID="RadGrid_othrexp" AllowSorting="true" runat="server"  OnUpdateCommand="RadGrid_othrexp_UpdateCommand"
            OnNeedDataSource="RadGrid_othrexp_NeedDataSource" AutoGenerateColumns="False">
            <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="375px" />
            </ClientSettings>
            <MasterTableView EnableColumnsViewState="false" DataKeyNames="ID" AutoGenerateColumns="false">
                <CommandItemSettings ExportToPdfText="Export to PDF" />
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                </RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                        HeaderText="Order Date" UniqueName="TemplateColumn1">
                        <ItemTemplate>
                            <%# Eval("DateOrdered")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txt_OtherDateOrder" runat="server" Text='<%# Eval("DateOrdered")%>'></asp:TextBox>
                            <asp:CalendarExtender ID="CalendarEx1" runat="server" TargetControlID="txt_OtherDateOrder">
                            </asp:CalendarExtender>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                        HeaderText="Required Date" UniqueName="TemplateColumn2">
                        <ItemTemplate>
                            <%# Eval("DateRequired")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txt_OtherDateRequired" runat="server" Text='<%# Eval("DateRequired")%>'></asp:TextBox>
                            <asp:CalendarExtender ID="CalendarEx2" runat="server" TargetControlID="txt_OtherDateRequired">
                            </asp:CalendarExtender>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                        HeaderText="Company" UniqueName="TemplateColumn3">
                        <ItemTemplate>
                            <%# Eval("CompanyName")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:cnknoll %>"
                                SelectCommand="select * from  v_EW_Vendors" runat="server"></asp:SqlDataSource>
                            <telerik:RadComboBox ID="Combo_OtherCompany" SelectedValue='<%# Eval("company_recid")%>' runat="server" ProviderName="System.Data.SqlClient"
                                DataSourceID="SqlDataSource1" DataTextField="CompanyName" DataValueField="RecId">
                            </telerik:RadComboBox>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                        HeaderText="Description" UniqueName="TemplateColumn4">
                        <ItemTemplate>
                            <%# Eval("LineDesc")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txt_OtherLineDesc" runat="server" Text='<%# Eval("LineDesc")%>'></asp:TextBox>
                            <asp:RequiredFieldValidator ID="rfv_OtherLineDesc" runat="server" CssClass="validation-error"
                                SetFocusOnError="true" ControlToValidate="txt_OtherLineDesc" ErrorMessage="Description Required"
                                ForeColor="Red" />
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                        HeaderText="Quantity" UniqueName="TemplateColumn5">
                        <ItemTemplate> 
                         <%# String.Format("{0:n0}", Eval("LineQty"))%>

                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txt_OtherLineQty" runat="server" Text='<%# String.Format("{0:n0}", Eval("LineQty"))%>'></asp:TextBox>
                           <%-- <asp:FilteredTextBoxExtender ID="fte_OtherLineQty" runat="server" Enabled="True"
                                TargetControlID="txt_OtherLineQty" ValidChars="0123456789" FilterType="Custom"
                                FilterMode="ValidChars">
                            </asp:FilteredTextBoxExtender>--%>
                            <asp:RequiredFieldValidator ID="rfv_OtherLineQty" runat="server" CssClass="validation-error"
                                SetFocusOnError="true" ControlToValidate="txt_OtherLineQty" ErrorMessage="Quantity Required"
                                ForeColor="Red" />
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                        HeaderText="Unit Price" UniqueName="TemplateColumn6">
                        <ItemTemplate> 
                        <%# String.Format("{0:C3}", Eval("UnitPrice"))%>

                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txt_OtherUnitPrice" runat="server" Text='<%# Eval("UnitPrice")%>'></asp:TextBox>
                           <%-- <asp:FilteredTextBoxExtender ID="fte_OtherUnitPrice" runat="server" Enabled="True"
                                TargetControlID="txt_OtherUnitPrice" ValidChars="0123456789" FilterType="Custom"
                                FilterMode="ValidChars">
                            </asp:FilteredTextBoxExtender>--%>
                            <asp:RequiredFieldValidator ID="rfv_OtherUnitPrice" runat="server" CssClass="validation-error"
                                SetFocusOnError="true" ControlToValidate="txt_OtherUnitPrice" ErrorMessage="Unit Price Required"
                                ForeColor="Red" />
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                        HeaderText="Total(USD)" UniqueName="TemplateColumn7">
                        <ItemTemplate>
                            <%# String.Format("{0:C3}", Eval("Total_Price"))%>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                        HeaderText="PO #" UniqueName="TemplateColumn8">
                        <ItemTemplate>
                            <%# String.Format("{0:C3}", Eval("PO_Number"))%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txt_OtherPO_Number" runat="server" Text='<%# Eval("PO_Number")%>'></asp:TextBox>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
        </telerik:RadGrid>

期待您的回复谢谢。

4

1 回答 1

0

只需将宽度添加到 100%,如下所示。希望它能解决你的问题

于 2013-03-25T07:34:24.503 回答