UpdatePanel と MultiView の組み合わせに問題があります。
最上位に UpdatePanel があり、その中にたくさんの imagebutton があります。それらのクリック イベントは Multiview のビューを設定し、各 View にはバインディングを使用してその中に UpdatePanel があります。
すべてがうまく機能しますが、クエリ文字列を介してビューを設定しようとしているため、ユーザーを特定のビューに送信できます。
PageLoad からビューを設定しようとすると、「オブジェクトが存在しません」と表示されます。だから私はPage_LoadCompleteでそれを試してみようと思った.
私は何が欠けています!ありがとう!
void Page_LoadComplete()
{
tabSelect= Request.QueryString["tab"];
if (tabSelect.Contains("Community"))
{
MultiView1.SetActiveView(Community);
btnCommunity.ImageUrl = "images/tabCommunity_on.png";
}
}
<asp:ScriptManager id="ScriptManager1" runat="server"/>
<asp:UpdatePanel id="UpdatePanel1" childrenastriggers="true" updatemode="Always" runat="server">
<ContentTemplate>
<asp:ImageButton id="btnCommunity" onclick="" runat="server">
<asp:MultiView ID="MultiView1" ActiveViewIndex="0" runat="server">
<asp:View ID="Community" runat="server">
<asp:UpdatePanel id="UpdatePanel1" childrenastriggers="true" updatemode="Always" runat="server">
//data controls in here
</asp:UpdatePanel>
</asp:View>
<asp:View id="tabFriends" runat="server">
<asp:UpdatePanel id="UpdatePanel2" childrenastriggers="true" updatemode="Always" runat="server">
//data controls in here
</asp:UpdatePanel>
</asp:View>
</asp:MultiView>
</ContentTemplate>
</asp:UpdatePanel>