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 6751723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:57:39+00:00 2026-05-26T12:57:39+00:00

I know I must be missing something. If I make changes to a datagriditem

  • 0

I know I must be missing something. If I make changes to a datagriditem in the ItemDataBound event of the RadGrid the changes are not visible the first time the page loads, I don’t see the changes to the DataItem until I refresh the grid via the CommandItem for refresh. I have verified that the ItemDataBound event is fired and the values that I am replacing do infact have the correct values.

background:
I have a class that creates the RadGrid. It is then instantiated and loaded into the .aspx page via the code behind for the .aspx. This is a master/detail datagrid if that makes any difference.

protected void Page_Init(object source, EventArgs e)
{
    this.__activeBatchesRadGrid = ActiveBatchesRadGrid.GridDefinition("ActiveBatchesRadGrid");
    this.PlaceHolder1.Controls.Add(this.__activeBatchesRadGrid);
    this.__activeBatchesRadGrid.ItemDataBound += new GridItemEventHandler(ActiveBatchesRadGrid_ItemDataBound);
}

private void ActiveBatchesRadGrid_ItemDataBound(object sender, GridItemEventArgs e)
{
    GridDataItem _dataItem = e.Item as GridDataItem;
    if (_dataItem == null) return;

    BatchStatusType _batchStatus = EnumUtils.GetValueFromName<BatchStatusType>(_dataItem["BatchStatusName"].Text);

    Dictionary<BatchStatusType, BatchStatusType> _batchStatusTypes = 
        BatchTransitions.GetBatchStatusTransition(_batchStatus);

    GridButtonColumn _btnPromote =
        ((GridButtonColumn) this.__activeBatchesRadGrid.MasterTableView.GetColumn("MasterPromoteRecord"));

    GridButtonColumn _btnDelete =
        ((GridButtonColumn)this.__activeBatchesRadGrid.MasterTableView.GetColumn("MasterDeleteRecord"));

    foreach (KeyValuePair<BatchStatusType, BatchStatusType> _item in _batchStatusTypes)
    {
        _btnPromote.Text = _item.Value.ToString();
        _btnPromote.ConfirmText = string.Format("Are you sure you want to promote this batch to {0} status?",
                                               _item.Value);

        _btnDelete.Text = string.Format("Demote batch to {0} status.", _item.Key.ToString());
        _btnDelete.ConfirmText = string.Format("Are you sure you want to demote this batch to {0} status?",
                                              _item.Key);
    }
}
  • 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-26T12:57:39+00:00Added an answer on May 26, 2026 at 12:57 pm

    I thought I would post the solution I put together that takes care of this problem. I do however, still believe that the proper implementation that I originally posted should work. If it works for all items other than the first datagrid row then I believe there is a shortcoming in the control.

    private void ActiveBatchesRadGrid_ItemDataBound(object sender, GridItemEventArgs e)
    {
        GridDataItem _dataItem = e.Item as GridDataItem;
        if (_dataItem == null) return;
        if (_dataItem.KeyValues == "{}") { return; }
        int _counter = 0;
    
        Dictionary<String, String> _batchStatusTypes =
            BatchTransitions.GetBatchStatusTransition(
                EnumUtils.GetValueFromName<BatchStatusType>(_dataItem["BatchStatusName"].Text));
    
        //accessing the cell content directly rather than trying to access the property of the GridEditCommandColumn
        ((ImageButton)(((GridEditableItem)e.Item)["MasterEditrecord"].Controls[0])).ImageUrl = "/controls/styles/images/editpencil.png";
    
        //accessing the cell content directly rather than trying to access the property of the GridButtonColumn            
        ImageButton _imgbtnPromote = (ImageButton)((GridDataItem)e.Item)["MasterPromoteRecord"].Controls[0];
        ImageButton _imgbtnDelete = (ImageButton)((GridDataItem)e.Item)["MasterDeleteRecord"].Controls[0];
        foreach (KeyValuePair<String, String> _kvp in _batchStatusTypes)
        {
            if (_counter == 0)
            {
                const string _jqueryCode = "if(!$find('{0}').confirm('{1}', event, '{2}'))return false;";
                const string _confirmText = "Are you sure you want to change the status of this batch {0}?";
                _imgbtnPromote.Attributes["onclick"] = string.Format(_jqueryCode, ((Control) sender).ClientID,
                                                                     string.Format(_confirmText, _kvp.Value),
                                                                     _kvp.Value);
                _imgbtnDelete.Attributes["onclick"] = string.Format(_jqueryCode, ((Control) sender).ClientID,
                                                                    string.Format(_confirmText, _kvp.Key), _kvp.Key);
                _counter++;
                continue;
            }
    
            _imgbtnPromote.ImageUrl = "~/controls/styles/images/approve.png";
            _imgbtnPromote.ToolTip = string.Format("{0} batch", _kvp.Value);
            _imgbtnDelete.ImageUrl = "/controls/styles/images/decline.png";
            _imgbtnDelete.ToolTip = string.Format("{0} batch", _kvp.Key);
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know I must be missing something simple, but I am not seeing it.
I know SQL well but I must be missing something really dumb here. This
Okay, I know I must be missing something obvious here. Here's the sample code
I'm new to Python, and I know I must be missing something pretty simple,
I know I must be missing something here, but I cannot seem to get
I know I must be missing something, but can't figure out what. When I
I know I must be missing something, but in a while statement how does
I know I must be missing something really obvious here. B.GetInstance().Call() generates the error:
My .NET application (VB.NET 3.5 if you really must know) forms do not properly
I tried searching for information on this, but must not know the right terms

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.