Dynamically created datagrid and i8n ?

Discussion in 'ASP .Net' started by lothar.behrens@lollisoft.de, Dec 8, 2006.

  1. Guest

    Hi,

    I have created a DataGrid, whose columns are created automatically
    based on a SQL query.
    Using the following function does not do it's work as expected:

    Private Sub Grid_ItemDataBound(ByVal sender As Object, ByVal e
    As _
    System.Web.UI.WebControls.DataGridItemEventArgs)
    Handles _
    Grid.ItemDataBound
    If (e.Item.ItemType = ListItemType.Header) Then
    For counter As Integer = 0 To e.Item.Cells.Count - 1
    e.Item.Cells(counter).Text =
    Translate(e.Item.Cells(counter).Text)
    Next counter
    End If
    End Sub

    The columns seems to be not yet created and I'll get empty headers
    instead the untranslated columns. If Translate didn't find a
    translation (resx file), it returns the given value.

    Any Ideas, why I get empty headers ?

    Thanks, Lothar

    I do setup the grid like this:

    Protected Sub refreshGrid()
    Dim myconnection As New SqlConnection(conStr)
    myconnection.Open()
    Dim oCommand As SqlDataAdapter
    oCommand = New SqlDataAdapter(Session("SQLQuery"),
    myconnection)
    Dim MyDataSet As New DataSet

    Try
    oCommand.Fill(MyDataSet, "SQLQuery")
    gridBalance.DataSource = MyDataSet
    gridBalance.AllowPaging = True
    gridBalance.AllowSorting = True
    gridBalance.DataKeyField = "I_MyKeyField"
    gridBalance.DataBind()
    Catch ex As Exception
    ErrorMsg("Error: Could not show data in grid!")
    End Try
    End Sub
    , Dec 8, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Colin McGuigan
    Replies:
    2
    Views:
    740
    Colin McGuigan
    Feb 6, 2004
  2. =?Utf-8?B?Q0ogU21pdA==?=

    Finding Dynamically Created DataGrid Controls

    =?Utf-8?B?Q0ogU21pdA==?=, Feb 25, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    419
    Steven Cheng[MSFT]
    Feb 26, 2004
  3. Lucas Tam
    Replies:
    1
    Views:
    462
    Lucas Tam
    Jul 30, 2004
  4. =?Utf-8?B?R1A=?=
    Replies:
    1
    Views:
    566
    =?Utf-8?B?RG90TmV0SmVyb21l?=
    Feb 26, 2005
  5. msimmons
    Replies:
    0
    Views:
    444
    msimmons
    Jul 16, 2009
Loading...

Share This Page