Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7597519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:10:34+00:00 2026-05-30T22:10:34+00:00

I was juste wondering if it was possible to use String.Format with the following

  • 0

I was juste wondering if it was possible to use String.Format with the following inline tag :

<asp:RequiredFieldValidator ControlToValidate="tbTest" Text="<%$ Resources:ErrorMsg, E3032  %>" runat="server" />

like this so

<asp:RequiredFieldValidator ControlToValidate="tbTest" Text='<%= String.Format(<%$ Resources:ErrorMsg, E3032  %>, "Other Text to insert")' runat="server" />

I know you can’t do that but it’s just for the picture.

tx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:10:36+00:00Added an answer on May 30, 2026 at 10:10 pm

    I ended up creating my own expression for this purpose :

    web.config :

    <expressionBuilders>
      <add expressionPrefix="CreerMsgErreur" type="MsgErreurs, App_Code" /> 
    </expressionBuilders>
    

    .aspx :

    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="tbdDateFin"
     CssClass="test" Text="<%$ CreerMsgErreur:E3033, insert, date %>"
     ErrorMessage="<%$ CreerMsgErreur:E3033, insert, date %>"
     runat="server" EnableClientScript="true" SetFocusOnError="true" />
    

    .vb :

    Imports System
    Imports System.CodeDom
    Imports System.Linq
    Imports System.Security.Permissions
    Imports System.Web
    Imports System.Web.Compilation
    Imports System.Web.UI
    
    <ExpressionPrefix("Reflect")> _
    <AspNetHostingPermission(SecurityAction.InheritanceDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
    <AspNetHostingPermission(SecurityAction.LinkDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
    Public Class MsgErreurs
        Inherits ExpressionBuilder
    
        Public Overrides Function GetCodeExpression(ByVal entry As System.Web.UI.BoundPropertyEntry, ByVal parsedData As Object, ByVal context As System.Web.Compilation.ExpressionBuilderContext) As System.CodeDom.CodeExpression
            If parsedData IsNot Nothing Then
                Return New CodePrimitiveExpression(CType(parsedData, MsgErreursParse).ToString())
            End If
    
            Return New CodePrimitiveExpression("Erreur de l'expression")
        End Function
    
        Public Overrides Function ParseExpression(ByVal expression As String, ByVal propertyType As System.Type, ByVal context As System.Web.Compilation.ExpressionBuilderContext) As Object
    
            Dim leMsgErreur As MsgErreursParse = Nothing
    
            If Not String.IsNullOrEmpty(expression) Then
                leMsgErreur = New MsgErreursParse(expression)
            Else
                Throw New HttpException(String.Format("Message de l'expression MsgErreur vous devez entrer une expression."))
            End If
    
            Return leMsgErreur
        End Function
    
        Private Class MsgErreursParse
            Private mNoErreur As String
            Private mParametres As String
    
            Public Property NoErreur() As String
                Get
                    Return mNoErreur
                End Get
                Set(ByVal value As String)
                    mNoErreur = value
                End Set
            End Property
    
            Public Property Parametres() As String
                Get
                    Return mParametres
                End Get
                Set(ByVal value As String)
                    mParametres = value
                End Set
            End Property
    
            Public Sub New(ByVal parametres As String)
                Try
                    mNoErreur = parametres.Substring(0, parametres.IndexOf(",")).Trim()
                    mParametres = parametres.Substring(parametres.IndexOf(",") + 1).Trim()
                Catch ex As ArgumentOutOfRangeException
                    mNoErreur = parametres
                Catch ex As Exception
    
                End Try
    
                If String.IsNullOrEmpty(mNoErreur) Then
                    Throw New HttpException(String.Format("Message de l'expression MsgErreur : vous devez spécifier un code d'erreur ou les paramètres ne sont pas dans le bon format : {0}", parametres))
                End If
            End Sub
    
            Public Sub New(ByVal noErreur As String, ByVal parametres As String)
                mNoErreur = noErreur
                mParametres = parametres
            End Sub
    
            Public Overrides Function ToString() As String
                Try
                    If String.IsNullOrEmpty(Parametres) Then
                        Return Convert.ToString(HttpContext.GetGlobalResourceObject("MsgErreurs", NoErreur), System.Globalization.CultureInfo.CurrentCulture)
                    Else
                        Return String.Format(Convert.ToString(HttpContext.GetGlobalResourceObject("MsgErreurs", NoErreur), System.Globalization.CultureInfo.CurrentCulture), Parametres.Split(",").Select(Function(s) s.Trim()).ToArray())
                    End If
                Catch ex As Exception
                    Throw New HttpException(String.Format("Message de l'expression MsgErreur : impossible de créer le message d'erreur : NoErreur : {0}, Parametres : {1}", NoErreur, Parametres))
                End Try
            End Function
        End Class
    
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first time use JTree. Just wondering is it possible to have more than one
Just wondering in php, if it was possible to convert a string to a
I'm just wondering if it's possible to use one regular expression to match another,
Is it possible to use JavaScript to listen for text typed in a specific
Just wondering if it is possible to access the Mac OS X Address Book
Just wondering if it is possible to dynamically create a list of strings in
I was just wondering if it is possible to capture the output of a
Just wondering, because of a problem I am running into, is it possible to
I was just wondering if it is possible and if so what the best
I'm just wondering if this is possible, and if not, the best way to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.