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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:43:49+00:00 2026-06-13T23:43:49+00:00

I have a button within a formview control on my page. Because the button

  • 0

I have a button within a formview control on my page.

Because the button is contained within the formview, my code-behind can’t see it.

So I did this:

Dim btnSave As Button = CType(fvCourse.FindControl("btnSave"), Button)

And then I added an event handler like this:

AddHandler btnSave.Click, AddressOf btnSave_Click

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Response.write("hey!")
End Sub

The problem is, I don’t think it’s working because I never see the “hey!” on my page.

Am I missing something?

Thanks

  • 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-13T23:43:50+00:00Added an answer on June 13, 2026 at 11:43 pm

    I don’t know about missing something, but I reckon you could do it a simpler way since you’re using VB. Give your button a command name and command argument first:

    <asp:Button ID="Button1" runat="server" onclick="Button1_Click"
    CommandArgument="1" CommandName="yes" />
    

    These can be anything – typically you use the command name to determine which button a user clicked on, and the command argument to show the record id.

    In your code-behind, attach a macro to the ItemCommand event of the FormView (which fires when something happens within it):

     Protected Sub FormView1_ItemCommand(sender As Object, e As System.Web.UI.WebControls.FormViewCommandEventArgs) Handles FormView1.ItemCommand
    
        Select Case e.CommandName.ToLower
            Case "yes"
    
                'test
                Label2.Text = "You chose " & e.CommandArgument.ToString
    
        End Select
    End Sub Protected Sub FormView1_ItemCommand(sender As Object, e As System.Web.UI.WebControls.FormViewCommandEventArgs) Handles FormView1.ItemCommand
    
        Select Case e.CommandName.ToLower
            Case "yes"
    
                'test
                Label2.Text = "You chose " & e.CommandArgument.ToString
    
        End Select
    End Sub
    

    And in VB, that’s all you need to do!

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

Sidebar

Related Questions

I have this situation of redirecting my asp page from a button within an
I am stuck at a small problem. I have this button within a form
I have a wizard control. When someone clicks a button within the wizard control
If I have a button within a iframe, how can I create a pop-up
Within my scenario, I have a button within an iframe section of my page
I have a button within my web page to inserts a few values into
I have a button that is within an updatepanel control. The button's click event
I have an asp.net page with a save button within an updatepanel and contenttemplate.
Given that I have a button within a div: <div id=result> <a href='#task5'> <img
I have a basic form with a search input and a submit button within.

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.