Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Wizard, goto page, need to set values of a control in a Repeater

Reply
Thread Tools

Wizard, goto page, need to set values of a control in a Repeater

 
 
David Thielen
Guest
Posts: n/a
 
      05-02-2006
Hi;

Inside a Repeater control I have a DropDownList control. If the user goes
through the wizard in page order, then in the OnItemCreated method I can set
the values in the list and it works great.

However, if they do a prev and change a value on the prev page, then when
they go back to the page with the Repeater I need to change the values in the
DropDownList that exists in each row of the Repeater.

How should I do this?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      05-03-2006
Hi Dave,

As for the Repeater control inside the Wizard Step, how did you perform
databinding on it? Based on my test, when we change the current active Step
in Wizard control, the certain selected Step will reinit the controls in
it, and seems we need to repeform the databinding. thus, the ItemCreated or
ItemDataBound event will fire.

In addition, for Repeater control after databound, we can use the its
"Items" collection to loop through all the items in it, and use FindControl
to locate any sub controls in each RepeaterItem. e.g:

protected void Button1_Click(object sender, EventArgs e)
{
Button btn = sender as Button;
Repeater rpt = btn.NamingContainer.FindControl("Repeater1") as
Repeater;

foreach (RepeaterItem item in rpt.Items)
{
Response.Write("<br/>Item: " +
item.FindControl("list1").ClientID);
((DropDownList)item.FindControl("list2")).Enabled = false;
}
}


Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
 
 
 
David Thielen
Guest
Posts: n/a
 
      05-03-2006
Hi;

Ok, you're right. The problem is a little different.

If I go to page 0, enter all the info, then click next, it first calls
Wizard.OnNextButtonClick and then Repeater.OnItemCreated. This works great as
it is in OnNextButtonClick that I get the data used in OnItemCreated.

However, if I do not enter all info in page 0, then click the wizard
shortcut on the right to go to page 1, then the shortcut to go back to page
0, then enter the info, it calls Repeater.OnItemCreated first and
Wizard.OnNextButtonClick second. So it is using the old data.

Is there a way to either: 1) Always get Wizard.OnNextButtonClick called
first or 2) in Wizard.OnNextButtonClick access each row in the repeater and
for each row, access a control?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com



"Steven Cheng[MSFT]" wrote:

> Hi Dave,
>
> As for the Repeater control inside the Wizard Step, how did you perform
> databinding on it? Based on my test, when we change the current active Step
> in Wizard control, the certain selected Step will reinit the controls in
> it, and seems we need to repeform the databinding. thus, the ItemCreated or
> ItemDataBound event will fire.
>
> In addition, for Repeater control after databound, we can use the its
> "Items" collection to loop through all the items in it, and use FindControl
> to locate any sub controls in each RepeaterItem. e.g:
>
> protected void Button1_Click(object sender, EventArgs e)
> {
> Button btn = sender as Button;
> Repeater rpt = btn.NamingContainer.FindControl("Repeater1") as
> Repeater;
>
> foreach (RepeaterItem item in rpt.Items)
> {
> Response.Write("<br/>Item: " +
> item.FindControl("list1").ClientID);
> ((DropDownList)item.FindControl("list2")).Enabled = false;
> }
> }
>
>
> Hope this helps.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Community Support
>
>
> ==================================================
>
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
>
> ==================================================
>
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      05-04-2006
Thanks for your response Dave,

Actually, the event sequence difference between the two times is due to the
ASP.NET server control's initlize and postback difference. Anyway, after
your repeater control has been databound, the data is stored in viewstate,
and when we switching between difference wizards, the repeater won't be
databound again(just recreate control structure and restore data from
viewstate). And if you want query or access each row (or a certain nested
control in each row), you can just use the code I mentioned in last reply.
e.g:

=========================================
protected void Wizard1_NextButtonClick(object sender,
WizardNavigationEventArgs e)
{

if (e.NextStepIndex == 2)
{
Repeater rpt = Wizard1.WizardSteps[2].FindControl("Repeater1")
as Repeater;

foreach (RepeaterItem item in rpt.Items)
{
Response.Write("<br/>Item: " +
item.FindControl("list1").GetType());

}
}

}
========================

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfering control without growing control context -- i.e. how toimplement GOTO Jens Axel Søgaard Javascript 25 07-06-2007 01:45 AM
Repeater control - how to access contained control values? dotnw@hotmail.com ASP .Net 4 05-28-2005 07:54 AM
Repeater control with nested repeater chris.reed@digus.com ASP .Net 0 02-11-2005 05:10 PM
Please HELP! Need to access textbox control values within a repeater control Darren Smith ASP .Net 5 05-10-2004 03:37 PM
How to goto a control David McCallum Java 1 10-15-2003 01:02 PM



Advertisments