Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Multi language

Multi language

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-nethelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alwinSCH
    wrote on last edited by
    #1

    Hi, Could anyone help me with: I have a table that has the following fields * Name --> the name of a label on my asp.net page * French --> the text that has to become in the text property of the label * English I get all my information through a datareader But i don't know how i could in a loop call all the labels on my page then check if the name of the label is the same as the name in the table If this is true then fill the text property of the label So my question is how do i have to call all the labels in one statemen ==> if object.id= datareader("name") then object.id.Text=datareader("french") endif Object.id has to be replaced by what??? Thanks, A.

    M 1 Reply Last reply
    0
    • A alwinSCH

      Hi, Could anyone help me with: I have a table that has the following fields * Name --> the name of a label on my asp.net page * French --> the text that has to become in the text property of the label * English I get all my information through a datareader But i don't know how i could in a loop call all the labels on my page then check if the name of the label is the same as the name in the table If this is true then fill the text property of the label So my question is how do i have to call all the labels in one statemen ==> if object.id= datareader("name") then object.id.Text=datareader("french") endif Object.id has to be replaced by what??? Thanks, A.

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      If you are not familiar with the DataReader object, you can see MSDN[^]. In your case, the sample code can be something like this:

      while (reader.Read())
      {
      string lblName = reader.GetString(0)// Assuming the Name is the first column.
      Label label = Form1.FindControl(lblName);//Get reference to the label.

      //Depending on which language is currenly selected, you can either choose English or French.
      label.Text = reader.GetString(1) or reader.GetString(2);//For French.
      

      }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups