By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,572 Members | 959 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,572 IT Pros & Developers. It's quick & easy.

RequiredFieldValidator showing an image

P: n/a
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
Nov 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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

Nov 19 '05 #2

P: n/a
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/>

"Fernando Lopes" <fe*******@remove.terra.com.br> wrote in message
news:uM**************@tk2msftngp13.phx.gbl...
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

Nov 19 '05 #3

P: n/a
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
"Corey" <co**************@citigroup.com> wrote in message news:11**********************@z14g2000cwz.googlegr oups.com...
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

Nov 19 '05 #4

P: n/a
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_SelectedInde xChanged"></asp:GridView>

<ucg:PagingControl id="PC1" runat="server" visible="false"
onpagingcontrolnavigation="PC1_PagingControlNaviga tion" />

</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_SelectedIndexC hanged"
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_SelectedIndexChang ed"
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

"Gopal (FMS, Inc.)" <go**********@fmsinc.com> wrote in message
news:u3**************@TK2MSFTNGP12.phx.gbl...
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/>

"Fernando Lopes" <fe*******@remove.terra.com.br> wrote in message
news:uM**************@tk2msftngp13.phx.gbl...
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


Nov 19 '05 #5

P: n/a
2.0 is still beta. You may search Visual Studio .Net 2005 newsgroups for
help...Good luck.
--
Gopal Rangaswamy
Microsoft Certified Solutions Developer
FMS, Inc.
<http://www.fmsinc.com/consulting>
<http://www.fmsinc.com/dotnet/SourceBook/>

"Fernando Lopes" <fe*******@remove.terra.com.br> wrote in message
news:OT****************@TK2MSFTNGP12.phx.gbl...
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_SelectedInde xChanged"></asp:GridView>
<ucg:PagingControl id="PC1" runat="server" visible="false"
onpagingcontrolnavigation="PC1_PagingControlNaviga tion" />

</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_SelectedIndexC hanged"
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_SelectedIndexChang ed"
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

"Gopal (FMS, Inc.)" <go**********@fmsinc.com> wrote in message
news:u3**************@TK2MSFTNGP12.phx.gbl...
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/>

"Fernando Lopes" <fe*******@remove.terra.com.br> wrote in message
news:uM**************@tk2msftngp13.phx.gbl...
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



Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.