|
Rank: Advanced Member Groups: Member
Joined: 10/31/2007 Posts: 51
|
Hi,
Hopefully some one can help.
I have a page with a tabstrip with a multipage and pageviews, all inside a callbackpanel.
The tabstrip RasieSefverEvents = True the callbackpanel trigger contains the tabstrip.
I can happily load usercontrols onto the pageviews in the callback_excute method when the tabstrip is triggered.
My problem occurs when I what to trigger a tabstrip item change from the child usercontrol. I created a event for the child usercontrol and when it is fired I set the tabstip.selectedindex to the required tab. The code is executed but does not change the tabstrip. I've tested the change of tabstrip.seletctedindex on a button and it works fine.
can anyone help?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, I can think of two situations that can cause this problem: 1. The event is not correctly fired. Server event are often not fire correctly when you dynamically loads controls. To fire a server event correctly, you must reload the dynamically loaded controls when the page posts back. For example, the following code will not work:
Code: C#
private void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Button button = new Button();
button.Click += new EventHandler(OnButtonClick);
Panel1.Controls.Add(button);
}
}
The reason that it does not work is because when the page posts back, the button is not recreated. 2. The event is correctly fired, but the TabStrip is not updated. If you use a CallbackPanel and trigger a callback instead of a postback, you can update everything on the server side during the callback, but only those inside the CallbackPanel will be transfered back to the client. So if the TabStrip is outside of the Callback and you udpated its SelectedIndex inside the CallbackPanel, that won't work either. You would need to either change it to postback or move the TabStrip inside the CallbackPanel; Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 10/31/2007 Posts: 51
|
Not sure I explained my issue properly
The usercontrol fires it's event ok and the parent page executes the code . I've stepped thru
I'm using the following to trigger a tab change
this.tsMainItems.Items[1].RaisesServerEvent = EO.Web.NullableBool.True;
Note the usercontrol is on tab 0 of the parent page tabstrip. and i want it's event to go to tab 1 when I fire an event on the usecontrol on tab 0.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Can you elaborate what you mean by "I want it's event to go to tab 1"? You can make the tab to switch to tab 1 by setting its SelectedIndex, but I don't know what you mean by "event go to tab 1". If you want to trigger ItemClick event on tab 1, then there is no need for you to do so. You are already on the server side, just call whatever you were calling in your ItemClick event handler.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 10/31/2007 Posts: 51
|
Sorry about my vague description.
A) I had a web page with a tabstrip multip page and pageviews much like the example in the online documentation, but a Callbackpanel wrapped aroun it all.
B) I was pre-loading the 1st pageview with a user control that also contained the same structure i.e. Callbackpanel Tabstrip MultiPage PageView1 PageView2
The user control has a custom event which is triggered in the parent page (A). This code was executing but not applied to the screen.
When I removed the CallbackPanel from the usercontrol (B). The code works fine.
The Callback panel on the Page (A) handles enough of the sscreen refresh for it not be an issue.
Thanks Anyway
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
That can be normal. I am guessing the event source in UserControl(B) is set as a trigger of the CallbackPanel in UserControl(B). This way when it triggers, it would call all server side events handlers as if the CallbackPanel does not exist, but will only update the region inside UserControl(B) --- which is the way CallbackPanel intended to work. There is nothing wrong with the configuration itself, our demo project works pretty much the same way.
In your case, you would need to have the event source to trigger the CallbackPanel in the parent page (A), not in user control (B). You wouldn't be able to do this with Triggers property since they belong to different code units. You can do so by calling eo_Callback client side function. You can find detailed documentation about this function in online documentation and sample code in default.aspx in our demo project.
Thanks
|
|