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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:40:32+00:00 2026-05-16T03:40:32+00:00

Edit – Thanks for your replies so far and sorry for not stating exactly

  • 0

Edit – Thanks for your replies so far and sorry for not stating exactly what the problem was. The actual markup code is

<asp:DetailsView ID="dvwSomeDetailsView" runat="server" 
  AutoGenerateRows="False" DataSourceID="SomeDataSourceID">
  <Fields>
    <asp:TemplateField HeaderText="SomeText" SortExpression="SomeText">
      <EditItemTemplate>
        <cc1:Editor ID="txtDescription" runat="server" 
          Content='<%# Bind("SomeText") %>' />
      </EditItemTemplate>
      <ItemTemplate>
        <asp:Label ID="lblDescription" runat="server" 
          Text='<%# Bind"SomeText") %>'></asp:Label>
      </ItemTemplate>
    </asp:TemplateField>

    <asp:CommandField ButtonType="Image" CancelImageUrl="~/img/cancel.png" 
      EditImageUrl="~/img/edit.png" InsertImageUrl="~/img/insert.png"
      UpdateImageUrl="~/img/save.png" ShowEditButton="True" />
</asp:DetailsView>

I’m not too sure whether setting the ShowEditButton property should be removed, but when I tried to do that I still couldn’t set it programmatically.

Now in the code behind file I reduced the Page_Load method to this

protected void Page_Load( object sender, EventArgs e )
{
  dvwSomeDetailsView.AutoGenerateEditButton = true;
}

What I want to achieve is that by changing the assignment in the Page_Load method I can hide / show the Edit button, but that does not work. When playing around in the markup file I can make the button show up or hide, but I can never change it from the code behind file.

I also tried to explicitly call dvwSomeDetailsView.DataBind after setting the property, but this also didn’t work. Overriding OnPreRender and placing the code from the Page_Load method in their didn’t do anything to improve this either.

Maybe I’m thinking too complicated – shouldn’t there be an easy way to set programmatically whether the button should / shouldn’t show?

Thanks in advance for any comments.

Gorgsenegger

  • 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-16T03:40:32+00:00Added an answer on May 16, 2026 at 3:40 am

    If the code redacted behind the

    [... Some Stuff...]
    

    contains a call to detailsView.DataBind() (either directly or through Page.DataBind()), then that is your problem. The AutoGenerateEditButton property must be set prior to calling DataBind on the DetailsView.

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

Sidebar

Related Questions

EDIT: Sorry about ellipsis that's not what I actually have. For declaring an array
EDIT: Problem solved... and unrelated to the phrasing of the question... sorry for the
EDIT - I was able to fix this problem using code from 'Farray' with
EDIT: Thanks Akshat and Jefferey for your help and advice. I'm going to re-ask
Edit (updated question) I have a simple C program: // it is not important
EDIT: Changed as I have a different issue with the same code 2nd Edit:
EDIT I had a problem a while ago writing a program in C which
Edit: I just moved my HTTPRequest code into the onCreate, and now all of
EDIT: I'd like to get a definitive answer on whether or not it's possible
EDIT: I rephrased the question because I have not explained well. Let's see if

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.