【问题标题】:Assigning Datatable as datasource to RADGrid with different data types将 Datatable 作为数据源分配给具有不同数据类型的 RADGrid
【发布时间】:2011-10-28 21:06:41
【问题描述】:

我需要分配一个数据表作为 Telerik RADGrid 的数据源。数据表具有字符串、int、bool 等数据类型,而 radgrid 列具有不同类型(超链接、图像等)

我只需要使用数据表中的字符串值来构建超链接列。你能建议我可以使用哪个事件来做到这一点吗?当我将数据表作为数据源分配给网格时,它假定网格列数据类型与源数据类型相同......我说的对吗??

【问题讨论】:

    标签: asp.net telerik radgrid telerik-grid


    【解决方案1】:

    查看<telerik:GridHyperLinkColumn />DataNavigateUrlFieldsDataNavigateUrlFormatStringDataTextFieldDataTextFormatString 属性。您应该能够执行以下操作:

    <telerik:GridHyperLinkColumn
        DataNavigateUrlFields="categoryId,productId"
        DataNavigateUrlFormatString="productDetail.aspx?category={0}&product={1}"
        DataTextField="productName"
        DataTextFormatString="View {0} details" />
    

    【讨论】:

      【解决方案2】:

      您需要使用GridBoundColumnGridTemplateColumn。有一个 DataType 属性,但您不需要它。

      <telerik:GridBoundColumn HeaderText="Foo" DataField="Foo" DataType="System.String" ...>
      

      【讨论】:

        猜你喜欢
        • 2012-04-05
        • 1970-01-01
        • 2012-08-24
        • 1970-01-01
        • 2021-05-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多