473,386 Members | 1,798 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,386 software developers and data experts.

Controls in UserControl: why empty?

Hi,

I've created a UserControl containing an <asp:Repeater> control, containing an <asp:Checkbox> control:

/-------------------------
<asp:Repeater Runat="server" ID="propRpt">
<ItemTemplate>
<tr><td>
<asp:CheckBox Runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Descr iption")%>' TextAlign="Right"/>
<asp:Literal Runat="server" Visible="False" Text='<%#DataBinder.Eval(Container.DataItem,"ID")% >'/>
</td></tr>
</ItemTemplate>
</asp:Repeater>
\-------------------------
On Page_Load (!PostBack), the <asp:Repeater> gets filled by database:

/-------------------------
propRpt.DataSource=...;
propRpt.DataBind();
\-------------------------
On PostBack I want to iterate through the checkboxes to retrieve their values:

/-------------------------
foreach (RepeaterItem ri in propRpt.Controls)
{
if (((CheckBox)ri.Controls[1]).Checked)
ret[idx++]=Convert.ToInt16(((TextBox)ri.Controls[2]).Text);
}
\-------------------------

However, "(CheckBox)...Checked" always yields false!?! Can someone please enlighten me on the reason? What did I do wrong?

Even more strange: If the page is displayed on Postback, the checked Checkboxes are actually displayed as being checked...
I'm having the same problem with a second UserControl of mine which is resembling the first but uses Textboxes instead of the Checkbox. I can't evaluate their values, too. Nonetheless, after PostBack they show the values I've entered. So it's not kind of an "EnableViewState problem".

TIA,
Axel Dahmen

Nov 17 '05 #1
0 1816

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

Similar topics

6
by: Ben | last post by:
Hi I've got a problem with a custon control that inherits form the UserControl class and that used the overlib javascript library. The control works well in a standard form but when I used it in...
6
by: TomislaW | last post by:
How to find all user controls (ascx) loaded on a Page?
2
by: Ric | last post by:
im new to asp.net. from what i understand, you have the aspx file (presentation), user-control(ascx file), code-behind(vb file) and components(compiled vb and dll files). the aspx file contains a...
0
by: jonelling | last post by:
I am having a problem where the page load event is not being fired for certain user controls that I load dynamically in placeholders. Here is what I'm doing in brief, with full test code supplied...
3
by: Tumurbaatar S. | last post by:
Hi! I created some user control (ASCX) and it works fine. The control is created one of subfolders of my project, so its namespace looks like: namespace myproject.subfolder1 { public class...
8
by: mark.norgate | last post by:
I've run into a few problems trying to use generics for user controls (classes derived from UserControl). I'm using the Web Application model rather than the Web Site model. The first problem...
1
by: Kyle K. | last post by:
Environment: Visual Studio 2005 + WinXP Pro SP2 + .NET 2.0 I am new to creating user controls and have a (hopefully) simple question. I have a series of personal questions (first/last name,...
1
by: rudjohn | last post by:
I've been tasked with the not-enviable job of creating an application with multiple, semi-customizable templates. My basic concept, thus far, has been a combination of Master Pages (for layout) and...
8
by: Brad Pears | last post by:
I am working on a contract generation application for our log home business. I have a main form that has many controls on it including tabbed controls, panes etc... When the user decides they...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.