Вот история:
У меня есть 2 панели обновления. UpdatePanel 1 имеет раскрывающийся список, который имеет свои собственные функции. UpdatePanel2 имеет Divs для функциональности вкладки jQuery.
Вот фрагменты кода:
ASPX
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table style="width: 100%;">
<tr>
<td class="LabelColumn">
<asp:Label ID="Label11" runat="server" Text="Company"></asp:Label>
</td>
<td>
<asp:DropDownList ID="CompanyDropDownList" runat="server" Width="300px" OnSelectedIndexChanged="CompanyDropDownList_SelectedIndexChanged" AutoPostBack="True">
</asp:DropDownList>
</td>
<td> </td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<div id="tabs">
<ul style="width: 200px">
<li><a href="#MultiPurposeForm">Multi Purpose Form</a></li>
<li><a href="#LeaveApplicationForm">Application For Leave</a></li>
</ul>
<div id="MultiPurposeForm">
<table>
<tr>
<td class="auto-style3">
<asp:Label ID="LabelHeader" runat="server" Text="Multi Purpose Form"></asp:Label>
<asp:Panel ID="MultiPurposeFormPanel" runat="server" Visible="True" OnLoad="MultiPurposeFormPanel_Load1">
<!-- Many controls come here -->
</asp:Panel>
</td>
</tr>
</table>
</div>
<div id="LeaveApplicationForm">
<asp:Label ID="Label4" runat="server" Text="Application for Leave"></asp:Label>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
Javascript
<script type="text/javascript">
function pageLoad(sender, args)
{
$(document).ready(function () {
$("#tabs").tabs();
//$("#dialog").dialog();
});
}
</script>
Код за
protected void CompanyDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
this.ClearEmployeeDetails(true);
this.ListEmployeesCheckBox.Checked = false;
this.EmployeeSelectionDropDownList.Visible = false;
if (this.CheckLoggedInUserForHRCoordinator())
{
this.ListEmployeesCheckBox.Enabled = true;
}
else
{
this.ListEmployeesCheckBox.Enabled = false;
this.EmployeeSelectionDropDownList.Visible = false;
}
}
protected void MultiPurposeFormPanel_Load1(object sender, EventArgs e)
{
this.PopulateMPDocumentCategories();
}
private void PopulateMPDocumentCategories()
{
if (this.MPDocumentCategoryDropDownList.Items.Count == 0)
{
MultiPurposeDocumentEntityService documentService =
new MultiPurposeDocumentEntityService();
MultiPurposeDocumentCollection documentCollection =
documentService.GetAll();
foreach (var document in documentCollection)
{
this.MPDocumentCategoryDropDownList.Items.Add(new ListItem(document.Title,
document.Id.ToString()));
}
if (this.MPDocumentCategoryDropDownList.Items.Count != 0)
{
this.PopulateMPDocumentList(this.MPDocumentCategoryDropDownList.SelectedItem.Text);
}
}
}
Когда страница загружается в первый раз, все работает нормально. Однако после выбора элемента в раскрывающемся списке UpdatePanel1 я не могу увидеть MultiPurposeFormPanel. Я могу видеть только LabelHeader.
Любая идея, почему это происходит?
Если бы set visible = false срабатывал каждый ответ. Извините за то, что вы не спешите.