我有一个使用 RadGrid 控件来显示数据的 asp.net 应用程序(由以前的开发人员创建)。但是,如果页面上有 ,则 RadGrid 不会显示数据。删除 UpdatePanel 后,radGrid 工作正常。如果我删除更新面板,那么 RadCombobox 会提交整个页面(而不是使用 Ajax)。
有没有办法让 radGrid 一起工作?
<asp:UpdatePanel ID="upnlFilter" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<span class="subHeader">VTRIP Log Search: </span>
<asp:Panel ID="Panel1" runat="server" BorderColor="#E3B391" BorderStyle="Solid"
BorderWidth="1" Width="994px">
<div style="height:10px; width:994px">
</div>
<table style="width: 974px; margin: 10px" border="0">
<tr>
<td width="200px">
<telerik:RadComboBox ID="DriverDD" runat="server" Height="120px" Width="180px"
DropDownWidth="180px" EmptyMessage="Choose a Driver"
HighlightTemplatedItems="true" AutoPostBack="true"
AppendDataBoundItems="true"
onselectedindexchanged="DriverDD_SelectedIndexChanged" >
</telerik:RadComboBox>
</td>
<td width="220px">
<asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="txtDOS"
WatermarkText="Select today or any previous day" WatermarkCssClass="watermarked">
</asp:TextBoxWatermarkExtender>
<asp:TextBox ID="txtDOS" runat="server" Width="200px" EnableViewState="true" CssClass="SetTextbox"
Height="20px" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox>
<asp:CalendarExtender ID="txtDOS_CalendarExtender" runat="server" Enabled="True"
TargetControlID="txtDOS">
</asp:CalendarExtender>
</td>
<td style="width:350px"> </td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<br/>
<telerik:RadGrid ID="RadGrid1" OnSortCommand="RadGrid1_SortCommand"
OnPageIndexChanged="RadGrid1_PageIndexChanged"
Width="99%" Height="181px" OnPageSizeChanged="RadGrid1_PageSizeChanged" AllowSorting="True"
PageSize="5" AllowPaging="True" AllowMultiRowSelection="True" runat="server"
GridLines="None" AutoGenerateColumns="False">
<MasterTableView Height="100px" Width="100%" Summary="RadGrid table">
<CommandItemSettings ExportToPdfText="Export to PDF" />
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"
Visible="True">
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"
Visible="True">
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="TripId" HeaderText="Trip ID" SortExpression="TripID"
UniqueName="TripID"
SortAscImageUrl="SortAsc.gif" SortDescImageUrl="SortDesc.gif">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="MemberName" HeaderText="Member Name" SortExpression="MemberName"
UniqueName="MemberName"
SortAscImageUrl="SortAsc.gif" SortDescImageUrl="SortDesc.gif">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="VehicleType" HeaderText="Vehicle Type" SortExpression="VehicleType"
UniqueName="VehicleType"
SortAscImageUrl="SortAsc.gif" SortDescImageUrl="SortDesc.gif">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Status" HeaderText="Status" SortExpression="Status"
UniqueName="Status"
SortAscImageUrl="SortAsc.gif" SortDescImageUrl="SortDesc.gif">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
<PagerStyle PageSizeControlType="RadComboBox" />
</MasterTableView>
<PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
<FilterMenu EnableImageSprites="False">
</FilterMenu>
</telerik:RadGrid>
后面的代码:(使用Grid - Simple Data Binding填充网格)
private void LoadData()
{
if (Session["TripMaster"] != null)
{
RadGrid1.DataSource = Session["TripMaster"];
RadGrid1.DataBind();
}
}