开发者

Is it possible to show two active indexes for a multiview at a time

开发者 https://www.devze.com 2023-02-13 08:14 出处:网络
I am having a multiview with Activeviewindex=-1. I will have some views assume 3. In one vi开发者_如何学Goew i will have a grid view placed and the other 2 views contain some controls. Now initial

I am having a multiview with

  Activeviewindex=-1.

I will have some views assume 3. In one vi开发者_如何学Goew i will have a grid view placed and the other 2 views contain some controls. Now initially i will load the view with grid view now if the user clicks on radio button available in the grid view i would like to show the corresponding view along with grid view. But as per my thinking we can only show one view at a time. so is there any possibility to show 2 views of multiview at a time.


Showing two View at a Time is not possible in MultiView instead you can use separate panels as mentioned by @mellamokb. Also have a look at this msdn link


You might be better off placing your controls inside of <asp:Panel> controls and conditionally showing or hiding different panels in your code-behind. You can then show two at once, with the caveat that when you want to switch views, you have to manually hide all previously showing panels.

Replace your existing MultiView:

<asp:MultiView ... >
    <asp:View ID="View1" runat="server"> ... </asp:View>
    <asp:View ID="View2" runat="server"> ... </asp:View>
    <asp:View ID="View3" runat="server"> ... </asp:View>
</asp:MultiView>

With a series of Panels:

<asp:Panel ID="View1" runat="server"> ... </asp:Panel>
<asp:Panel ID="View2" runat="server"> ... </asp:Panel>
<asp:Panel ID="View3" runat="server"> ... </asp:Panel>

And show or hide them as needed:

// switch to Panel #3
protected void MyButton_Click(object sender, EventArgs e) {
    View1.Visible = false;
    View2.Visible = false;
    View3.Visible = true;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号