RequiredFieldValidator showing an image

F

Fernando Lopes

Hi.
I want to show an image in a requiredfield validator instead of "*".
So, I 'm set the requiredfieldvalidator attributes like following:

<asp:RequiredFieldValidator id=rfvFirstName
ControlToValidate="AddressName"
Display="Dynamic"
ErrorMessage="First Name Is Required"
Runat="server"
CssClass="AlertText"
EnableClientScript="True"
ValidationGroup="AddressManager">
<img src="../../Images/img_miss.gif" />
</asp:RequiredFieldValidator>

But always show the "*".
What can I doing wrong?

Thanks
Fernando Lopes
 
C

Corey

Fernando,

The text property should be set to your image source. I don't know a
lot about CSS but if your "AlertText" CSS class has text in it, that
would probably override the image source in the text property. Try
removing the CSS class attribute and changing the text property to your
image. Also, I was unable to find a Validation Group property when
looking at the RequiredFieldValidator control. Am I missing something?

Corey
 
G

Gopal \(FMS, Inc.\)

This works fine for me. The version of the framework I am using is 1.1. The
tag I tested is below.
<asp:RequiredFieldValidator id="rfvFirstName"
ControlToValidate="txtDiscussionNote" Display="Dynamic" ErrorMessage="First
Name Is Required"
Runat="server" CssClass="AlertText" EnableClientScript="True"
validationgroup="sdfasd">
<img src="Images/FMSLogo.gif" />
</asp:RequiredFieldValidator>
May be you can post html portion of your aspx page for someone to help you
out.
--
Gopal Rangaswamy
Microsoft Certified Solutions Developer
FMS, Inc.
<http://www.fmsinc.com/consulting>
<http://www.fmsinc.com/dotnet/SourceBook/>
 
F

Fernando Lopes

Hi Corey.
I tried what did you said, but it doesn't work.
I putted this:
<asp:RequiredFieldValidator id=RequiredFieldValidator1
runat="server"
ErrorMessage="RequiredFieldValidator"
controltovalidate="AddressPrefix">
<img src="../../Images/arrow_validation.gif" />
</asp:RequiredFieldValidator>

In true, I was setting the Text attribute. In html source, the Text attribute is anything write inside control tags.
So, in design view, I'm set the Text attribute correctly.

Thansk again.
Fernando Lopes
 
F

Fernando Lopes

Okay Gopal!
Maybe the problem is my framework.
I'm using 2.2.
Probably is it.
Is there any asp.net 2.0 newsgroup? Do you know anyone?
But, if it helps, see my html code below:

<table class="nb bkg2" width="100%">

<tr>

<td nowrap="nowrap" colspan="4">

<asp:Button id="NewAddress" runat="server" width="150px"
onclick="NewAddress_Click" skinid="new"></asp:Button>

<asp:Button id="EditAddress" runat="server" width="150px"
onclick="EditAddress_Click" enabled="False"></asp:Button>

<asp:Button id="DeleteAddress" runat="server" width="150px" enabled="False"
onclick="DeleteAddress_Click" skinid="del"></asp:Button>

<asp:Button id="SetPrimaryAddress" runat="server" width="150px"
enabled="False" onclick="SetPrimaryAddress_Click"></asp:Button>

</td>

</tr>

<tr>

<td nowrap="nowrap" colspan="4">

<asp:GridView id="GridAddresses" runat="server" width="100%"
autogeneratecolumns="False" pagesize="1" datakeynames="AddressID"
onselectedindexchanged="GridAddresses_SelectedIndexChanged"></asp:GridView>

<ucg:pagingControl id="PC1" runat="server" visible="false"
onpagingcontrolnavigation="PC1_PagingControlNavigation" />

</td>

</tr>

<tr>

<td nowrap="nowrap" colspan="4">

<table class="nb bkg2" width="100%">

<tr>

<td nowrap="nowrap"><asp:label id="lbl_Country" runat="server"
skinid="bold"></asp:label></td>

<td nowrap="nowrap"><UCPU:combocountries id="Country" runat="server"
autopostback="true" width="200"
oncombocountryindexchanged="Country_SelectedIndexChanged"
combocountriesvalidation="true"
combocountriesvalidationgroup="AddressManager" /></td>

<td nowrap="nowrap"><asp:label id="lbl_PostalCode" runat="server"
skinid="bold"></asp:label></td>

<td nowrap="nowrap">

<UCG:maskededitcontrol id="PostalCode" runat="server" datatype="Alfanumeric"
width="185" mask="#####-###" controlname="PostalCode"/>

<asp:button id="ValidateZipCode" runat="server" width="18px" height="18px"
/>

</td>

</tr>

<tr>

<td nowrap="nowrap"><asp:label id="lbl_State" runat="server"
skinid="bold"></asp:label></td>

<td nowrap="nowrap"><UCPU:combostates id="State" runat="server"
autopostback="true" width="200"
oncombostateindexchanged="State_SelectedIndexChanged"
combostatesvalidation="true" combostatesvalidationgroup="AddressManager"
/></td>

<td nowrap="nowrap"><asp:label id="lbl_Perimeter" runat="server"
skinid="bold"></asp:label></td>

<td nowrap="nowrap"><UCPU:comboperimeters id="Perimeter" runat="server"
autopostback="true" width="213" comboperimetersvalidation="false" /></td>

</tr>

<tr>

<td nowrap="nowrap"><asp:label id="lbl_City" runat="server"
skinid="bold"></asp:label></td>

<td nowrap="nowrap">

<CCS:pickListCall id="PickListCall1" runat="server" picklistcallwidth="185"
onpicklistcallbuttonclick="PickListCallClick"
picklistcallpage="PickListCityPage" picklistdestinyview="CityPickList" />

<asp:RequiredFieldValidator id="rfvFirstName"
ControlToValidate="AddressName" Display="Dynamic"

ErrorMessage="First Name Is Required" Runat="server" CssClass="AlertText"
EnableClientScript="True"

validationgroup="AddressManager"><img src="../../Images/img_miss.gif"
/></asp:RequiredFieldValidator>

</td>

<td nowrap="nowrap"><asp:label id="lbl_TimeZone" runat="server"
skinid="bold"></asp:label></td>

<td nowrap="nowrap">

<UCPU:combotimezones id="SimplectTimeZone" runat="server"
autopostback="false"

width="213" combotimezonesautopostback="false"
combotimezonevalidation="true"

combotimezonevalidationgroup="AddressManager" />

</td>

</tr>

</table>

<...>

Thanks.
Fernando
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,043
Members
48,769
Latest member
Clifft

Latest Threads

Top