views:

308

answers:

2

Hi all, Wondering if someone here can help. I have an AJAX tabcontainer which has a number of tabs and each tab contains a user control. When I add a new item from one of the tabs, it is not reflected in the user control in another tab unless a postback occurs. (e.g. the first tab has a listview where I add a new record and the second has a simple form which contains a drop-down which I expect to contain value added from first tab). How can I make the tabcontainer to refresh its tabs from a usercontrol? Any help will be most appreciated.

Thanks, Ali

A: 

You could fire an event from your first user control so that the page can handle this event and tell the other usercontrol to databind

Here is a example

<act:TabContainer ID="TabContainer2" runat="server" CssClass="EmployeeProfile" ActiveTabIndex="0">
<act:TabPanel ID="TabPanel1" runat="server" HeaderText="Datos Generales">
  <ContentTemplate>
    <br />
    <uc1:EmployeeGeneralDetails ID="EmployeeGeneralDetails2" runat="server" OnUpdated="EmployeeGeneralDetails2_OnUpdated" />
  </ContentTemplate>
</act:TabPanel>
<act:TabPanel ID="TabPanel2" runat="server" HeaderText="Referenias Personales">
  <ContentTemplate>
    <uc3:EmployeeResumeView ID="EmployeeResumeView2" runat="server" />
  </ContentTemplate>
</act:TabPanel>
</act:TabPanel>

 protected void EmployeeGeneralDetails2_OnUpdated(object o, EventArgs e)
{
  EmployeeResumeView2.DataBind();
}
alejandrobog
A: 

Hello alejandrobog, Thanks for your response and sorry for returning to post after so many days (Had it working with page reload on every action due to some deadlines). Your solution seems convincing, however, when I do EmployeeResumeView2.DataBind(); in the OnUpdated method, the dropdownlists insdie the user control get bound twice, that is, if there were items A,B in the ddlist, it becomes A,B,A,B when this code is run and A,B,A,B,A,B if it is run again. Whats the work around for this in this case?

Ali