如何将四边网格视图更改为显示角半径?

huangapple go评论67阅读模式
英文:

How to change 4 sides grid view to display corner radius?

问题

我在asp.net web forms上工作。我遇到问题,无法更改网格视图的标题以使其在四个边角上拥有圆角。

因此,我需要获取标题样式并将其作为CSS样式或引导样式应用到网格视图,以便在四个边角获得圆角
左上 - 右上 - 左下 - 右下

确切地说,我需要在每一边上获得相同的圆角

以下是网格视图组件:

<asp:GridView ID="GridViewSearchData" runat="server" AutoGenerateColumns="false" DataKeyNames="ID" CssClass="table" HeaderStyle-BackColor="#172b4d" AllowPaging="true" OnPageIndexChanging="grdData_PageIndexChanging" PageSize="10">
    <Columns>
        <asp:TemplateField HeaderText="Select All" ItemStyle-HorizontalAlign="Center">
            <asp:BoundField DataField="BranchCode" HeaderText="BranchCode" HeaderStyle-ForeColor="White" />
            <asp:BoundField DataField="Status" HeaderText="Status" HeaderStyle-ForeColor="White" />
            <asp:BoundField DataField="OrderNo" HeaderText="OrderNo" ItemStyle-Width="120px" HeaderStyle-ForeColor="White" />
            <asp:BoundField DataField="OrderType" HeaderText="OrderType" HeaderStyle-ForeColor="White" />
            <asp:BoundField DataField="Printer_name" HeaderText="Printer_name" HeaderStyle-ForeColor="White" />
            <asp:BoundField DataField="EntredDatetime" HeaderText="EntredDatetime" HeaderStyle-ForeColor="White" />
            <asp:BoundField DataField="Id" HeaderText="Id" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" />
        </Columns>
</asp:GridView>

期望的结果如下:
如何将四边网格视图更改为显示角半径?

英文:

I work on asp.net web forms . I face issue i can't change header of grid view to take corner radius on 4 sides .

so I need to get header style and give it as CSS style or bootstrap to grid view to be get corner side radius on 4 sides
top left - top right -bottom left-bottom right

exactly I need to get same corner on every side

grid view component as below :

&lt;asp:GridView ID=&quot;GridViewSearchData&quot; runat=&quot;server&quot; AutoGenerateColumns=&quot;false&quot; DataKeyNames=&quot;ID&quot; CssClass=&quot;table&quot;  HeaderStyle-BackColor=&quot;#172b4d&quot;   AllowPaging=&quot;true&quot; OnPageIndexChanging=&quot;grdData_PageIndexChanging&quot; PageSize=&quot;10&quot;&gt;
    &lt;Columns&gt;
    &lt;asp:TemplateField HeaderText=&quot;Select All&quot; ItemStyle-HorizontalAlign=&quot;Center&quot;&gt;
    &lt;asp:BoundField DataField=&quot;BranchCode&quot; HeaderText=&quot;BranchCode&quot; HeaderStyle-ForeColor=&quot;White&quot; /&gt;
    &lt;asp:BoundField DataField=&quot;Status&quot; HeaderText=&quot;Status&quot; HeaderStyle-ForeColor=&quot;White&quot;  /&gt;
    &lt;asp:BoundField DataField=&quot;OrderNo&quot; HeaderText=&quot;OrderNo&quot; ItemStyle-Width=&quot;120px&quot; HeaderStyle-ForeColor=&quot;White&quot;  /&gt;
    &lt;asp:BoundField DataField=&quot;OrderType&quot; HeaderText=&quot;OrderType&quot; HeaderStyle-ForeColor=&quot;White&quot;  /&gt;
    &lt;asp:BoundField DataField=&quot;Printer_name&quot; HeaderText=&quot;Printer_name&quot; HeaderStyle-ForeColor=&quot;White&quot;  /&gt;
    &lt;asp:BoundField DataField=&quot;EntredDatetime&quot; HeaderText=&quot;EntredDatetime&quot; HeaderStyle-ForeColor=&quot;White&quot;  /&gt;                            
    &lt;asp:BoundField DataField=&quot;Id&quot; HeaderText=&quot;Id&quot; ItemStyle-CssClass=&quot;hidden&quot;  HeaderStyle-CssClass=&quot;hidden&quot;  /&gt;
       
    &lt;/Columns&gt;
&lt;/asp:GridView&gt;

expected result as below :
如何将四边网格视图更改为显示角半径?

答案1

得分: 0

我通过以下步骤解决了我的问题:

1- 我添加了如下的CSS类:

.corners {
  border: 0px solid blue;
  -moz-border-radius: 8px;
  border-radius: 8px;
  overflow: hidden;
  -webkit-border-radius: 8px;
}

2- 添加包含网格视图的div

3- 通过以下CSS将类分配给包含网格视图的div:

&lt;div class=&quot;corners&quot;&gt;
  &lt;asp:GridView ID=&quot;GridViewSearchData&quot; runat=&quot;server&quot; AutoGenerateColumns=&quot;false&quot; DataKeyNames=&quot;ID&quot; CssClass=&quot;table&quot;  HeaderStyle-BackColor=&quot;#172b4d&quot; HeaderStyle-CssClass=&quot;header&quot;   AllowPaging=&quot;true&quot; OnPageIndexChanging=&quot;grdData_PageIndexChanging&quot; PageSize=&quot;10&quot; &gt;                           

  &lt;/asp:GridView&gt;
&lt;/div&gt;

现在它可以正常工作。

英文:

I solved my issue by this steps :

1- I add CSS class as below :

.corners {
  border: 0px solid blue;
  -moz-border-radius: 8px;
  border-radius: 8px;
  overflow: hidden;
  -webkit-border-radius: 8px;
}

2- Add div contain grid view

3- Assign class to div contain grid view by CSS as below :

&lt;div class=&quot;corners&quot;&gt;
  &lt;asp:GridView ID=&quot;GridViewSearchData&quot; runat=&quot;server&quot; AutoGenerateColumns=&quot;false&quot; DataKeyNames=&quot;ID&quot; CssClass=&quot;table&quot;  HeaderStyle-BackColor=&quot;#172b4d&quot; HeaderStyle-CssClass=&quot;header&quot;   AllowPaging=&quot;true&quot; OnPageIndexChanging=&quot;grdData_PageIndexChanging&quot; PageSize=&quot;10&quot; &gt;                           
  &lt;/asp:GridView&gt;
&lt;/div&gt;

And it is working.

huangapple
  • 本文由 发表于 2023年3月3日 23:28:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/75628992.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定