AspxGridView reset the filelds at runtime

I am using DevExpress Gridview bound to a SqlDataSource. At run time based on a field 'SchoolType' whose possible values are N or D; I want to change N to Non-Denom and D to Denom. I have tried the following the code to find the value but I can't figure out how to set or display the value as Denom or Non-Denom? Any ideas? Thanks

 protected void gvSchools_HtmlRowCreated(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e)
        {
            if (e.RowType != DevExpress.Web.ASPxGridView.GridViewRowType.Data) return;
            string str = (string)gvSchools.GetRowValues(e.VisibleIndex, "SchoolType");

            if (str == "N")
            {
// how to set the value?
         
            }

        }
mmalik15Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

_Katka_Commented:
Hi, you have to hook the view event, CustomCellDisplayText() you should get e.Value in the args, and set e.DisplayText.


regards,
Kate
0
_Katka_Commented:
Little correction it is CustomColumnDisplayText event.

regards,
Kate
0
_Katka_Commented:
Here is the sample code:

1) hook the event on your form

gvSchools.CustomColumnDisplayText += gvSchools_CustomColumnDisplayText;

protected void gvSchools_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e)
{
  if (e.Column.FieldName != "SchoolType") return;
 
  switch (e.Value.ToString())
  {
    case "D":
      e.DisplayText = "Denom";
      break;

    case "N":
      e.DisplayText = "Non-Denom";
      break;

    default:
      throw new NotSupportedException();
  }
}

regards,
Kate
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

mmalik15Author Commented:
Thanks so much!
0
_Katka_Commented:
You're welcome :)

regards,
Kate
0
_Katka_Commented:
One note, checkout the DevExpress support forum, you'll find all your answers there

http://www.devexpress.com/Support/Center/

Choose product group: ASP.NET
And your product: like ASPxGridView and Editors Suite

I'm developing with DevExpress for 8+ years, but I'm there daily. A new problem every day. :)

regards,
Kate
0
mmalik15Author Commented:
Thanks again :) Will try that in future :))
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.