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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:02:01+00:00 2026-06-03T07:02:01+00:00

This is very strange. I have a gridview with item template checkboxes and buttons

  • 0

This is very strange. I have a gridview with item template checkboxes and buttons in each row. I am toggling the text value of the buttons (using JQuery) representing the user adding rows to a cart of items for purchase. I have a button on the form seperate from the gridview which when clicked raises an event in the code behind to spin through the rows and process the selected (toggled button text) rows. But what is happening is upon pressing the process button the grid rows are reverting back to their original states (original button text and also modified line attributes for the previously selected rows). I am not rebinding the grid. This is also not an update grid. Now the checkboxes have always worked just fine but the button text is obviously very different. Can anybody tell me why this is happening and how I may correct it? One idea I have is to create a column of hidden checkboxes and when I toggle my button text, I can toggle the checkboxes as well. But I sure wish I could understand why this is happening. Also, on the postback from the process button having been checked, the screen is rendered in it’s original state as well.

Here is my grid with the checkboxes and buttons:

        <div class="OneHundredPercentWide" style="padding-top:7px">
        <asp:Panel ID="Panel1" runat="server" Width="100%" >
            <asp:GridView id="grvSessionOrderDownloads" runat="server" BorderWidth="2px" BorderStyle="Solid" BorderColor="#C0C0FF"
                Font-Names="Arial" Font-Bold="True" Font-Size="8pt" GridLines="Horizontal" AutoGenerateColumns="False" 
                HorizontalAlign="Left" ForeColor="Blue" CellPadding="2" AllowSorting="True" Width="100%" 
                OnRowDataBound="grvSessionOrderDownloads_OnRowDataBound" DataKeyNames="SORD_ID">

                <HeaderStyle Font-Names="Arial" HorizontalAlign="Center" ForeColor="White" BackColor="#152EE5" 
                    CssClass="sessionOrderDownloadHeaders" />
                <RowStyle BackColor="White" ForeColor="#333333" />
                <AlternatingRowStyle BackColor="#A5B0FF" />
                <Columns>
                    <asp:BoundField Visible="False" DataField="SORD_ID" HeaderStyle-Width="0px" >
                <HeaderStyle Width="0px" />
                    </asp:BoundField>
                   <asp:TemplateField HeaderText="Select <br /> Files" HeaderStyle-ForeColor="White" > 
                 <ItemTemplate >
                            <asp:CheckBox ID="chkSelectVideo" runat="server" OnClick="checkboxClicked(this)" ToolTip="Select file for download" 
                                Enabled='<%# Eval("SORD_EnableSelectionCheckBox") %>' Checked='<%# Eval("SORD_SelectedForDownloadFlag") %>' />
                  </ItemTemplate>
                        <HeaderStyle Width="6%" />
                        <ItemStyle VerticalAlign="Middle" HorizontalAlign="Center" />
                    </asp:TemplateField><asp:TemplateField HeaderText="Prior <br /> Downld" HeaderStyle-ForeColor="White" > 
                        <ItemTemplate >
                            <asp:Button id="btnBuy" runat="server" OnClientClick="btnBuyToggle(this); return false;"
                                 Text="BUY This" CssClass="buyButton" Visible='<%# Eval("SORD_ShowBuyButton") %>' />
                         </ItemTemplate>
                        <HeaderStyle Width="7%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" VerticalAlign="Middle" HorizontalAlign="Center" />
                    </asp:TemplateField>
                </Columns>
             </asp:GridView>

And here is part of my code behing to check the button text:

Dim gvr As GridViewRow
    For Each gvr In grvSessionOrderDownloads.Rows
        Dim selBtn As Button = CType(gvr.FindControl("btnBuy"), Button)
        If Not selBtn Is Nothing Then
            If selBtn.Enabled And selBtn.Visible Then
                Dim strSORD_ID As String = grvSessionOrderDownloads.DataKeys(gvr.RowIndex)("SORD_ID").ToString
                If selBtn.Text = "BUY Video" Then
                    // Note: I will process here
                End If
            End If
        End If
    Next

Thank you,
Jim

  • 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-03T07:02:02+00:00Added an answer on June 3, 2026 at 7:02 am

    The checkbox changes are posted back to the server once they are changed in the browser. But when you change the text of the button (or other fields) in the grid using JS, the changed button text (or other fields) is not sent to the server. Hence when the button is rendered in the next post back, it uses the original default value which is “BUY This”.

    In order to retain the button text, you would have to create a hidden field along with the button. When you change the text of the button (in OnClientClick JS event), change the value of the hidden field simultaneously. The hidden field changes are sent to the server which helps you to read them on the process button click event.

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

Sidebar

Related Questions

it is very strange, because this error doesn't happen all the time... I have
Starting from Android 3.2 I have this strange problem. It's very easy to reproduce:
This is very very strange. Basically, i'm using ASP.NET. What I want is to
I have this very strange problem while compiling the project. MOC seems to be
I have this very strange issue with my MVC 2 project. Often times, I'll
This seems very strange to me but I have a script that I'm running
I have a very strange issue with PHP. I run this very simple code:
This is very strange. I have an XAML file that looks as follows... <Window
This is very strange. I've got a simple form. I have a file input
I have this very strange problem on a big flex app where it would

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.