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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:47:01+00:00 2026-05-27T04:47:01+00:00

I have data that gets displayed in gridview. If I’m pulling it from one

  • 0

I have data that gets displayed in gridview. If I’m pulling it from one table I want it to be read/write, but from the other just read. I have a SqlDataSource that can spit out some text based on the origin, and yes the text it spits out is accurate. So I put a label and a textbox in an itemtemplate in gridview, and both have visible properties set to a public bool.

The problem is that this doesn’t always line up. Sometimes on data of one property switches to the other form (ie, read-only data is displayed as a textbox), but it’s not everytime so it’s not a simple “screwed up my if statement” problem. The display state will often be the opposite of the displayed text.

<asp:TemplateField HeaderText="Next Price" SortExpression="newdata">
    <ItemTemplate>
        <asp:TextBox ID="ReadWrite" runat="server" 
            Text='<%# Bind("newdata", "{0:N2}") %>' Width="60px"
            class="calculate" onchange="calculate()"
            Visible='<%# ShowBox %>'></asp:TextBox>
        <asp:Label ID="ReadOnly" runat="server" Text='<%# Bind("newdata", "{0:N2}") %>'
            Visible='<%# ShowLabel %>'></asp:Label>
    </ItemTemplate>
</asp:TemplateField>

The code behind it:

protected void MasterDisplay_DataBound(object sender, EventArgs e)
{
    DataSourceSelectArguments sr = new DataSourceSelectArguments();
    DataView dv = (DataView)CheckForCommit.Select(sr);
    if (dv.Count != 0)
        CommittedOrNot.Text = dv[0][0].ToString();
    //for displaying where data is pulled from
}

public bool ShowBox
{
    get
    {
        return (CommittedOrNot.Text == "This has not yet been committed.");
    }
    private set { }
}

public bool ShowLabel
{
    get { return (CommittedOrNot.Text != "This has not yet been committed."); }
    private set { } 
}

Any ideas what’s causing this disconnect?

  • 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-27T04:47:01+00:00Added an answer on May 27, 2026 at 4:47 am

    Turns out I just needed to add UpdateRows and a DataBind in Commit_Click

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

Sidebar

Related Questions

I have a AJAX post method that gets xml data from server. But when
I have a gridview setup that gets its data from a SQL database stored
I have a GridView that gets populated with data from a SQL database, very
First I have a PHP file that gets data and file from a HTML
I currently have a DetailsView in ASP.NET that gets data from the database based
We have a web application that gets its data from a certain database. The
I have a Django app that gets it's data completely from an external source
If have a piece of code that gets some data from a sql database
I have a web scraping script that gets new data once every minute, but
I have a Visual Studio 2005/ C# ClickOnce application that gets all its data from a

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.