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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:19:34+00:00 2026-06-07T23:19:34+00:00

I am trying to put a – what seems – very simple web user

  • 0

I am trying to put a – what seems – very simple web user control

basically i want it to render as a dropdownlist/checkboxlist or radiolist based on a property
but also want to be able to work out what is selected

i was trying the following – but cant seem to work out how to attach to the selectedindexchanged of the listcontrol so that i can set the selectd value(s)
its not helping that my VB is not up to much but am forced to use it in this instance
its not even giving me the intellisense for the event..

   Public Options As List(Of Options)
    Public ControlRenderType As ControlRenderType
    Public IncludeFreeOption As Boolean
    Public SelectedOptions As List(Of Options)

    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

        Dim c As ListControl
        Select Case (ControlRenderType)
            Case STGLib.ControlRenderType.CheckBoxList
                c = New CheckBoxList()
            Case STGLib.ControlRenderType.DropdownList
                c = New DropDownList()
            Case STGLib.ControlRenderType.RadioButtonList
                c = New RadioButtonList()

            Case Else
                Throw New Exception("No Render Type Specified")
        End Select

        For Each opt In Options
            Dim li = New ListItem(opt.Description, opt.ID)
            c.Items.Add(li)
        Next

        c.SelectedIndexChanged += ..?? or something
        Page.Controls.Add(c)

    End Sub

can anyone explain please – it is of course quite possible that I am going about this in completely the wrong way..

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-07T23:19:36+00:00Added an answer on June 7, 2026 at 11:19 pm

    First create a Sub or a Function to handle the IndexChange of the object that you have created dynamically and make sure that the signature of the Sub is something like this

    Sub myOwnSub(ByVal sender As Object, ByVal e As EventArgs)
    ...
    ...  Handle your event here
    ...
    End Sub
    

    Then after you create your object add the following code

    Dim obj as ListBox
    AddHandler obj.SelectedIndexChanged, AddressOf myOwnSub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying put ads inside my blogger post & i want my data
When trying to put a simple ImageButton on stage, It didn't seem to detect
I am trying to put log message in the native code of Web kit
I am trying to put log4j in a web application in Tomcat 7. I
I was trying to put the difference between websites and web services (irrespective of
I am trying to put a Contract on a method call. My web application
Im trying to put the contents of a simple command in to a bash
I am currently trying to put together a simple Illustrator plugin, and coming from
I'm trying put an if statement directly into a select field in rails, with
Trying to put a regex expression together that returns the string between _ and

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.