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

  • Home
  • SEARCH
  • 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 3935750
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:51:58+00:00 2026-05-19T23:51:58+00:00

Should hopefully be pretty simple. I have a column in my datagrid that has

  • 0

Should hopefully be pretty simple. I have a column in my datagrid that has emails for notification. They are separated by a ‘;’. I want to put a "<br>" after each ‘;’ so that the grid doesn’t expand too far off of the page. I was able to get a function going that allowed me to see each row before it was created, but when I was trying to retrieve the value to edit it, it was returning null. I’m going to try and retrieve that function as I erased it on Friday, but was wondering if someone had any links or examples on how to do this.

I have:

-------------------------------------------------------------------------------
| Column1 | Column2 | Column3 |                    Notify                     |
-------------------------------------------------------------------------------
|  NULL   |  NULL   |  NULL   | email1@emailserver.com;email2@emailserver.com |
-------------------------------------------------------------------------------

I want:

---------------------------------------------------------
| Column1 | Column2 | Column3 |          Notify         |
---------------------------------------------------------
|  NULL   |  NULL   |  NULL   | email1@emailserver.com; |
|         |         |         | email2@emailserver.com  |
---------------------------------------------------------

I know that I was using the ItemCreated function and trying to retrieve the values from the DataGridItemEventArgs. Working on the function now.

Update

Ok, so I got back to this as a test:

Private Sub ItemCreated(ByVal sender As Object, ByVal e As DataGridItemEventArgs) Handles dgTasks.ItemCreated
    If e.Item.Cells.Count > 1 Then
        Dim int As Integer = 0  'I put a breakpoint here to evalute the information
    End If
End Sub

When I hit the breakpoint the first time, the .Text attribute shows that it is Notification which is exactly what it’s supposed to be as the header field. On the next break, and subsequent breaks, the .Text attribute is “”. Now, this grid is databound on Page_Load, but would that affect this? Wouldn’t the value have to be in the DataGridItemEventArgs for that record to be created? I know when I ViewSource of the page when I’m done it shows the information there, but I don’t know if that could be set after the table is drawn, but I doubt it. Any help would highly be appreciated. Thanks. Here’s the Page_Load and BindData functions just incase you need them.

Page_Load

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Page.IsPostBack Then
        'Do Nothing
    Else
        BindData("")
    End If
End Sub

BindData

Private Sub BindData(ByVal strSort As String)
    Dim tsDS As CustomDataSet = New CustomDataSet
    For Each dr As DataRow In tsDS.GetData("").Tables(0).Rows
        If dr.Item(2).ToString().StartsWith("Vacancy") Then
            dr.Delete()
        End If
    Next
    Dim dv As DataView = tsDS.GetData("").Tables(0).DefaultView

    If strSort.Length > 0 Then
       dv.Sort = strSort
    End If
    dgTasks.DataSource = dv
    dgTasks.DataBind()
End Sub

Here’s what I get on the first Item row.

enter image description here

Update: Fix

Protected Sub Item_DataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs) Handles dgTasks.ItemDataBound
    If e.Item.Cells.Count > 1 Then
        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
            Dim notification As String = DirectCast(DirectCast(e.Item.DataItem, System.Data.DataRowView).Row, Utilities.CustomDS.Row).Notification
            e.Item.Cells(7).Text = "<a href=""mailto:" & notification & """>" & notification.Replace(";", ";<br>") & "</a>"
        End If
    End If
End Sub
  • 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-19T23:51:58+00:00Added an answer on May 19, 2026 at 11:51 pm

    I believe that you want the ItemDataBound event. ItemCreated is when that row of the DataGrid is created. The controls are there, but that’s it. On the ItemDataBound event, the controls are bound to their data, and the data is available for access. If you have logic that depends on the bound data, use the ItemDataBound event, which fires after the ItemCreated event.

    You wire that up in the .aspx code by assigning the event handler name to the event, such as

    OnItemDataBound = "MyDataGrid_ItemDataBound"
    

    Within that event, you start by examining the type of item you are looking at.

    Then, you find the cell and control. And finally, you set the Text property to your altered text.

    Here is an example:

    protected void MyDataGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
    
    {
        if (e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
        {
           e.Item.Cells[3].Text == <assign your altered text here>
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question that has pretty much been asked here: asp.net mvc Html.ActionLink()
I'm pretty new to Python, so hopefully the problem I'm having has a simple
I have written a pretty simple Windows service in C# that starts up automatically
I have a CakePHP script that should hopefully be run by a cron job.
This should hopefully be a simple one. When using a date time picker in
Simple question, hopefully with a simple answer. I was under the impression I should
should be simple right? but have not found any anwsers :
I've got a small dilemma, that should hopefully be easy to resolve. I am
This should hopefully be a quick one. I have a StringBuilder like so: StringBuilder
This should hopefully be a simple one. I am trying to learn about the

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.