473,491 Members | 2,205 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Repeater with user control and postback

Hi,

I have i fishy problem when I have e Repeater with user controls.

page_load
{
if (!isPostBack)
{
repeater.databind();
}
}

A placeholder holds the user controls

When I do postback my Repeater is empty. I don't want to rebind my computer
on evry posback. The data should be in the viewstate....?

ex.
linkbutton_OnCommand(object sender, CommandEventArgs e)
{
foreach (RepeaterItem e in repSurveyObject.Items)
{
PlaceHolder plh= (PlaceHolder)e.FindControl("plh");
// This is empty... strange. If i remove the lines on page_load
// it works....
}
}
Any nice solution for this problem?

May 30 '06 #1
2 4813
Hi,

If you create controls dynamically you need to do it again in postback.

What is the functionality you want?
Do you really need to iterate in all the rows of the repeater?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Nemo" <Ne**@discussions.microsoft.com> wrote in message
news:51**********************************@microsof t.com...
Hi,

I have i fishy problem when I have e Repeater with user controls.

page_load
{
if (!isPostBack)
{
repeater.databind();
}
}

A placeholder holds the user controls

When I do postback my Repeater is empty. I don't want to rebind my
computer
on evry posback. The data should be in the viewstate....?

ex.
linkbutton_OnCommand(object sender, CommandEventArgs e)
{
foreach (RepeaterItem e in repSurveyObject.Items)
{
PlaceHolder plh= (PlaceHolder)e.FindControl("plh");
// This is empty... strange. If i remove the lines on page_load
// it works....
}
}
Any nice solution for this problem?

May 30 '06 #2
Hi,

I realy need to iterate all rows. I need to find the the control and then
the selected item.

Here is an exampel I have a survey page and on the page I itterate dynamic
questions. Evrey questiontype has diffrent user control. Ex. onechoice has a
repeater with radiobuttons, multichoice a repater with checkbox.

When I click on the Save button I need to find the select Item and Save. To
find the selected button I have to itterate the repeater.

foreach (RepeaterItem e in repSurveyObject.Items)
{
PlaceHolder plhSurveyObject =
(PlaceHolder)e.FindControl("plhSurveyObject");
if (plhSurveyObject.Controls.Count > 0)
{
// Any better solutions for this? Not nice tho compare
index...
// Can I compare Objects...?
#region OneChoice
if
(plhSurveyObject.Controls[0].ToString().IndexOf("onechoice") != -1)
{
OneChoice onechoice =
(OneChoice)plhSurveyObject.Controls[0];
// Get selected radio and so on....
}
}

Br. Nemo
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

If you create controls dynamically you need to do it again in postback.

What is the functionality you want?
Do you really need to iterate in all the rows of the repeater?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Nemo" <Ne**@discussions.microsoft.com> wrote in message
news:51**********************************@microsof t.com...
Hi,

I have i fishy problem when I have e Repeater with user controls.

page_load
{
if (!isPostBack)
{
repeater.databind();
}
}

A placeholder holds the user controls

When I do postback my Repeater is empty. I don't want to rebind my
computer
on evry posback. The data should be in the viewstate....?

ex.
linkbutton_OnCommand(object sender, CommandEventArgs e)
{
foreach (RepeaterItem e in repSurveyObject.Items)
{
PlaceHolder plh= (PlaceHolder)e.FindControl("plh");
// This is empty... strange. If i remove the lines on page_load
// it works....
}
}
Any nice solution for this problem?


May 31 '06 #3

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

Similar topics

3
2720
by: anon | last post by:
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...
5
8233
by: Scott Lyon | last post by:
I am having a strange problem. The program is a bit complex, but I'll try to simplify what I can. I apologize if this is complicated, but I think this would still be simpler than posting a bunch of...
8
4262
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
6
397
by: Christoph Boget | last post by:
Could someone point me to a resource that discusses how to set up other controls (input box, checkbox, drop down list), etc to be used in a Repeater? I'm not having a problem displaying text in...
1
5397
by: olduncleamos | last post by:
Hello all, I am experimenting with the repeater control and ran into something that I wasn't expecting. I would appreciate if the experts can confirm or correct my understanding. Here is a...
7
5463
by: charliewest | last post by:
Hello - I'm using a Repeater control to render information in a very customized grid-like table. The Repeater control is binded to a DataSet with several records of information. Within the...
2
3893
by: Alan Silver | last post by:
Hello, I have a form that contains a repeater. A simplified version of the ItemTemplate is shown below (air code)... <br><asp:Literal id="litID" runat="server" /> <br><asp:TextBox id="txtQty"...
4
15282
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
17020
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater...
0
7115
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
7154
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
7190
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...
1
6858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7360
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
5451
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
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
280
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.