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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:24:49+00:00 2026-06-15T17:24:49+00:00

Here is my code : protected void CallCardStatus_RowDataBound(object sender, GridViewRowEventArgs e) { var thisRow

  • 0

Here is my code :

protected void CallCardStatus_RowDataBound(object sender, GridViewRowEventArgs e)
{
    var thisRow = e.Row;
    if (e.Row.RowType == DataControlRowType.DataRow)
    {

         switch (thisRow.Cells[11].Text)
         {
              case "MBMK":
                        thisRow.Cells[9].Text = "JBPM MELAKA";
                        break;
              case "IPBJMA":             
                        thisRow.Cells[9].Text = "JBPM KUALA LUMPUR";
                        break;
              case "JBPMBJ":
                        thisRow.Cells[9].Text = "JBPM SELANGOR";    
                        break;
                    default:
                        break;
           }

      }
 }

here is the a part of markup for my gridview.

 <asp:GridView ID="CallCardStatus" runat="server" AutoGenerateColumns="False"
    OnRowDataBound="CallCardStatus_RowDataBound" HorizontalAlign="Center" 
    OnRowCommand="CallCardStatus_RowCommand" 
    DataKeyNames="call_card_no" Width="100%" 
         <Columns>
                <asp:BoundField DataField="call_city_desc" HeaderText="City" 
            meta:resourcekey="BoundFieldResource4">
                    <HeaderStyle BackColor="#666666" BorderColor="#999999" BorderStyle="Groove" 
                BorderWidth="4px" Font-Names="Arial Narrow" Font-Size="Large" 
                HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Font-Names="Arial Narrow" BorderColor="#999999" 
                BorderStyle="Inset" BorderWidth="2px" Font-Size="10pt" />
                </asp:BoundField>
                <asp:BoundField DataField="owner_department_code" HeaderText="PSCC" 
                    Visible="False" />
            </Columns>
        </asp:GridView>

I want to change value in the gridview. I had tried the code above but it’s not working. Kindly please help..Siti..:)

  • 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-06-15T17:24:50+00:00Added an answer on June 15, 2026 at 5:24 pm

    write your logic in code behind method and call that method as follows:

    if you are using template filed then call method as follows:

      <asp:TemplateField HeaderText="Column_Name" SortExpression="Column_Name">
      <ItemTemplate>
      <asp:Label ID="Label1" runat="server" 
          Text='<%# YourMethodName(Eval("DatabaseFiledName")) %>'></asp:Label>
      </ItemTemplate>
     </asp:TemplateField>
    

    Or if you are using boundField Then

    <asp:BoundField DataField="<%#YourMethodName(Eval("DatabaseFiledName")) %>" HeaderText="Column_Name" ReadOnly="True" SortExpression="Column_Name"/>
    

    and your code behind method will be:

    public string YourMethodName(object strValue)
     {
        string retString ="";
    
       switch (Convert.ToString(strValue))
         {
              case "MBMK":
                    retString "JBPM MELAKA";
                   break;
              case "IPBJMA":             
                       retString = "JBPM KUALA LUMPUR";
                        break;
              case "JBPMBJ":
                       retString  = "JBPM SELANGOR";    
                        break;
                    default:
                        break;
    
              return retString;
           }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here’s my code behind: protected void gvviewapproval_RowUpdated(object sender, GridViewUpdatedEventArgs e) { using (SqlConnection cn
Here is my code: protected void Page_Load(object sender, EventArgs e) { if (!Session[Authenticated] )
Here is my code: protected void Page_Load(object sender, EventArgs e) { if (Session[ DistID
Here is my code: public partial class Image : System.Web.UI.Page { protected void Page_Load(object
I am using the below code protected void lnk_Click(object sender, EventArgs e) { try
Why does the titlebar overlap the pixels of JPanel. Here some code: protected void
Here is the code for the button click event; Protected Sub CompetenciesButton_Click(ByVal sender As
Here is my code: new Loading.LoadTast(ctx) { @Override protected String doInBackground(Integer... params) { Looper.prepare();
Here's the code: <?php class Order extends Zend_Db_Table_Abstract { protected $_name = 'orders'; protected
Here's the code: <?php class Order extends Zend_Db_Table_Abstract { protected $_name = 'orders'; protected

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.