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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:17:42+00:00 2026-06-14T02:17:42+00:00

I would like to modify the text values after the data has been returned

  • 0

I would like to modify the text values after the data has been returned from the database, I need to modify the MBS1270 and the MBS1263 to look like the others when displayed in the datagrid.

SelectCommand="SELECT PartNumber as 'Part Number', OnhandStockLevel as 'In Stock', DueIn as 'In Production' FROM vw_Rb_FreeStock WHERE PartNumber = 'UFP-0390B' OR PartNumber = 'UFP-0690B' OR PartNumber = 'MBS1270' OR PartNumber = 'MBS1263'">

Now, I have used the javascript to replace the values in body load, however, this messes up the sorting of the datagrid and makes the new replaced values appear on top still, because ‘M’ comes before ‘U’, and it still sorts based on the old value.

Javascript:

 <script type="text/javascript">
    function modText(original, replace) {
        alert("Hello");
        var find = original;
        var repl = replace;
        var page = document.body.innerHTML;
        while (page.indexOf(find) >= 0) {
            var i = page.indexOf(find);
            var j = find.length;
            page = page.substr(0, i) + repl + page.substr(i + j);
            document.body.innerHTML = page;
        }
</script>

I want to replace the MBS values with values ‘UFP-1690B’ and ‘UFP-1290B’.

Is there any way to sort based on the replaced values? Or is there another approach I could take?
I tried to do something similar as to how you replace the column header using the ‘AS’ sql function but that failed, something like that would be perfect.

And no, I can’t change the raw database value.

Gridview code:

            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" 
                CellPadding="3" CssClass="style1" DataKeyNames="Part Number" 
                DataSourceID="SqlDataSource1" GridLines="Vertical">
                <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
                <Columns>
                    <asp:BoundField DataField="Part Number" HeaderText="Part Number" 
                        ReadOnly="True" SortExpression="Part Number" />
                    <asp:BoundField DataField="In Stock" DataFormatString="{0:0}" 
                        HeaderText="In Stock" SortExpression="In Stock" />
                    <asp:BoundField DataField="In Production" DataFormatString="{0:0}" 
                        HeaderText="In Production" ReadOnly="True" SortExpression="In Production" />
                </Columns>
                <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
                <AlternatingRowStyle BackColor="#DCDCDC" />
            </asp:GridView>
  • 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-14T02:17:43+00:00Added an answer on June 14, 2026 at 2:17 am

    A month has been since this, but thought I’d add a final answer for anyone else with a similar problem.

    I used the SQL REPLACE function, see: http://msdn.microsoft.com/en-us/library/ms186862.aspx

    After that I combined the original data with the replaced data using UNION.

    Final code:

    SELECT REPLACE(REPLACE(PartNumber, 'MBS1269', 'UFP-1290S'), 'MBS1262', 'UFP-1690S') AS PartNumber... (and so on)
    

    Output was absolutely perfect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to load a HTML document and modify it's text in PHP.
I would like to dynamically modify the values of certain form elements, more specifically
i would like modify text of xml tag value i have used an xml
I would like someone to modify the following code to save data to generate
I would like modify HTML like I am <b>Sadi, novice</b> programmer. to I am
I would like to modify an object private variable class Example(): __myTest1 = 1
We have a customer that would like to modify application user messages that we
I'm absolutely new to JavaScript and would like to modify a textarea of a
I'm using HighLine to write my console application and I would like to modify
I have code, similar to the following, that I would like to modify: Sub

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.