show Validation Summery Message Header in diffrent stylehttp://forums.asp.net/t/1436482.aspx/1?show+Validation+Summery+Message+Header+in+diffrent+styleWed, 17 Jun 2009 14:19:25 -040014364823239036http://forums.asp.net/p/1436482/3239036.aspx/1?show+Validation+Summery+Message+Header+in+diffrent+styleshow Validation Summery Message Header in diffrent style &lt;p&gt;<br> Hi:<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I have a task of displaying Validation&nbsp; summery Message header in diffrent style and font.I have mentioned the code below.<br> <br> for Ex I left the Bank Name Field then press Nex button the Error Message show show as below. Can any one solve this issue.<br> <br> <br> <br> <font color="#a31515" size="2"></font><font color="#a31515" size="2"> <p><strong>Create was unsuccessful. Please correct the errors and try again</strong>.------&gt;Header below the header.&nbsp; this Header Message show in different style.<br> <br> * Enter the Bank Name<br> <br> </font><br> <strong><u>Model.</u></strong><br> </p> <font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">class</font><font size="2"> </font><font color="#2b91af" size="2">IRSPayment</font><font size="2"> : </font><font color="#2b91af" size="2">EntityBase</p> </font><font size="2"> <p>{</p> [</font><font color="#2b91af" size="2">XmlAttribute</font><font size="2">()]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">long</font><font size="2"> IRSPaymentId { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> [</font><font color="#2b91af" size="2">XmlAttribute</font><font size="2">()]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">long</font><font size="2"> IRSPaymentOptionId { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> [</font><font color="#2b91af" size="2">XmlAttribute</font><font size="2">()]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">string</font><font size="2"> BankName { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> [</font><font color="#2b91af" size="2">XmlAttribute</font><font size="2">()]</font><font size="2"> <p>[</font><font color="#2b91af" size="2">RegularExpression</font><font size="2">(</font><font color="#a31515" size="2">@&quot;(01|02|03|04|05|06|07|08|09|10|11|12|21|22|23|24|25|26|27|28|29|30|31|32)[0-9]{7}&quot;</font><font size="2">, ErrorMessage = </font><font color="#a31515" size="2">&quot;&lt;br /&gt;Bank Routing Number is invalid.&quot;</font><font size="2">)]</p> </font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">string</font><font size="2"> RTN { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">string</font><font size="2"> AccountNumber { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> [</font><font color="#2b91af" size="2">XmlAttribute</font><font size="2">()]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">bool</font><font size="2"> IsEROPin { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> [</font><font color="#2b91af" size="2">XmlAttribute</font><font size="2">()]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">int</font><font size="2"> EFWPin { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> [</font><font color="#2b91af" size="2">XmlElement</font><font size="2">()]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#2b91af" size="2">Form7004</font><font size="2"> Form7004 { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> [</font><font color="#2b91af" size="2">XmlAttribute</font><font size="2">()]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">decimal</font><font size="2"> Amount { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> [</font><font color="#2b91af" size="2">XmlAttribute</font><font size="2">()]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">long</font><font size="2"> AccountTypeID { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> [</font><font color="#2b91af" size="2">XmlAttribute</font><font size="2">()]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#2b91af" size="2">DateTime</font><font size="2"> PaymentDate { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> [</font><font color="#2b91af" size="2">XmlIgnore</font><font size="2">()]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#2b91af" size="2">List</font><font size="2">&lt;</font><font color="#2b91af" size="2">AccountType</font><font size="2">&gt; ListAccountType { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> [</font><font color="#2b91af" size="2">XmlAttribute</font><font size="2">()]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">byte</font><font size="2">[] Form8878A { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> [</font><font color="#2b91af" size="2">XmlAttribute</font><font size="2">()]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">string</font><font size="2"> FileName { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> [</font><font color="#2b91af" size="2">XmlAttribute</font><font size="2">()]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">string</font><font size="2"> FileExtension { </font><font color="#0000ff" size="2">get</font><font size="2">; </font><font color="#0000ff" size="2">set</font><font size="2">; }</p> </font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#2b91af" size="2">List</font><font size="2">&lt;</font><font color="#2b91af" size="2">ErrorInfo</font><font size="2">&gt; GetRuleViolations()</font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">var</font><font size="2"> validationIssues = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">List</font><font size="2">&lt;</font><font color="#2b91af" size="2">ErrorInfo</font><font size="2">&gt;();</font><font size="2"> <p>&nbsp;</p> </font><font color="#0000ff" size="2">if</font><font size="2"> (IRSPaymentOptionId == (</font><font color="#0000ff" size="2">long</font><font size="2">)</font><font color="#2b91af" size="2">IRSPaymentOptionEnum</font><font size="2">.EFW)</font><font size="2"> <p>{</p> <p>&nbsp;</p> </font><font color="#0000ff" size="2">if</font><font size="2"> (</font><font color="#0000ff" size="2">string</font><font size="2">.IsNullOrEmpty(BankName))</font><font size="2"> <p>{</p> validationIssues.Add(</font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">ErrorInfo</font><font size="2">(</font><font color="#a31515" size="2">&quot;BankName&quot;</font><font size="2">, </font><font color="#a31515" size="2">&quot;Enter the Bank Name.&quot;</font><font size="2">, </font><font color="#0000ff" size="2">this</font><font size="2">));</font><font size="2"> <p>}</p> </font><font color="#0000ff" size="2">if</font><font size="2"> (</font><font color="#0000ff" size="2">string</font><font size="2">.IsNullOrEmpty(RTN))</font><font size="2"> <p>{</p> validationIssues.Add(</font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">ErrorInfo</font><font size="2">(</font><font color="#a31515" size="2">&quot;RTN&quot;</font><font size="2">, </font><font color="#a31515" size="2">&quot;Enter the RTN.&quot;</font><font size="2">, </font> <font color="#0000ff" size="2">this</font><font size="2">));</font><font size="2"> <p>}</p> </font><font color="#0000ff" size="2">if</font><font size="2"> (PaymentDate == </font> <font color="#0000ff" size="2">null</font><font size="2"> || (PaymentDate != </font> <font color="#0000ff" size="2">null</font><font size="2"> &amp;&amp; PaymentDate == </font> <font color="#2b91af" size="2">DateTime</font><font size="2">.MinValue))</font><font size="2"> <p>{</p> validationIssues.Add(</font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">ErrorInfo</font><font size="2">(</font><font color="#a31515" size="2">&quot;PaymentDate&quot;</font><font size="2">, </font><font color="#a31515" size="2">&quot;Enter the Payment Date.&quot;</font><font size="2">, </font><font color="#0000ff" size="2">this</font><font size="2">));</font><font size="2"> <p>}</p> </font><font color="#0000ff" size="2">if</font><font size="2"> (PaymentDate != </font> <font color="#0000ff" size="2">null</font><font size="2"> &amp;&amp; PaymentDate != </font> <font color="#2b91af" size="2">DateTime</font><font size="2">.MinValue &amp;&amp; PaymentDate &lt; </font><font color="#2b91af" size="2">DateTime</font><font size="2">.Now)</font><font size="2"> <p>{</p> validationIssues.Add(</font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">ErrorInfo</font><font size="2">(</font><font color="#a31515" size="2">&quot;PaymentDate&quot;</font><font size="2">, </font><font color="#a31515" size="2">&quot;Payment Date cannot be a past date.&quot;</font><font size="2">, </font><font color="#0000ff" size="2">this</font><font size="2">));</font><font size="2"> <p>}</p> </font><font color="#0000ff" size="2">if</font><font size="2"> (EFWPin &lt;= 0 || EFWPin.ToString().Length &lt; 5)</font><font size="2"> <p>{</p> validationIssues.Add(</font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">ErrorInfo</font><font size="2">(</font><font color="#a31515" size="2">&quot;EFWPin&quot;</font><font size="2">, </font><font color="#a31515" size="2">&quot;Enter the EFW Pin.&quot;</font><font size="2">, </font><font color="#0000ff" size="2">this</font><font size="2">));</font><font size="2"> <p>}</p> </font><font color="#0000ff" size="2">if</font><font size="2"> (AccountNumber == </font> <font color="#0000ff" size="2">null</font><font size="2"> || </font><font color="#2b91af" size="2">Convert</font><font size="2">.ToInt32(AccountNumber.Trim().Length) &lt; 5)</font><font size="2"> <p>{</p> validationIssues.Add(</font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">ErrorInfo</font><font size="2">(</font><font color="#a31515" size="2">&quot;AccountNumber&quot;</font><font size="2">, </font><font color="#a31515" size="2">&quot;Enter the Bank Account Number.&quot;</font><font size="2">, </font><font color="#0000ff" size="2">this</font><font size="2">));</font><font size="2"> <p>}</p> </font><font color="#0000ff" size="2">bool</font><font size="2"> _isNumeric = IsNumeric(AccountNumber);</font><font size="2"></font><font color="#0000ff" size="2">if</font><font size="2"> (!_isNumeric)</font><font size="2"> <p>{ </p> validationIssues.Add(</font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">ErrorInfo</font><font size="2">(</font><font color="#a31515" size="2">&quot;AccountNumber&quot;</font><font size="2">, </font><font color="#a31515" size="2">&quot;AccountNumber is Not Valid Please give Account Number with out special characters.&quot;</font><font size="2">, </font><font color="#0000ff" size="2">this</font><font size="2">));</font><font size="2"> <p>}</p> <p>}</p> <p></font><font color="#008000" size="2">// Validate attributes </p> </font><font size="2">validationIssues.AddRange(</font><font color="#2b91af" size="2">DataAnnotationsValidationRunner</font><font size="2">.GetErrors(</font><font color="#0000ff" size="2">this</font><font size="2">));</font><font size="2"> <p></font><font color="#0000ff" size="2">return</font><font size="2"> validationIssues;</p> <p>}</p> </font><font color="#0000ff" size="2">#region</font><font size="2"> Check Numeric</font><font size="2"> <p></font><font color="#808080" size="2">///</font><font color="#008000" size="2"> </font><font color="#808080" size="2">&lt;summary&gt;</p> </font><font size="2"> <p></font><font color="#808080" size="2">///</font><font color="#008000" size="2"> Determines whether the specified value is numeric.</p> </font><font size="2"> <p></font><font color="#808080" size="2">///</font><font color="#008000" size="2"> </font><font color="#808080" size="2">&lt;/summary&gt;</p> </font><font size="2"> <p></font><font color="#808080" size="2">///</font><font color="#008000" size="2"> </font><font color="#808080" size="2">&lt;param name=&quot;value&quot;&gt;</font><font color="#008000" size="2">The value.</font><font color="#808080" size="2">&lt;/param&gt;</p> </font><font size="2"> <p></font><font color="#808080" size="2">///</font><font color="#008000" size="2"> </font><font color="#808080" size="2">&lt;returns&gt;</p> </font><font size="2"> <p></font><font color="#808080" size="2">///</font><font color="#008000" size="2"> </font><font color="#808080" size="2">&lt;c&gt;</font><font color="#008000" size="2">true</font><font color="#808080" size="2">&lt;/c&gt;</font><font color="#008000" size="2"> if the specified value is numeric; otherwise, </font><font color="#808080" size="2">&lt;c&gt;</font><font color="#008000" size="2">false</font><font color="#808080" size="2">&lt;/c&gt;</font><font color="#008000" size="2">.</p> </font><font size="2"> <p></font><font color="#808080" size="2">///</font><font color="#008000" size="2"> </font><font color="#808080" size="2">&lt;/returns&gt;</p> </font><font size="2"></font><font color="#0000ff" size="2">private</font><font size="2"> </font><font color="#0000ff" size="2">bool</font><font size="2"> IsNumeric(</font><font color="#0000ff" size="2">string</font><font size="2"> AccountNumber)</font><font size="2"> <p>{</p> </font><font color="#2b91af" size="2">Regex</font><font size="2"> regex = </font> <font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">Regex</font><font size="2">(</font><font color="#a31515" size="2">@&quot;(^[0-9]*&#36;)&quot;</font><font size="2">);</font><font size="2"></font><font color="#0000ff" size="2">if</font><font size="2"> (regex.IsMatch(AccountNumber))</font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">return</font><font size="2"> </font><font color="#0000ff" size="2">true</font><font size="2">;</font><font size="2"> <p>}</p> <p></font><font color="#0000ff" size="2">else</p> </font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">return</font><font size="2"> </font><font color="#0000ff" size="2">false</font><font size="2">;</font><font size="2"> <p>}</p> <p>}</p> </font><font color="#0000ff" size="2"> <p>#endregion</p> </font><font size="2"></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">void</font><font size="2"> Validate()</font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">var</font><font size="2"> validationIssues = GetRuleViolations();</font><font size="2"> <p></font><font color="#0000ff" size="2">if</font><font size="2"> (validationIssues.Count &gt; 0)</p> </font><font color="#0000ff" size="2">throw</font><font size="2"> </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">RulesException</font><font size="2">(validationIssues);</font><font size="2"> <p>}</p> <p>}</p> <br> <strong><u>IRSPaymet.aspx page:</u></strong><br> <br> <font size="2"></font><font size="2"> <p>&lt;%</font><font color="#0000ff" size="2">=</font><font size="2"> Html.ValidationSummary()%&gt; </p> <p></font><br> </font><br> <br> </p> <p>&lt;/p&gt;</p> 2009-06-17T07:46:39-04:003239070http://forums.asp.net/p/1436482/3239070.aspx/1?Re+show+Validation+Summery+Message+Header+in+diffrent+styleRe: show Validation Summery Message Header in diffrent style <p>Hi</p> <p>You can change the header like this by inserting some html or by add a CssClass to your ValidationSummary: <br> </p> <pre class="prettyprint">&lt;asp:ValidationSummary ID=&quot;ValidationSummary1&quot; runat=&quot;server&quot; DisplayMode=&quot;BulletList&quot; <b> HeaderText=&quot;&lt;h3&gt;&lt;span<span></span>&gt;What's going on?&lt;/span&gt;&lt;/h3&gt;&quot;</b> CssClass=&quot;error&quot; /&gt;</pre> <p>Hope this helps.</p> <p>Dave <br> </p> 2009-06-17T07:57:00-04:003239073http://forums.asp.net/p/1436482/3239073.aspx/1?Re+show+Validation+Summery+Message+Header+in+diffrent+styleRe: show Validation Summery Message Header in diffrent style <p>You have to&nbsp;change &quot;<em>validation-summary-errors</em>&quot; CSS class definition&nbsp;in your <em>Site.css</em> file.</p> 2009-06-17T07:58:07-04:003239077http://forums.asp.net/p/1436482/3239077.aspx/1?Re+show+Validation+Summery+Message+Header+in+diffrent+styleRe: show Validation Summery Message Header in diffrent style <p></p> <blockquote><span class="icon-blockquote"></span> <h4>Dave_Winchester</h4> &lt;asp:ValidationSummary ID=&quot;ValidationSummary1&quot; runat=&quot;server&quot; DisplayMode=&quot;BulletList&quot; HeaderText=&quot;&lt;<span class="tag">h3&gt;<span></span>&gt;What's going on?&lt;/<span class="tag">span</span>&gt;&lt;/<span class="tag">h3</span>&gt;&quot; CssClass=&quot;error&quot; /&gt;</span> </blockquote> &nbsp; <p></p> <p>Looks like the code formatter messed this up...</p> <p>Should be: <br> </p> <p>&nbsp;</p> <pre class="prettyprint">&lt;asp:ValidationSummary ID=&quot;ValidationSummary1&quot; runat=&quot;server&quot; DisplayMode=&quot;BulletList&quot; HeaderText=&quot;&lt;h3&gt;&lt;span<span></span>&gt;What's going on?&lt;/span&gt;&lt;/h3&gt;&quot; CssClass=&quot;error&quot; /&gt;</pre>&nbsp;&nbsp; 2009-06-17T07:59:23-04:003239230http://forums.asp.net/p/1436482/3239230.aspx/1?Re+show+Validation+Summery+Message+Header+in+diffrent+styleRe: show Validation Summery Message Header in diffrent style <p>Harry, Dave, we are here in <em>ASP.NET <strong>MVC</strong></em> forum, not <em> ASP.NET WebForms</em> forum [;)]</p> 2009-06-17T08:57:19-04:003239309http://forums.asp.net/p/1436482/3239309.aspx/1?Re+show+Validation+Summery+Message+Header+in+diffrent+styleRe: show Validation Summery Message Header in diffrent style <p>&nbsp;Ooops! Sorry - Did not notice.<br> </p> 2009-06-17T09:24:19-04:003240029http://forums.asp.net/p/1436482/3240029.aspx/1?Re+show+Validation+Summery+Message+Header+in+diffrent+styleRe: show Validation Summery Message Header in diffrent style <p>&nbsp;Hi </p> <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; To show the validation summary message header in different style </p> <p>1 : Open site.css file of your application in Content folder</p> <p>2. goto .validation-summary-errors.</p> <p>3. Here you can change the style of the message.</p> <p>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</p> <p>If you think you had found the answer then&nbsp;</p> <p>Mark this as Answer <br> </p> 2009-06-17T14:19:25-04:00