Re: Need Help with a repeater and web custom control

Tech-Archive recommends: Fix windows errors by optimizing your registry

anon_at_anon.com
Date: 03/12/05


Date: Sat, 12 Mar 2005 13:57:44 -0800

Thanks, that helped. To answer how it is being used, I have a control
that is 5 radiobuttons. This control is going to be placed for each
question in a questionaire. I want to use the repeater to put the
control on the page as many times as is needed. each Questionaire has
a different number of questions and a dropdown list is how the user
selects which questionaire to use

On Sat, 12 Mar 2005 11:20:03 -0600, "DalePres"
<don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote:

>You can use the ItemDataBound event to set a property value in the
>RepeaterItem that you can retrieve when processing on PostBack.
>
>While you don't say much about how you're using the repeater or accessing
>the User Controls, a common method is to assign a value to the
>CommandArgument property of a Button in your RepeaterItem from within the
>ItemDataBound event handler. Then, in your event handler for ItemCommand,
>you can test the value of the CommandArgument or for whatever other property
>you set in your ItemDataBound handler. If your Button exists in the User
>Control then just expose the Button's CommandArgument property through the
>User Control.
>
>Also, if you use the ItemCommand event to trigger your processing, you can
>access the specific User Control instance by using something like this:
>
>MyUserControl myControl =
>(MyUserControl)e.Item.Controls[indexOfUserControl];
>
>That would give you access to the individual User Control.
>
>Don't make the mistake of using Item.Index to establish which item was
>clicked or which item you're responding to in your PostBack processing. If
>the database has changed then the contents of your Repeater.DataSource may
>not be the same in PostBack as they were initially.
>
>HTH
>
>DalePres
>MCAD, MCDBA, MCSE
>
>
><anon@anon.com> wrote in message
>news:ceb431hc6ej79le4k366lg2duu8e43fb98@4ax.com...
>>I am having a hard time with makeing what I am trying to do work. I
>> am making a questionaire web app. I have a custom control that has a
>> label and 5 radio buttons. My problem is that each different topic
>> for the questionaire is in a database and each questionaire will have
>> a different number of questions. I am trying to use a repeater to
>> creat multiple copies of the control, unfortunately when I do this the
>> different controls act like thay are the same. Can anyone give me a
>> way to do what I am trying? Thanks alot
>>
>


Quantcast