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

  • Home
  • SEARCH
  • 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 233225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:04:59+00:00 2026-05-11T20:04:59+00:00

ive had a few questions on this subject, still having problems. I want to

  • 0

ive had a few questions on this subject, still having problems.

I want to find the values from a number of dropdown and textbox controls inside a repeater control.

db.ConnectionString = SystemConnString
    db.Open()

    Dim selectedAdTitle As String = ""
    Dim enteredAdFullName As String = ""

    cmd.Parameters.Add(New SqlParameter("@TransactionID", TransactionID))
    cmd.Parameters.Add(New SqlParameter("@AdTitle", selectedAdTitle))
    cmd.Parameters.Add(New SqlParameter("@AdFullName", enteredAdFullName))

    For i As Integer = 0 To myRepeater.Items.Count - 1

        Dim AdTitle As DropDownList = DirectCast(myRepeater.Items(i).FindControl("AdTitle"), DropDownList)
        Dim AdFullName As TextBox = DirectCast(myRepeater.Items(i).FindControl("AdFullName"), TextBox)

        selectedAdTitle = AdTitle.Text
        enteredAdFullName = AdFullName.Text

        cmd.Parameters("@AdTitle").Value = selectedAdTitle
        cmd.Parameters("@AdFullName").Value = enteredAdFullName

        SQL = ""
        SQL = SQL & "INSERT INTO InsuredPersons (TransactionID,Title,FullName) VALUES ("
        SQL = SQL & "@TransactionID,"
        SQL = SQL & "@AdTitle,"
        SQL = SQL & "@AdFullName"
        SQL = SQL & ")"

        cmd.CommandText = SQL
        cmd.Connection = db
        cmd.ExecuteNonQuery()
    Next

AdTitle and AdFullName dont seem to be bringing across the values. There is no error so they have found the control ok. Below is the ASPX file code.

<asp:Repeater ID="myRepeater" runat="server">
    <ItemTemplate>
        <asp:DropDownList ID="AdTitle" runat="server">
            <asp:ListItem Selected="True" Value="" Text=""/>
            <asp:ListItem Selected="False" Value="Miss" Text="Miss"/>
            <asp:ListItem Selected="False" Value="Ms" Text="Ms"/>
            <asp:ListItem Selected="False" Value="Mrs" Text="Mrs"/>
            <asp:ListItem Selected="False" Value="Mr" Text="Mr"/>
            <asp:ListItem Selected="False" Value="Other" Text="Other"/>
        </asp:DropDownList>

       <asp:TextBox ID="AdFullName" runat="server"></asp:TextBox>
   </ItemTemplate>

Edit:

Repeater is constructed on page load

    Dim repeatTimes((TotalAdInsured - 1)) As Integer

    myRepeater.DataSource = repeatTimes
    myRepeater.DataBind()

DirectCast is done on button click

Protected Sub continueButtonDetails_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles continueButtonDetails.Click

Answer: Had to put IsPostback around Repeater Construction.

If Not IsPostBack() Then

        Dim repeatTimes((TotalAdInsured - 1)) As Integer

        myRepeater.DataSource = repeatTimes
        myRepeater.DataBind()

    End If
  • 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-11T20:04:59+00:00Added an answer on May 11, 2026 at 8:04 pm

    First off I think you want:

    myDropDown.SelectedItem.Text
    

    Rather Than

    myDropDown.Text
    

    Also why do you have two ItemTemplates? I didn’t know you could even do that…

    Are you interacting with any of the TextBoxes or DropDowns at any other point during the page lifecycle?

    Try putting a PostBack check around the repeater databinding. I think whats happening is your loading the controls dynamically, therefore they have no viewstate, therefore the values will always be empty.

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

Sidebar

Related Questions

ok, ive had a few questions on this subject, i hope Im clearer this
I was looking at this code and had a few questions. I did some
I've had a few questions about MEF recently, but here's the big one --
I've had quite a few problems with IE6 and our website. http://www.sweetlets.com/w/solutions/click-stream/features/ At the
I've had troubles for a few days already with handling form that contains dropdown
I know this a really stupid question. I've had a good few years experience
I've had quite a few problems and know that I can get some good
I've had a look around and I have found a few questions like mine
This had been bending my mind in the last few days. I also wasn't
Had this question on Serverfault for a few days with no luck. I've run

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.