Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何控制radgrid的宽度_C#_Asp.net_Radgrid - Fatal编程技术网

C# 如何控制radgrid的宽度

C# 如何控制radgrid的宽度,c#,asp.net,radgrid,C#,Asp.net,Radgrid,我有一个RadGrid,但它跨越了整个页面的宽度,如果需要,我如何控制它并在单元格中设置宽度和mae内容?。我找不到任何对我有帮助的东西。我尝试了MasterTableView TableLayout=“fix”,但随后单元格中的任何内容都被切断。任何帮助都将不胜感激: <RadGrid:CustomRadGrid ID="DetailsGrid" runat="server" AutoGenerateColumns="False" ShowFooter="True" OnNeedDa

我有一个RadGrid,但它跨越了整个页面的宽度,如果需要,我如何控制它并在单元格中设置宽度和mae内容?。我找不到任何对我有帮助的东西。我尝试了MasterTableView TableLayout=“fix”,但随后单元格中的任何内容都被切断。任何帮助都将不胜感激:

 <RadGrid:CustomRadGrid ID="DetailsGrid" runat="server" AutoGenerateColumns="False"
 ShowFooter="True" OnNeedDataSource="DetailsGrid_NeedDataSource" OnItemDataBound="DetailsGrid_ItemDataBound"
OnItemCreated="DetailsGrid_ItemCreated" 
OnItemCommand="DetailsGrid_ItemCommand"
GridLines="None" AllowFilteringByColumn="True" 
AllowPaging="True" 
AllowSorting="True"
AllowMultiRowSelection="true">


这是一个自定义网格

使用主
RadGrid
标记中的
Width
属性。单元格中的内容将自动换行。您可能还必须设置各个列的宽度,以获得适当的外观。“自动列宽”并不总是按照您的要求换行。

对于“RadGrid width”,您只需要设置网格的宽度

<telerik:RadAjaxPanel ID="RadAjaxPanel" runat="server">
    <telerik:RadGrid ID="ViewLogsGrid" FilterType="Combined"
            runat="server"
            AllowFilteringByColumn="true"                
            PageSize="50"
            ShowStatusBar="true"
            AllowPaging="True"
            AllowSorting="True"

            Width="1250px"

            AllowFiltering="True"
            AutoGenerateColumns="false"
            GridLines="None"
            CellSpacing="0">

    </telerik:RadGrid>
</telerik:RadAjaxPanel>

网格内的列将根据需要进行调整,但如果需要固定列宽,请执行以下操作(Telerik不建议这样做)



当你把它放在RadGrid标签上时发生了什么?我在我的网格上完全做到了这一点,它成功了。也许OP正在使用一个自定义网格?当我这样做时什么也不会发生。是的,这是一个自定义网格-不是我创建的。在这种情况下,不幸的是,你必须查看网格的源代码,看看它对宽度做了什么,以及是否有任何方法来设置它。您可能需要修改自定义栅格控件类以允许指定宽度。
<telerik:RadGrid ID="ViewLogsGrid" ... ... >

   <MasterTableView TableLayout="Fixed">
      <Columns>
        <telerik:GridBoundColumn DataField="Comments" HeaderText="Comments" SortExpression="Comments"    UniqueName="Comments">

           <HeaderStyle Width="150px" />

        </telerik:GridBoundColumn>
      </Columns>
   </MasterTableView>

</telerik:RadGrid>