Note that there are some explanatory texts on larger screens.

plurals
  1. POApply stylesheet to gridview templatefields
    primarykey
    data
    text
    <p>I have this gridview and I'd like to apply some stylesheet settings to the validators within the gridview. Here's how my GV is setup:</p> <pre><code>&lt;table class="table"&gt; &lt;tr&gt; &lt;td align="center" colspan="4"&gt; &lt;cc1:GroupedGridView ID="grpgrdHeatPumpSPF" runat="server" BackColor="White" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" CellSpacing="2" Width="650" GroupingDepth="3" AutoGenerateColumns="false" PageSize="20" AllowPaging="true" DataKeyNames="HeatPumpID" OnPageIndexChanging="grpgrdHeatPumpSPF_PageIndexChanging" OnRowCancelingEdit="grpgrdHeatPumpSPF_RowCancelingEdit" OnRowEditing="grpgrdHeatPumpSPF_RowEditing" OnRowUpdating="grpgrdHeatPumpSPF_RowUpdating" &gt; &lt;HeaderStyle BackColor="#86C708" Font-Bold="True" ForeColor="White" HorizontalAlign="Left"&gt;&lt;/HeaderStyle&gt; &lt;FooterStyle BackColor="White" ForeColor="#000066"&gt;&lt;/FooterStyle&gt; &lt;RowStyle BackColor="White" ForeColor="#333333" HorizontalAlign="Left"&gt;&lt;/RowStyle&gt; &lt;EditRowStyle BackColor="#cde686" /&gt; &lt;SelectedRowStyle BackColor="#FCADAD" ForeColor="Black" Font-Bold="true" /&gt; &lt;AlternatingRowStyle ForeColor="#284775" /&gt; &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Left"&gt;&lt;/PagerStyle&gt; &lt;PagerSettings Mode="NumericFirstLast" /&gt; &lt;EmptyDataRowStyle CssClass="Label_Small_Bold" ForeColor="#C00000" HorizontalAlign="Center" /&gt; &lt;Columns&gt; &lt;asp:ButtonField CommandName="Select" Visible="false" /&gt; &lt;asp:BoundField DataField="HeatPumpID" HeaderText="HeatPumpID" Visible="False" ReadOnly="True" &gt; &lt;HeaderStyle HorizontalAlign="Left" /&gt; &lt;/asp:BoundField&gt; &lt;asp:BoundField DataField="ModelNumber" HeaderText="Model Number" Visible="True" ReadOnly="True" &gt; &lt;HeaderStyle HorizontalAlign="Left" /&gt; &lt;/asp:BoundField&gt; &lt;asp:TemplateField HeaderText="FlowTemp"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblFlowTemp" runat="server" Text='&lt;%# Bind("FlowTemp") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;ControlStyle CssClass="Input_Text_Int" /&gt; &lt;HeaderStyle HorizontalAlign="Left" /&gt; &lt;ItemStyle VerticalAlign="Top" /&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField HeaderText="Heating"&gt; &lt;EditItemTemplate&gt; &lt;asp:TextBox ID="txtSPFHeating" runat="server" Text='&lt;%# Bind("SPFHeating") %&gt;' CssClass="Input_Text_Int"&gt;&lt;/asp:TextBox&gt; &lt;asp:RequiredFieldValidator Display="Dynamic" CssClass="validateGridView" ID="validateBTSPFHeating" runat="server" ErrorMessage="Please enter SPFHeating (e.g. 3.3)" ControlToValidate="txtSPFHeating"&gt;&lt;/asp:RequiredFieldValidator&gt; &lt;asp:RegularExpressionValidator ID="regExpSPFHeating" runat="server" ControlToValidate="txtSPFHeating" CssClass="validateGridView" ErrorMessage="Invalid SPFHeating (e.g. 3.3)" ValidationExpression="\d+(\.\d)" Display="Dynamic" SetFocusOnError="True"&gt;&lt;/asp:RegularExpressionValidator&gt; &lt;/EditItemTemplate&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblSPFHeating" runat="server" Text='&lt;%# Bind("SPFHeating") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;ControlStyle CssClass="Input_Text_Int" /&gt; &lt;HeaderStyle HorizontalAlign="Left" /&gt; &lt;ItemStyle VerticalAlign="Top" /&gt; &lt;/asp:TemplateField&gt; &lt;asp:CommandField ButtonType="Button" ShowEditButton="True" ValidationGroup="vgEdit"&gt; &lt;ControlStyle CssClass="Button_XSmall" /&gt; &lt;/asp:CommandField&gt; &lt;asp:TemplateField ShowHeader="False"&gt; &lt;ItemTemplate&gt; &lt;asp:Button ID="btnDeleteHeatPumpSPF" CommandArgument='&lt;%# Eval("HeatPumpID","") + ";" + Eval("FlowTemp","") %&gt;' runat="server" OnClientClick="return ConfirmDeletion();" CausesValidation="false" CommandName="DeletePart" Text="Delete" OnClick="btnDeleteHeatPumpSPF_Click" /&gt; &lt;/ItemTemplate&gt; &lt;ControlStyle CssClass="Label_Small" /&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/cc1:GroupedGridView&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>and my CSS is as follows:</p> <pre><code>table td { padding: 2px; } table.center { width:90%; margin-left:5%; margin-right:5%; } .hideGridColumn { display:none; } .table td label{ float: left; width:146px; margin-bottom:5px; margin-top:5px; font-family:Arial, Helvetica, sans-serif; font-size:14px; color: Black; line-height: 17px; text-align: right; } .table td labelmid{ float: left; width:205px; margin-bottom:5px; margin-top:5px; text-align: right; } .table td labelwide{ float: left; width:230px; margin-bottom:5px; margin-top:5px; text-align: right; } .table td.control{ width:310px; margin-bottom:5px; vertical-align:middle; font-family:Arial, Helvetica, sans-serif; font-size:14px; color: Black; line-height: 17px; } .table td.controlmed{ width:200px; margin-bottom:5px; vertical-align:middle; font-family:Arial, Helvetica, sans-serif; font-size:14px; color: Black; line-height: 17px; } .table td input[type=text],input[type=password]{ float: left; border:#92d307 solid 1px; line-height:20px; font-family:Arial, Helvetica, sans-serif; padding:5px; color:#000000; } .table td select{ float: left; border:#92d307 solid 1px; height:32px; line-height:20px; font-family:Arial, Helvetica, sans-serif; padding:5px; color:#000000; width:270px; } .Input_Text_Int{ width:40px; margin-bottom:10px; vertical-align:middle; padding-right:10px; } .Input_Text_Short { width:100px; margin-bottom:10px; vertical-align:middle; padding-right:10px; } .Input_Text_Med { width:175px; margin-bottom:10px; vertical-align:middle; padding-right:10px; } .Input_Text_Long { width:250px; margin-bottom:10px; vertical-align:middle; padding-right:10px; } validateGridView { background: url(../images/wrongIconGV.png) left 5px no-repeat; float: left; font-family: Arial, Helvetica, sans-serif; color: #FF5B5B; font-size:8px; } </code></pre> <p>The template field is applying the Input_Text_Int settings but not the validateGridView settings. Can anyone help me to fix this so the validates are formatted as specified in the CSS?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload