Note that there are some explanatory texts on larger screens.

plurals
  1. PODo FormViews not respond to commands issued from an ImageButton?
    primarykey
    data
    text
    <p>I am using ImageButtons in place of LinkButtons in a FormView to issue New/Edit/Delete/Cancel commands, but they don't seem to have an effect on the FormView.</p> <p>The ImageButtons will cause a postback but the FormView mode doesn't change from the current mode.</p> <p>I'm sure the ImageButtons were working at one point, but I've been busy with other pages for a while. The only thing that's changed between now and then are some patches I installed in Visual Studio.</p> <p>I haven't been able to find any information related to this issue other than this: <a href="http://www.codeproject.com/KB/webforms/TamingTheFormView.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/webforms/TamingTheFormView.aspx</a> In that article there's an onclick method for an ImageButton that's used to change the FormView mode.</p> <p>Would that be the only way to use ImageButtons instead of LinkButtons in a FormView?</p> <p>Here are some code fragments:</p> <pre><code>&lt;asp:FormView ID="CourseFormView" runat="server" DataKeyNames="CourseCode" DataSourceID="CourseSqlDataSource" ondatabound="CourseFormView_DataBound"&gt; &lt;ItemTemplate&gt; &lt;table&gt;...&lt;/table&gt; &lt;asp:ImageButton ID="EditCourseImageButton" CssClass="image_button" runat="server" CommandName="Edit" ImageUrl="~/images/icons/pencil.png" /&gt; &lt;/ItemTemplate&gt; &lt;/asp:FormView&gt; </code></pre> <p>Codebehind:</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["code"] == null || Request.QueryString["code"] == "") { CourseFormView.ChangeMode(FormViewMode.Insert); CourseCodeTitleLabel.Visible = false; CourseTitleTitleLabel.Text = "Add a new course..."; SchedulePanel.Visible = false; } } </code></pre> <p>There is no other code for processing the buttons. I had created some empty event handlers for the FormView to see what was happening - ModeChanging, ModeChanged, and ItemCommand. None of them were being called when I clicked on the ImageButton, but everything worked fine if I used a LinkButton.</p> <p>I'm not doing anything complicated - I just want the FormView to respond to basic ImageButton commands.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload