locked
validations in multilanguage RRS feed

  • Question

  • User450403478 posted

     

     how to change the validator callout externder to appear on the leftside of the textbox when the arabic button is clicked

    < asp:RequiredFieldValidator ID="RFVforname" runat="server" ControlToValidate="TxtName" ErrorMessage="<%$ Resources:Resource123, RFVforname %>" Display="None" SetFocusOnError="True">*</asp:RequiredFieldValidator>

     

    <cc1:ValidatorCalloutExtender ID="RFVforname_ValidatorCalloutExtender" runat="server" TargetControlID="RFVforname">

     

     </cc1:ValidatorCalloutExtender>

     

     

     

    RFVforname.Text = Resources.Resource123.RFVforname(in the set labels)

     

    <b>Required Field Missing</b><br/>Name is Required(in the english resx file)

    <b>fdghjkg</b><br/>gadsfasdass(in the arabic resx file)

    Everything is fine still the error message is comming in english when i am clicking the arabic button  also may i know where exactly the problem is

     and when i am clicking arabic button the button are appearing in arabicn,but not in the arabic direction but they are appearing in at the eng direction so can anyone let me know the solution of it

    muhammad imran
    Saturday, March 20, 2010 5:03 AM

All replies

  • User197322208 posted

    http://www.c-sharpcorner.com/UploadFile/mosessaur/aspnetlocalization02042006165851PM/aspnetlocalization.aspx


    Saturday, March 20, 2010 11:35 AM
  • User-1636183269 posted

    You can pass value in querystring, it will work for you. I have created sample for same. Please go through hope it will help. Please let me know if you need more info.

    http://forums.asp.net/t/1514920.aspx

    I think you require resource setting for all lavel then refer below link:

    http://msdn.microsoft.com/en-us/library/ms228208.aspx

    else refer

    http://mosesofegypt.net/post/2008/02/Applying-localization-with-MasterPages.aspx

    Sunday, March 21, 2010 5:41 AM
  • User450403478 posted

    hi Mr.sandeep wat ever u have provided is good,but my criteria is totally different just i want to convert the validation and vallidator callout exteder in to arabic when arabic button is clicked,just  iam pasting all my master page and vallidation and the resource file also just look over it for giving me the appropritate answer

    ImportsSystem.Data

    ImportsSystem

    Imports System.Collections

    Imports System.Configuration

    Imports System.Linq

    Imports System.Web

    Imports System.Web.Security

    Imports System.Web.UI

    Imports  System.Web.UI.HtmlControls

    Imports System.Web.UI.WebControls

    Imports System.Web.UI.WebControls.WebParts

    Imports System.Xml.Linq

    Imports System.Threading

    Imports System.Globalization

    Imports SystemResources

    Partial

     

     

     

    Class MasterPageInherits System.Web.UI.MasterPage'Protected dr As System.Web.UI.HtmlControls.HtmlGenericControl

     

     

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load'If Not IsPostBack Then

     

    ' English()

     

    ' Session("language") = "English"

    Style2()

     

    ' 'Session("PageDir") = "ltr"

     

    ' 'Response.Write(Session("language").ToString())

     

    'End If

     

    'If Not IsNothing(Session("PageDir")) Then

     

    ' dr.Attributes.Add("dir", Session("PageDir"))

     

     

    'End If

     

    End Sub

     

     

    English()

    Session(

    Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click"language") = "English"

    Style2()

    Session(

    "PageDir") = "ltr"

    Response.Write(Session(

     

    "language").ToString())End Sub

     

     

    obj.Engilsh()

     

    Private Sub English()Dim obj As New BasePage()End Sub

     

     

    obj.Arabic()

     

    Private Sub Arabic()Dim obj As New BasePage()End Sub

     

    Response.Write(

     

    Sub Style2()"<head id='head2'>")Try

     

    If Session("language") = "Arabic" Then

    Response.Write(

     

    "<link href='" & Request.ApplicationPath & "/StyleSheetAr.css' type='text/css' rel='stylesheet' />")Else

    Response.Write(

     

     

    "<link href='" & Request.ApplicationPath & "/StyleSheetEn.css' type='text/css' rel='stylesheet' />")End If

     

    Response.Write(ex.ToString)

     

    Catch ex As ExceptionEnd Try

    Response.Write(

     

    "</head>")End Sub

     

    Arabic()

    Session(

    Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click"language") = "Arabic"

    Style2()

    Session(

    "PageDir") = "rtl"

    Response.Write(Session(

     

    "language").ToString())End Sub

     

     

    Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRenderIf Session("language") <> "" Then

     

    If Session("language").ToString() = "Arabic" Then

     

    obj.Arabic()

     

    Dim obj As New BasePage()'SetLabels()

     

    'Session("PageDir") = "ltr"

     

    'Response.Write(Session("language").ToString())

     

    End If

     

    If Session("language").ToString() = "English" Then

     

    obj.Engilsh()

     

    Dim obj As New BasePage()'SetLabels()

     

    End If

     

     

    End If

     

    End Sub

     

     

    End

    Protected Sub LoginButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)End Sub Class

     

    Monday, March 22, 2010 2:33 AM
  • User-319574463 posted

    You need code to set language along the lines of:

        Dim objCultureInfo As New CultureInfo("xx-XX", False)
            Thread.CurrentThread.CurrentUICulture = objCultureInfo
            Thread.CurrentThread.CurrentCulture = objCultureInfo
            objCultureInfo = Nothing
            MyBase.InitializeCulture()

    where xx-XX should be replaced by you actual language code.

    Wednesday, March 31, 2010 5:27 AM
  • User-1636183269 posted

    I have mentioned clearly on my forum to create base page http://forums.asp.net/t/1514920.aspx refer, let me know what you exctly want to do, sorry may be i am missing something. 

    Wednesday, March 31, 2010 11:29 PM
  • User450403478 posted

    this is my balse class just check it

     

    Imports System.Data

    Imports System.Configuration

    Imports System.Web

    Imports System.Web.Security

    Imports System.Web.UI

    Imports System.Web.UI.WebControls

    Imports System.Web.UI.WebControls.WebParts

    Imports System.Web.UI.HtmlControls

    Imports System.Threading

    Imports System.Globalization

    Imports Microsoft.VisualBasic

    Imports System

    Public

     

     

     

     

    SetCulture(

     

    Class BasePageInherits PagePublic Sub Arabic()"ar-SA", "ar-SA")If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then

    Thread.CurrentThread.CurrentUICulture =

    Thread.CurrentThread.CurrentCulture =

     

    DirectCast(Session("MyUICulture"), CultureInfo)DirectCast(Session("MyCulture"), CultureInfo)End If

     

    End Sub

     

    SetCulture(

     

    Public Sub Engilsh()"en-US", "en-US")If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then

    Thread.CurrentThread.CurrentUICulture =

    Thread.CurrentThread.CurrentCulture =

     

    DirectCast(Session("MyUICulture"), CultureInfo)DirectCast(Session("MyCulture"), CultureInfo)End If

     

     

     

     

    End Sub

     

     

    Protected Sub SetCulture(ByVal name As String, ByVal locale As String)Try

     

    'set culture for current request

    Thread.CurrentThread.CurrentUICulture =

    Thread.CurrentThread.CurrentCulture =

     

     

    New CultureInfo(name)New CultureInfo(locale)'save culture for other requests

    Session(

    Session(

     

    MsgBox(ex.ToString())

     

    "MyUICulture") = Thread.CurrentThread.CurrentUICulture"MyCulture") = Thread.CurrentThread.CurrentCultureCatch ex As ExceptionEnd Try

     

    End Sub

     

    'To generate random number for the dupllicate images

     

    Public Shared Function getRandom() As Integer

    Randomize()

     

     

     

     

    Dim rn As New RandomDim x As Double = rn.Next(1, 99999999)Return xEnd Function

     

     

     

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadIf Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then

    Thread.CurrentThread.CurrentUICulture =

    Thread.CurrentThread.CurrentCulture =

     

    DirectCast(Session("MyUICulture"), CultureInfo)DirectCast(Session("MyCulture"), CultureInfo)End If

     

     

     

     

     

    End Sub

     

    End

    Class

    Sunday, April 4, 2010 4:37 AM
  • User-1636183269 posted

    I think it is syntatically error.

    Thread.CurrentThread.CurrentUICulture =

    Thread.CurrentThread.CurrentCulture =

     

    DirectCast(Session("MyUICulture"), CultureInfo)DirectCast(Session("MyCulture"), CultureInfo)

     

    Sunday, April 4, 2010 8:11 AM
  • User450403478 posted

    no man when i am pasting code its appearing like dat to u,actually its in this format,now wats the next step

     

    Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)

    Thread.CurrentThread.CurrentCulture =  DirectCast(Session("MyCulture"), CultureInfo)

     

     

    Sunday, April 4, 2010 8:36 AM