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


Finding a Placeholder Control inside a Repeater on Postback

Posted on 2011-10-28
Medium Priority
Last Modified: 2012-05-12
I have a custom control placed inside a repeater. I want to get access to the values stored in it and find it on postback. But when I search for it within the placeholder on the button click event, it returns Nothing.

I want to get the value of the combobox as selected by the user prior to the submit.

See my code attached. Thanks.
Protected Sub btnSave_Click(sender As Object, e As System.EventArgs) Handles btnSave.Click
        If Not Page.IsValid Then Exit Sub
        Dim ph As New PlaceHolder
        ph = CType(rptItem.FindControl("RepeaterName"), PlaceHolder)
        For Each phc As Control In ph.Controls
            ' try to obtain by the ID
            If phc.ID = "MYID" Then
                Dim cmb As ICombo = CType(phc, ICombo)
                Dim valueId As Integer = CInt(cmb.GetAnswer)
            End If
            ' try to obtain by checking the interface type
            If TypeOf phc Is ICombo Then
                Dim cmb As ICombo = CType(phc, ICombo)
                Dim valueId As Integer = CInt(cmb.GetAnswer)
            End If
        end if
    End Sub

Open in new window

Question by:Starr Duskk
  • 2
LVL 20

Assisted Solution

ddayx10 earned 2000 total points
ID: 37048360
You need to post a simplified version of your repeater, also show the placement of your BtnSave(s).

What is the indicator we are looking for that the particular combobox was selected by the user and is therefore the one we want?

If you have multiple BtnSave's I can see how you are expecting to determine this, but otherwise it's going to be a main focus of how to get this working.

Anyway need some code and then we can see what other questions/solutions arise.

Accepted Solution

Starr Duskk earned 0 total points
ID: 37071649
I decided to skip the repeater and just use a placeholder and loop through a collection from a datareader and add to a placeholder.


Author Closing Comment

by:Starr Duskk
ID: 37092867
don't think it's possible. looked everywhere. came up with another solution.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question