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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:23:15+00:00 2026-06-15T11:23:15+00:00

I am still learning about using gridviews and as it is, I have an

  • 0

I am still learning about using gridviews and as it is, I have an access database that consists of three tables(as part of the exercise) and display the values fields from all three tables using a join statement.

conn = new OleDbConnection(@"Provider=Microsoft.Jet.OleDb.4.0;
                                Data Source =" + Server.MapPath("App_Data\\Shopping List.mdb"));
        conn.Open();

        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('a connection was established with the database')", true);

        DataSet ds = new DataSet();

        OleDbDataAdapter dba = new OleDbDataAdapter(@"SELECT Ingredient.IngredientId, Ingredient.IngredientName,  Area.AreaName, Recipe.RecipeName, Ingredient.Quantity 
                                                FROM (Ingredient
                                                INNER JOIN Area ON Ingredient.AreaId = Area.AreaId)
                                                INNER JOIN Recipe ON Ingredient.RecipeId = Recipe.RecipeId", conn);

        dba.Fill(ds);

        gridIngredients.DataSource = ds;
        gridIngredients.DataBind();

I now added a the edit button by setting the autoGenerateEditButton to true. How would I go about in adding a textbox or dropdownlist to a row to update the data?

<asp:GridView ID="gridIngredients" runat="server" AutoGenerateColumns="False" 
        BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" 
        CellPadding="2" ForeColor="Black" GridLines="None" 
    AutoGenerateEditButton="True" 
    onselectedindexchanged="gridIngredients_SelectedIndexChanged" 
    Width="543px" onrowediting="gridIngredients_RowEditing">
        <Columns>
            <asp:BoundField DataField="IngredientId" HeaderText="ID" />
            <asp:BoundField DataField="IngredientName" HeaderText="Ingredient" />
            <asp:BoundField DataField="AreaName" HeaderText="Area" />
            <asp:BoundField DataField="RecipeName" HeaderText="Recipe" />
            <asp:BoundField DataField="Quantity" HeaderText="Quantity" />
        </Columns>
        <FooterStyle BackColor="Tan" />
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" 
            HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:GridView>

regards

  • 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-15T11:23:16+00:00Added an answer on June 15, 2026 at 11:23 am

    For readonly fields, like IngredientId, add a ReadOnly=”True”
    For fields edited by text box, like Quantity.
    For special editors, like dropdownlist or jQuery plugin, use TemplateField to customize your EditItemTemplate(For edit) and ItemTemplate(For view)

        <asp:BoundField DataField="IngredientId" HeaderText="ID" ReadOnly="True" /> 
        <asp:BoundField DataField="Quantity" HeaderText="Quantity"/>    
        <asp:TemplateField HeaderText="Area">
            <EditItemTemplate>
                <asp:DropDownList ID="DDLArea" runat="server" 
                    Text='<%# Bind("AreaCode") %>'>
                    <!--items--> 
                  </asp:DropDownList>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" 
                    Text='<%# Eval("AreaName") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am still learning Ruby on Rails, but have a general question about using
I'm still learning about complexity measurement using the Big O Notation, was wondering if
I'm still learning about jQuery, but I have not been able to find a
I'm still learning here and have a question about child collections. I have an
I've just starting using the Amazon Web Services (AWS) and I'm still learning about
I'm still learning a lot about PHP and string alteration is something that is
I'm still learning about Objective-C memory management. I'm trying to implement several simple classes
i'm a newbie in dropbox development in IOS, i'm still learning about implementing dropbox
I was learning about property, I read various documents but still not clear about
I'm still relatively new to hadoop, and I've been learning a bit about it

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.