当我点击链接按钮时,它不会显示来自数据库的数据...如果我从数据库更新的部分是在选项卡式面板之外,那么它工作正常...我猜有些问题是因为js(标签面板)......任何想法?
ASPX代码
<script type="text/javascript">
var hh;
var left;
function pageLoad(sender, args) {
if (args.get_isPartialLoad()) {
//Default Action
hh = '<div id="convertThis">' + $("#convertThis").html() + '</div>';
var tab1 = $("#convertThis").advancedTabs({
tabPosition: 'top',
visibleTabItem: 3,
whereAmI: false,
width:728,
hideTabs: true
});
}
}
</script>
<asp:UpdatePanel ID="UpdatePanelMainContent" runat="server">
<ContentTemplate>
<div class="barbig left padright">
<div class="ccs2008header">
<h4 id="h4header" runat="server" class="css2008fontstyle"></h4>
</div>
<div id="convertThis">
<div id="tabs">
<div rel="divUpdatePanel" >
<asp:LinkButton ID="LinkButtonDefinitions" runat="server" OnClientClick="LinkButtonDefinitions_Click">Definitions</asp:LinkButton></div>
<div rel="divUpdatePanel">Employees</div>
<div rel="divUpdatePanel" >Family</div>
<div rel="d" >Home Town</div>
<div rel="e">Other Than Home Town</div>
<div rel="f" >Admissibility</div>
<div rel="g" >Types Of LTC</div>
<div rel="h" >Block Period</div>
<div rel="i">Entitlement</div>
<div rel="j" >Advance</div>
<div rel="l" >Adjustment of advance</div>
<div rel="n" >Reimbursement</div>
<div rel="o" >Carry Over & Forfeiture of claim</div>
<div rel="o" >Relaxations & Interpretations</div>
</div>
<div id="divs">
<div id="divUpdatePanel" runat="server">
</div>
</div>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LinkButtonDefinitions" />
</Triggers>
</asp:UpdatePanel>
代码背后
Public Sub loadContent(ByVal PageName As String)
Dim _con As New SqlConnection(ConfigurationManager.ConnectionStrings("LeaveDBConnectionString").ConnectionString)
Dim _da As New SqlDataAdapter("SELECT PageHeader,PageContent FROM PageKeeper WHERE PageName='" & PageName & "'", _con)
Dim _table As New DataTable
Try
_con.Open()
_da.Fill(_table)
_con.Close()
_con.Dispose()
With _table.Rows(0)
h4header.InnerText = .Item(0)
divUpdatePanel.InnerHtml = .Item(1)
Me.Title = .Item(0)
End With
Catch ex As Exception
MsgBox(ex.Message)
divUpdatePanel.InnerText = "No Data Found"
Finally
_con.Close()
_con.Dispose()
End Try
End Sub
Protected Sub LinkButtonDefinitions_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButtonDefinitions.Click
loadContent("Definitions")
End Sub
答案 0 :(得分:0)
可能您没有在代码中初始化pageLoad
否。
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(pageLoad);
此pageLoad不是从UpdatePanel自动调用的函数,您需要在javascript
部分初始化该函数。实际上不是一个知道功能,所以我想你复制粘贴这个代码来自这个部分。