[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

Copy Value from Drop List to Text Box

I have a drop list and a text box on a user control.
I need to copy the value  selected by the user in the drop list to the textbox
I am getting an error CS1061: 'ASP.user_control_ascx' does not contain a definition for droplist_SelectedIndexChanged1' and no extension method.

Thank you for your help.
0
jordanhelen
Asked:
jordanhelen
  • 5
  • 3
1 Solution
 
käµfm³d 👽Commented:
Did you declare the handler droplist_SelectedIndexChanged1 in your code-behind?
0
 
jordanhelenAuthor Commented:
Did not get a complete answer.  Need more detail, or reason for the error.
0
 
käµfm³d 👽Commented:
Did not get a complete answer.  Need more detail, or reason for the error.
Come on...  if I ask, "did you declare the hanlder (i.e. function) droplist_SelectedIndexChanged1 in your code-behind," then the reason you got the error is that you did not declare the handler in your code behind...  which means you need to.

If you need clarification on any answer, please ask for one. You won't hurt my, or any one else's feelings here if you do.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
jordanhelenAuthor Commented:
Don't mean to offend . . .

But on previous occasions when I had to answer a question in response to my question I never received an answer or it took a very long time.  I am kind on in a crunch and need a resolution asap so I looked elsewhere.  I still have not resolved the problem.

Yes I did declare

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack Then
            Label1.Text = DropDownList1.SelectedValue
        End If

    End Sub

I am still getting the originally mentioned error.

Thanks!
0
 
käµfm³d 👽Commented:
Yes I did declare

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack Then
            Label1.Text = DropDownList1.SelectedValue
        End If

    End Sub

I am still getting the originally mentioned error.
That is a Page.Load handler. That has nothing to do with a DropDownList.SelectedIndexChanged handler. I would expect to see something like:

Protected Sub DropDownList_SelectedIndexChanged1(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
    ' Do something on selected index changed.
End Sub

Open in new window

0
 
käµfm³d 👽Commented:
Actually, you probably don't need the Handles clause on that method since it appears you "attached" the handler in the .aspx (markup) page.
0
 
jordanhelenAuthor Commented:

This is what I have for the drop list.

  Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged

        Label1.Text = DropDownList1.SelectedValue

    End Sub

Can you think of what is causing the error?  The page does not run.  
0
 
käµfm³d 👽Commented:
Where did you define that handler?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now