在GridTemplateColumn:
之前看起来像这样
添加GridTemplateColumn后
<telerik:GridTemplateColumn HeaderText="Name" HeaderStyle-Width="250" FilterControlWidth="250">
<ItemTemplate>
<asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#" Text='<%# Eval("Name") %>'></asp:HyperLink>
</ItemTemplate>
</telerik:GridTemplateColumn>
我的RadGrid:
<telerik:RadGrid HorizontalAlign="Center" PageSize="50" ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" CellSpacing="0" AllowFilteringByColumn="false" Skin="Forest" DataSourceID="SqlDataSourceUyeAday" Height="400px" Width="100%" AutoGenerateColumns="False">
<ClientSettings>
<Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
</ClientSettings>
<MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSourceUyeAday">
<Columns>
<telerik:GridBoundColumn ItemStyle-CssClass="iceri" DataField="Id" ItemStyle-Width="50" HeaderStyle-Width="50" FilterControlWidth="50" FilterControlAltText="Filter Id column" HeaderText="Id" SortExpression="Id" UniqueName="AdayId">
<ColumnValidationSettings>
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="FirstName" SortExpression="FirstName" DataField="FirstName" UniqueName="FirstName" FilterControlAltText="Filter FirstName column" HeaderStyle-Width="250" FilterControlWidth="250">
<ItemTemplate>
<asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#" Text='<%# Eval("FirstName") %>'></asp:HyperLink>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridDateTimeColumn DataField="Date" HeaderStyle-CssClass="iceriTarih" ItemStyle-CssClass="iceriTarih" FilterControlAltText="Filter Datecolumn" PickerType="DatePicker" DataFormatString="{0:dd/MM/yyyy}" HeaderText="Date" SortExpression="Date" UniqueName="Date" DataType="System.DateTime" ItemStyle-Width="150" HeaderStyle-Width="150" FilterControlWidth="100">
<ColumnValidationSettings>
</ColumnValidationSettings>
</telerik:GridDateTimeColumn>
</Columns>
<EditFormSettings>
<EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">
</EditColumn>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
可能是什么原因?
答案 0 :(得分:11)
显然,这是必需的。
<appSettings>
<add key="vs:EnableBrowserLink" value="false"/>
</appSettings>
答案 1 :(得分:0)
您的代码似乎很好。您正在使用&#39;姓名&#39;作为UniqueName和DataField。 &#39;名称&#39;是一个保留字,也许这就是你看到意外行为的原因。尝试使用其他名称,例如&#39; FirstName&#39;或者&#39;姓氏&#39;
答案 2 :(得分:0)
<telerik:GridTemplateColumn HeaderText="Status" HeaderStyle-Width="10%" ItemStyle-Width="10%"
HeaderStyle-Font-Bold="true" UniqueName="Status" DataField='MstUserDefineCode.Code'>
<ItemTemplate>
<asp:Label ID="LabelStatus" runat="server" Text='<%# Eval("ProjectStatus") %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
您可以像上面代码一样使用模板列