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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:01:38+00:00 2026-06-13T18:01:38+00:00

I have the following GridView <asp:GridView ID=GridView1 runat=server AllowPaging=True OnRowCommand=GridView1_RowCommand DataKeyNames=Chart_Id AutoGenerateColumns=False EnableModelValidation=True >

  • 0

I have the following GridView

 <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
      OnRowCommand="GridView1_RowCommand" DataKeyNames="Chart_Id" 
      AutoGenerateColumns="False" EnableModelValidation="True" >

      <Columns>
          <asp:CommandField ShowEditButton="False" ShowDeleteButton="False" ShowInsertButton="False" />
                        <asp:BoundField DataField="Week" HeaderText="Week" SortExpression="Week" />
                        <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" ItemStyle-Wrap="False" />
                        <asp:BoundField DataField="Host" HeaderText="Host" SortExpression="Host" />
                        <asp:BoundField DataField="Topic_1" HeaderText="Topic 1" SortExpression="Topic_1" />
                        <asp:BoundField DataField="Topic_2" HeaderText="Topic 2" SortExpression="Topic_2"
                            HeaderStyle-Wrap="False" />
                        <asp:BoundField DataField="Topic_3" HeaderText="Topic 3" SortExpression="Topic_3" />
                        <asp:BoundField DataField="Topic_4" HeaderText="Topic 4" SortExpression="Topic_4" />
      </Columns>


 </asp:GridView>

By default, I have the edit/insert/cancel buttons set to false.

Then in the code behind, I want to be able to set these to true during certain conditions.

    string theUser = Helpers.GetUser();
    string admin = "adminName";

    if (theUser == admin) {

       // Set the buttons to true  

    }

I’ve been looking for ways to do this, and someone suggested to use the AutoGenerate properties, and then enable them like so:

 GridView1.AutoGenerateEditButton = true;
 GridView1.AutoGenerateDeleteButton = true;
 GridView1.AutoGenerateInsertButton = true; // This one throws an error

Only problem is, AutogenerateInsertButton does not seem to exist, in the main ASPX page or in the code behind.

Can anyone suggest some ways for me to access these properties and set them to true?

Thank you.

  • 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-13T18:01:39+00:00Added an answer on June 13, 2026 at 6:01 pm

    Why do you think that a GridView should have an AutoGenerateInsertButton property?

    A GridView is a list of GridViewRows, where each row represents a record/element/item which can be edited or deleted. But it doesn’t make sense to have a insert-button for each record because it already exists.

    You could follow this tutorial which shows how to use the footer-row of the GridView to insert a new record.

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

Sidebar

Related Questions

I have the following aspx code; <asp:GridView ID=GridView1 runat=server AllowPaging=True AllowSorting=True AutoGenerateColumns=False DataKeyNames=ProductId DataSourceID=edsinventory
i have the following gridview <asp:GridView ID=GridView3 runat=server AllowPaging=True AllowSorting=True AutoGenerateColumns=False DataKeyNames=ID DataSourceID=CommentsDataSource> <Columns>
I have a simple gridview <asp:GridView ID=GridView1 runat=server DataKeyNames=OriginatorID AutoGenerateColumns=False AllowPaging=True OnPageIndexChanging=GridView1_PageIndexChanging PageSize=5 OnPreRender=GridView1_PreRender>
I have the following aspx: <asp:GridView ID=GridView1 runat=server AutoGenerateColumns=False BorderStyle=None Font-Names=Verdana Font-Size=12px OnSelectedIndexChanged=GridView1_SelectedIndexChanged ShowHeader=False
I have following Gridview: <asp:GridView ID=GridView1 runat=server CssClass=table DataKeyNames=groupId DataSource=<%# dsUserGroupsSelected %> DataMember=Group etc....>
I have the following GridView and ObjectDataSource: <asp:GridView ID=grdTrades runat=server DataSourceID=srcTrades DataKeyNames=tradeId EnablePersistedSelection=true SelectedRowStyle-BackColor=Yellow
I have a gridview as follows: <asp:GridView ID=gv runat=server SelectMethod=gv_GetData AllowPaging=true AllowSorting=true AutoGenerateColumns=true> </asp:GridView>
The .aspx: <asp:GridView ID=gvFirst runat=server AutoGenerateColumns=false AllowPaging=true ondatabound=gvFirst_DataBound > <Columns> <asp:BoundField DataField=ID HeaderText=ProductID/> <asp:BoundField
ok the following is the code for the gridview: <asp:GridView ID=GridView1 runat=server AutoGenerateColumns=False BorderColor=#3399FF
i have a gridview table like this... <div> <asp:GridView ID=GridView1 runat=server AllowSorting=true OnSorting=TaskGridView_Sorting >

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.