473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

UserControl with databound repeater drops values on postback

Hi all,

I have a user control that contains a repeater that generates a list of
check boxes. The checkboxes render fine, but they don't maintain their
checked state on postback.

I've tried using Page_Load, Page_Init, OnInit, enabling and disabling
viewstate without success. Any help would be appreciated.

Thanks,

Paul

ASCX:

<asp:Repeater ID="countryList" runat="server">
<HeaderTemplate>
<table cellpadding="2" cellspacing="0">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><asp:CheckBox ID="countryID" Value='<%# Eval("CountryID") %>'
runat="server" /></td>
<td><asp:Label AssociatedControlID="countryID" runat="server"><%#
Eval("Name") %></asp:Label></td>
<td><img src="<%# string.Format("/images/flags/{0}.gif",
Eval("CountryID")) %>" height="13" width="24" /></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>

ASCX.CS:

protected void Page_Init(object sender, EventArgs e)
{
// get countries
countryList.DataSource = Country.GetCountries();
DataBind();
}

Sep 1 '06 #1
0 1060

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: labelle | last post by:
I have two divs on an aspx, and each DIV holds a repeater which holds a UserControl. On the left hand side, I have a "feature list" with an "add to cart" button, and on the right hand side, a...
0
by: Axel Dahmen | last post by:
Hi, I've created a UserControl containing an <asp:Repeater> control, containing an <asp:Checkbox> control: /------------------------- <asp:Repeater Runat="server" ID="propRpt"> ...
1
by: Fraggle | last post by:
I have a repeater with controls added at run time. the <template> also contains a <asp:textbox that is made visible on some repeater elements. when I come to read the text info out it has...
9
by: Anders K. Jacobsen [DK] | last post by:
Hi I have this that adds some usercontrol (UCTodays.ascx) to a placeholder foreach(A a in B){ UCTodays ucline = (UCTodays )LoadControl("UCTodays.ascx");...
0
by: Matt Howeson | last post by:
I have a problem with a usercontrol that is dynamically loaded, from a web control and is not restoring it's viewstate properly. Here's the scenario. Within our content management system, I have...
2
by: Tim_Mac | last post by:
hi, i have an aspx page which dynamically loads a user control and adds it to a placeholder. the control is recreated and added to the placeholder for postbacks as well. the user control...
4
by: Dennis E. Jones, Jr. | last post by:
I'm creating a dynamic control for each row in a REPEATER based on database values. ItemDataBound creates the control for the initial load (not postback), but I cannot get the control recreated...
1
by: Jeremy | last post by:
Hello All, I have a Repeater which contains a Dynamic DropDownList within its itemtemplate. I know I have struggled with this before and I am pretty sure I had to save a bunch of crap manually...
1
by: jf4m | last post by:
I have a repeater (which has only an usercontrol in its itemtemplate) that will allow the user to add rows to itself. To do this without losing any already existing data, i am saving values from the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.