Ask a Question related to ASP.NET Building Controls, Design and Development.
-
David Colliver #1
Losing user control
Hi all,
I am setting up a tab strip in an aspx page. I am using
link buttons to switch between the tabs (at the moment,
it is just link buttons, no tabs...)
Under each link button, I intend to add a usercontrol. I
have written one so far. I am adding the UC dynamically
in the button click event of my tab strip.
I am also setting properties and calling a method in the
UC.
My UC is set up like a wizard using back and next buttons
to go backwards and forwards.
However, on the first page of the UC, if I click next, I
lose the control altogethor.
I am assuming that I probably need to hold the UC in the
viewstate somehow, but I don't know how to do that.
Also, if I switch tabs and load a different UC, will I
lose what has been entered in the UC that is no longer
being viewed?
Here is my code...
The ApplicationOverviewLinkButton is the one that will be
one of my tab buttons.
private void
ApplicationOverviewLinkButton_Click(object sender,
System.EventArgs e)
{
UserControl MyRegistration =
(UserControl)LoadControl
("../CMSUserControls/nqt/registration.ascx");
RegistrationDetailPanel.Controls.Add
(MyRegistration);
((MyCMSApp.CMSUserControls.nqt.registration)
MyRegistration).LoggedInUser = "LoggedInUserName";
((MyCMSApp.CMSUserControls.nqt.registration)
MyRegistration).FillData();
RegistrationDetailPanel.Visible =
true;
MyRegistration.Visible = true;
}
Thanks for any help.
Regards,
Dave Colliver.
[url]http://www.IlfracombeFOCUS.com[/url]
~~
[url]http://www,FOCUSPortals.com[/url] - Portal franchises available
David Colliver Guest
-
user control problem access value from user control to a page
Thanks a lot for paying attention to my problem , i tell u the problem i have a main form in which i gave a login label that points to a... -
Losing Composite Control property that another Composite Control ...
Hi, I'm creating 2 composite controls in ASP.net. Control 1 is a Search control and control 2 is a Map control. I have added a property... -
Dynamically Adding User Control with Child User Control
I have a user control that has a child user control. If I drag this onto the page, it appears and functions normally. If I attempt to add the... -
Know in user control page_load if an user control event is going to be fired
Hi all, i have built a user control that shows a map and let the user zoom in, out, usual stuff. Putting this object in a webform the user can... -
Losing viewstate in custom control
I have a custom control I derived from the datagrid control and set a couple of values in viewstate("foo") = "bar" but on postback they are... -
Brock Allen #2
Re: Losing user control
Any controls you dynamically add to the page need to be recreated upon postback.
Here's a sample that shows how to "remember' across postbacks what controls
were added:
[url]http://groups-beta.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/5e4ba4cfe5902a4b/a5717a97bd32c450?q=brock+dynamic+controls+viewstat e&rnum=1[/url]
-Brock
DevelopMentor
[url]http://staff.develop.com/ballen[/url]
> Hi all,
>
> I am setting up a tab strip in an aspx page. I am using link buttons
> to switch between the tabs (at the moment, it is just link buttons, no
> tabs...)
>
> Under each link button, I intend to add a usercontrol. I have written
> one so far. I am adding the UC dynamically in the button click event
> of my tab strip.
>
> I am also setting properties and calling a method in the UC.
>
> My UC is set up like a wizard using back and next buttons to go
> backwards and forwards.
>
> However, on the first page of the UC, if I click next, I lose the
> control altogethor.
>
> I am assuming that I probably need to hold the UC in the viewstate
> somehow, but I don't know how to do that.
>
> Also, if I switch tabs and load a different UC, will I lose what has
> been entered in the UC that is no longer being viewed?
>
> Here is my code...
> The ApplicationOverviewLinkButton is the one that will be
> one of my tab buttons.
> private void
> ApplicationOverviewLinkButton_Click(object sender,
> System.EventArgs e)
> {
> UserControl MyRegistration =
> (UserControl)LoadControl
> ("../CMSUserControls/nqt/registration.ascx");
>
> RegistrationDetailPanel.Controls.Add
> (MyRegistration);
> ((MyCMSApp.CMSUserControls.nqt.registration)
> MyRegistration).LoggedInUser = "LoggedInUserName";
> ((MyCMSApp.CMSUserControls.nqt.registration)
> MyRegistration).FillData();
> RegistrationDetailPanel.Visible =
> true;
> MyRegistration.Visible = true;
> }
> Thanks for any help.
>
> Regards,
> Dave Colliver.
> [url]http://www.IlfracombeFOCUS.com[/url]
> ~~
> [url]http://www,FOCUSPortals.com[/url] - Portal franchises available
Brock Allen Guest
-
David Colliver #3
Re: Losing user control
Hi Brock,
Magic. :-)
I am assuming though that as the control is not held
during postback (or is it?) that I need to save the
content (forms on each page) at every single postback.
I noted you answered my question on the security group. I
need to supply more info as I don't think your current
reply really fits.
Best regards,
Dave Colliver.
[url]http://www.CardiffFOCUS.com[/url]
recreated upon postback.>-----Original Message-----
>Any controls you dynamically add to the page need to bepostbacks what controls>Here's a sample that shows how to "remember' acrossbeta.google.com/group/microsoft.public.dotnet.framework.as>were added:
>
>[url]http://groups-[/url]
pnet/browse_thread/thread/5e4ba4cfe5902a4b/a5717a97bd32c45
0?q=brock+dynamic+controls+viewstate&rnum=1using link buttons>
>-Brock
>DevelopMentor
>[url]http://staff.develop.com/ballen[/url]
>
>
>>> Hi all,
>>
>> I am setting up a tab strip in an aspx page. I amlink buttons, no>> to switch between the tabs (at the moment, it is justI have written>> tabs...)
>>
>> Under each link button, I intend to add a usercontrol.button click event>> one so far. I am adding the UC dynamically in thethe UC.>> of my tab strip.
>>
>> I am also setting properties and calling a method inbuttons to go>>
>> My UC is set up like a wizard using back and nextI lose the>> backwards and forwards.
>>
>> However, on the first page of the UC, if I click next,the viewstate>> control altogethor.
>>
>> I am assuming that I probably need to hold the UC inlose what has>> somehow, but I don't know how to do that.
>>
>> Also, if I switch tabs and load a different UC, will Ibe>> been entered in the UC that is no longer being viewed?
>>
>> Here is my code...
>> The ApplicationOverviewLinkButton is the one that willavailable>> one of my tab buttons.
>> private void
>> ApplicationOverviewLinkButton_Click(object sender,
>> System.EventArgs e)
>> {
>> UserControl MyRegistration =
>> (UserControl)LoadControl
>> ("../CMSUserControls/nqt/registration.ascx");
>>
>> RegistrationDetailPanel.Controls.Add
>> (MyRegistration);
>> ((MyCMSApp.CMSUserControls.nqt.registration)
>> MyRegistration).LoggedInUser = "LoggedInUserName";
>> ((MyCMSApp.CMSUserControls.nqt.registration)
>> MyRegistration).FillData();
>> RegistrationDetailPanel.Visible =
>> true;
>> MyRegistration.Visible = true;
>> }
>> Thanks for any help.
>>
>> Regards,
>> Dave Colliver.
>> [url]http://www.IlfracombeFOCUS.com[/url]
>> ~~
>> [url]http://www,FOCUSPortals.com[/url] - Portal franchises>
>
>
>.
>David Colliver Guest
-
David Colliver #4
Re: Losing user control
Hi Brock,
I just discovered a slight flaw...
Say I have 3 tabs. The first tab has a usercontrol that
in itself has more than 1 page. The second and third tab
have a simple single page usercontrol.
Now, if I go to the first tab, I can next and previous
the pages in the first user control OK.
If I switch to the second (or 3rd) tab, these switch OK.
If I now go back to the first one, this swiches OK, but
if I next the page on the first tab, then I get the
content of the 2nd/3rd tab also displayed.
This is incremental. If I switch to the 2nd tab, then
back to first, then page in the first, the 2nd tabs
usercontrol is added to the list, so for each tab switch,
I get more and more content on the page.
I think I need to somehow drop the items in the
DynamicContent arraylist, but now sure where I should do
this.
Cheers.
Dave Colliver.
[url]http://www.GreatYarmouthFOCUS.com[/url]
I>-----Original Message-----
>Hi Brock,
>
>Magic. :-)
>
>I am assuming though that as the control is not held
>during postback (or is it?) that I need to save the
>content (forms on each page) at every single postback.
>
>I noted you answered my question on the security group.s>need to supply more info as I don't think your current
>reply really fits.
>
>Best regards,
>Dave Colliver.
>[url]http://www.CardiffFOCUS.com[/url]
>
>>recreated upon postback.>>-----Original Message-----
>>Any controls you dynamically add to the page need to be>postbacks what controls>>Here's a sample that shows how to "remember' across>beta.google.com/group/microsoft.public.dotnet.framework.a>>were added:
>>
>>[url]http://groups-[/url]5>pnet/browse_thread/thread/5e4ba4cfe5902a4b/a5717a97bd32c4usercontrol.>0?q=brock+dynamic+controls+viewstate&rnum=1>using link buttons>>
>>-Brock
>>DevelopMentor
>>[url]http://staff.develop.com/ballen[/url]
>>
>>
>>>>> Hi all,
>>>
>>> I am setting up a tab strip in an aspx page. I am>link buttons, no>>> to switch between the tabs (at the moment, it is just>>> tabs...)
>>>
>>> Under each link button, I intend to add anext,>I have written>button click event>>> one so far. I am adding the UC dynamically in the>the UC.>>> of my tab strip.
>>>
>>> I am also setting properties and calling a method in>buttons to go>>>
>>> My UC is set up like a wizard using back and next>>> backwards and forwards.
>>>
>>> However, on the first page of the UC, if I clickI>I lose the>the viewstate>>> control altogethor.
>>>
>>> I am assuming that I probably need to hold the UC in>>> somehow, but I don't know how to do that.
>>>
>>> Also, if I switch tabs and load a different UC, willwill>lose what has>>> been entered in the UC that is no longer being viewed?
>>>
>>> Here is my code...
>>> The ApplicationOverviewLinkButton is the one that>be>available>>> one of my tab buttons.
>>> private void
>>> ApplicationOverviewLinkButton_Click(object sender,
>>> System.EventArgs e)
>>> {
>>> UserControl MyRegistration =
>>> (UserControl)LoadControl
>>> ("../CMSUserControls/nqt/registration.ascx");
>>>
>>> RegistrationDetailPanel.Controls.Add
>>> (MyRegistration);
>>> ((MyCMSApp.CMSUserControls.nqt.registration)
>>> MyRegistration).LoggedInUser = "LoggedInUserName";
>>> ((MyCMSApp.CMSUserControls.nqt.registration)
>>> MyRegistration).FillData();
>>> RegistrationDetailPanel.Visible =
>>> true;
>>> MyRegistration.Visible = true;
>>> }
>>> Thanks for any help.
>>>
>>> Regards,
>>> Dave Colliver.
>>> [url]http://www.IlfracombeFOCUS.com[/url]
>>> ~~
>>> [url]http://www,FOCUSPortals.com[/url] - Portal franchises>.>>
>>
>>
>>.
>>
>David Colliver Guest
-
Brock Allen #5
Re: Losing user control
> I am assuming though that as the control is not held during postback
As long as you recreate the controls like I showed in the sample from the> (or is it?) that I need to save the content (forms on each page) at
> every single postback.
link, they do hold their own state. You should not have to manually reset
their state. That would defeat the whole purpose of using server controls.
-Brock
DevelopMentor
[url]http://staff.develop.com/ballen[/url]
Brock Allen Guest
-
Brock Allen #6
Re: Losing user control
> If I now go back to the first one, this swiches OK, but if I next the
This sounds like a flaw in how the tab controls tracks which tab it should> page on the first tab, then I get the content of the 2nd/3rd tab also
> displayed.
be on.
-Brock
DevelopMentor
[url]http://staff.develop.com/ballen[/url]
Brock Allen Guest



Reply With Quote

