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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:50:57+00:00 2026-06-02T10:50:57+00:00

NOTE: I’m a beginner web developer, somewhat familiar with PHP. I’ve been curious about

  • 0

NOTE: I’m a beginner web developer, somewhat familiar with PHP. I’ve been curious about ASP.NET and wanted to give it a go.

Now, I’m attempting to little library application that displays a table like the following:

Title                - Author        - Status
The Eye of the World - Robert Jordan - Checked Out
The Great Hunt       - Robert Jordan - Check Out
The Dragon Reborn    - Robert Jordan - Check Out

I have created a DataSet, and a TableAdapter that performs the following query:

SELECT        books.SerialNumber, books.Title, books.Author, CheckedOut.cardNumber
FROM            books LEFT OUTER JOIN
                         CheckedOut ON books.SerialNumber = CheckedOut.SerialNumber

I do this so that I can get either NULL or the cardNumber for use below.

Here is the current state of my main page:

    <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="Browse.aspx.cs" Inherits="_Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="SerialNumber,cardNumber" DataSourceID="ObjectDataSource1" 
        OnRowDataBound="browseMethod"
        AllowPaging="True" onselectedindexchanged="GridView1_SelectedIndexChanged">
        <Columns>
            <asp:BoundField DataField="SerialNumber" HeaderText="SerialNumber" 
                InsertVisible="False" ReadOnly="True" SortExpression="SerialNumber" 
                Visible="False" />
            <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
            <asp:BoundField DataField="Author" HeaderText="Author" 
                SortExpression="Author" />
            <asp:BoundField DataField="cardNumber" HeaderText="cardNumber" 
                SortExpression="cardNumber" Visible="False" />
            <asp:TemplateField HeaderText="Status">
                <ItemTemplate>
                    <asp:Button ID="Button1" runat="server" 
                        CommandArgument='<%# Eval("cardNumber") %>' 
                        Text="Check Out" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
</asp:GridView>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetLibraryBooks" 
        TypeName="DataSet1TableAdapters.DataTable1TableAdapter">
    </asp:ObjectDataSource>
</asp:Content>

I want to be able to change the “Check Out” button to a label (“Checked Out”) when the “cardNumber” value for that row is NULL. Also, how can I create an event when each button is called, and grab the correct SerialNumber?

  • 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-02T10:51:02+00:00Added an answer on June 2, 2026 at 10:51 am

    You can create another control label and sets its visibity to false.You have already defied command argument for the button.Give a command name too .

    <asp:Button ID="Button1" runat="server"                          CommandArgument='<%# Eval("cardNumber") %>'          CommandName="CheckOut"                 Text="Check Out" /> 
    

    In the gridview_rowCommand callback check for the command Name and do the operations.Set the visibility of button to false there and label to true.ANother option woulb be to enable/disable button as discussed in answer above with disabled style being made in a way such that it looks like a label.For grid view command argument refer the follwoing link :-
    http://msdn.microsoft.com/en-us/library/bb907626.aspx

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

Sidebar

Related Questions

note from N00B land again. I have read lots about sorting arrays - wanted
Note The question below was asked in 2008 about some code from 2003. As
Note the tag: VBA , not VB6, not VB.NET. This is specific to VBA
NOTE: program in java, server uses php, and mysql...file is .log or .txt file
(Note: This post has been edited to show specific use case. See bottom.) I
Note: I'm a backend (Java) developer by trade and work in Clojure in my
Note: To answer this question, you shouldn't have to know anything about Selenium or
note: this question is related to PostGIS and Postgresql and is implemented with PHP
Note the second line in this GHCi session. What is it about the Latitude
Note bene: I realize this is an immensely complicated question with about a million

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.