ASP.NET CommandField & Skin
-
20-09-2019 - |
문제
나는 Skin Asp.net GridView Commandfield에 묶고 있습니다. 사령부 속성 선언을 페이지에서 스킨 파일로 옮길 때만 잘 작동하면 전체 Commandfield 속성이 무시됩니다. 여기 내 피부 파일이 있습니다.
<asp:GridView
AllowPaging="true"
AllowSorting="false"
AutoGenerateEditButton="false"
AutoGenerateDeleteButton="false"
AutoGenerateSelectButton="false"
AutoGenerateColumns="false"
GridLines="None"
PageSize="20"
ShowFooter="false"
ShowHeader="true"
runat="server">
<Columns>
<asp:CommandField
ButtonType="Image"
ControlStyle-Width="25"
EditImageUrl="Images/Icons/pencil.png"
DeleteImageUrl="Images/Icons/cross.png"
/>
</Columns>
</asp:GridView>
web.config에서는 스타일 시트 만 적용합니다. 뭔가 놓친거야?
감사
해결책
이것은 테마가 아닌 스타일 시트 테마를 사용하여 달성 할 수 있습니다.
다음은 .skin 파일에 정의 된 제어 스타일입니다.
<asp:GridView runat="server" Font-Names="verdana,arial,sans serif" AllowSorting="True" AllowPaging="True" AutoGenerateColumns="False" Width="95%">
<Columns>
<asp:CommandField ButtonType="Image" CancelImageUrl="~/Images/Buttons/16x16/Cancel.gif"
EditImageUrl="~/Images/Buttons/16x16/Edit.gif" ShowEditButton="True" InsertImageUrl="~/Images/Buttons/16x16/New.gif" UpdateImageUrl="~/Images/Buttons/16x16/Update.gif" />
<asp:CommandField ButtonType="Image" DeleteImageUrl="~/Images/Buttons/16x16/Delete.gif"
ShowDeleteButton="True" />
</Columns>
<RowStyle Font-Size="Smaller" ForeColor="Black" />
<PagerStyle Font-Size="Smaller" ForeColor="Black" />
<SelectedRowStyle BackColor="Yellow" />
<HeaderStyle BackColor="#2D5C3D" Font-Size="Smaller" ForeColor="White" HorizontalAlign="left" />
<FooterStyle BackColor="#2D5C3D" />
<EditRowStyle BackColor="#2D5C3D" />
<AlternatingRowStyle BackColor="#ECE9D8" />
web.config 파일은 스타일 시트를 사이트 레벨로 정의합니다
<pages styleSheetTheme="Green" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
그리드 뷰 컨트롤이 포함 된 .aspx 페이지
<asp:GridView ID="gvUser" runat="server" AutoGenerateColumns="False"
DataKeyNames="Id" onpageindexchanged="gvUser_PageIndexChanged"
onpageindexchanging="gvUser_PageIndexChanging"
onrowcancelingedit="gvUser_RowCancelingEdit" onrowdeleting="gvUser_RowDeleting"
onrowediting="gvUser_RowEditing" onrowupdating="gvUser_RowUpdating"
onselectedindexchanging="gvUser_SelectedIndexChanging" onsorted="gvUser_Sorted"
onsorting="gvUser_Sorting">
<Columns>
<asp:BoundField DataField="Id" HeaderText="User Id" >
<HeaderStyle HorizontalAlign="Right" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Right" VerticalAlign="Middle" />
</asp:BoundField>
</Columns>
</asp:GridView>
세부 사항은 다음을 참조하십시오
도움이 되었기를 바랍니다!
다른 팁
나는 얻다:
문자의 내용
<asp:CommandField
ButtonType="Image"
ShowDeleteButton="true"
ItemStyle-Width="25"
DeleteImageUrl="~/App_Themes/SimplaAdmin/Images/Icons/cross.png"
/>
스킨 파일 내에서 허용되지 않습니다.
사용하려면 a fontawesome 아이콘, 당신은 그것을 변경할 수 있습니다.
<asp:CommandField ButtonType="Link" ShowEditButton="true"
EditText="<i class='fas fa-edit'></i>" />
삭제 사용 :
DeleteText="<i class='fas fa-trash-alt'></i>"
Canel 사용 :
CancelText="<i class='fas fa-window-close'></i>"
업데이트 사용 :
UpdateText="<i class='fas fa-sync'></i>"
GridView 태그 외부에서 CommandField 태그를 이동하면 어떻게됩니까?
즉:
<asp:GridView
AllowPaging="true"
AllowSorting="false"
AutoGenerateEditButton="false"
AutoGenerateDeleteButton="false"
AutoGenerateSelectButton="false"
AutoGenerateColumns="false"
GridLines="None"
PageSize="20"
ShowFooter="false"
ShowHeader="true"
runat="server">
</asp:GridView>
<asp:CommandField
ButtonType="Image"
ControlStyle-Width="25"
EditImageUrl="Images/Icons/pencil.png"
DeleteImageUrl="Images/Icons/cross.png"
/>
제휴하지 않습니다 StackOverflow