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
  1. Home
  2. Web Development
  3. ASP.NET
  4. asp:ButtonColumn Text

asp:ButtonColumn Text

Scheduled Pinned Locked Moved ASP.NET
helpdesignquestion
3 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.
  • G Offline
    G Offline
    garfield185
    wrote on last edited by
    #1

    I hope somebody can help me with this. I have got this DataGrid, with a buttoncolumn, and my problem is that depending on the language the user has chosen, it should show one text, or another. The language is saved on Session=("language"), it can be "EN" English, or "ES" Spanish. So, how could I write this column? I tried this:

    <asp:ButtonColumn Text="<% if Session("language") = "ES" then Response.Write ("Editar") else ("Edit") end if %>" CommandName="Select">

    I get an error.

    Error 1 The literal content ('<asp:ButtonColumn Text="') is not allowed in 'System.Web.UI.WebControls.DataGridColumnCollection'.

    (The error message is translated to English, it is not probably the real text)

    J 1 Reply Last reply
    0
    • G garfield185

      I hope somebody can help me with this. I have got this DataGrid, with a buttoncolumn, and my problem is that depending on the language the user has chosen, it should show one text, or another. The language is saved on Session=("language"), it can be "EN" English, or "ES" Spanish. So, how could I write this column? I tried this:

      <asp:ButtonColumn Text="<% if Session("language") = "ES" then Response.Write ("Editar") else ("Edit") end if %>" CommandName="Select">

      I get an error.

      Error 1 The literal content ('<asp:ButtonColumn Text="') is not allowed in 'System.Web.UI.WebControls.DataGridColumnCollection'.

      (The error message is translated to English, it is not probably the real text)

      J Offline
      J Offline
      Jamil Hallal
      wrote on last edited by
      #2

      Hi, you can you use the DataBound event of the grid to set the text of the button, but the best practice is to set the UI culture by overriding the following event in your page:

      protected override void InitializeCulture()
      {
      System.Threading.Thread.CurrentThread.CurrentUICulture = "the culture";
      System.Threading.Thread.CurrentThread.CurrentCulture = "the culture";
      }

      Regards, Jamil

      G 1 Reply Last reply
      0
      • J Jamil Hallal

        Hi, you can you use the DataBound event of the grid to set the text of the button, but the best practice is to set the UI culture by overriding the following event in your page:

        protected override void InitializeCulture()
        {
        System.Threading.Thread.CurrentThread.CurrentUICulture = "the culture";
        System.Threading.Thread.CurrentThread.CurrentCulture = "the culture";
        }

        Regards, Jamil

        G Offline
        G Offline
        garfield185
        wrote on last edited by
        #3

        Thanks for answering Jamil. I'm sorry, I don't know anything about what you say, that UI Culture thing... And when you say Databound, doy you mean databinding? I don't see any databound event on the grid, just data binding. I'm using VS2005, by the way. Thanks in advance. PS: How could I complete the code?

        datagrid.columns(i).text = "ES"

        There is no text property on columns collection.

        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