Free Support Forum - aspose.com

Gridweb used in combination with MultiView

Reference thread: https://www.aspose.com/community/forums/thread/847394/gridweb-used-in-combination-with-multiview.aspx

I have a simple ASP .NET form with a MultiView component in there.
The Aspose gridweb is loaded in the second view ( cfr attached config )

<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
    <asp:View ID="View0" runat="server">
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        <br><br>
        <asp:Image ID="Image1" runat="server" ImageUrl="~/download.jpg" Height="176px" Width="176px" />
        </asp:View>
    <asp:View ID="View1" runat="server">
        <asp:Button ID="Button1" runat="server" Height="24px" Text="Generate report !" Width="185px" />
        <asp:Button ID="Button3" runat="server" Height="24px" Text="Back to report" Width="185px" />
        <br/><br/>
        <acw:GridWeb ID="GridWeb1" runat="server" Height="220px" Width="922px" EnableAsync="False" ShowSaveButton="False" ShowSubmitButton="False" ShowTabBar="False" ShowUndoButton="False" SpanWrap="False" ShowTabNavigation="False" EditMode="True" Enabled="False"></acw:GridWeb>
        </asp:View>
    <asp:View ID="View2" runat="server">
        <asp:Button ID="Button2" runat="server" Height="24px" Text="Back to parameters !" Width="185px" />
        <iframe id="if1" runat="server" frameBorder="0" height="600px" width="1400px" scrolling="yes"></iframe>
        </asp:View>
    </asp:MultiView>
</form>
</body>
</html>

The problem is when I enter the application with an active view different from the one where the Gridweb is loaded, I get an "Object reference not set to an instance of an object" window. When I remove the Aspose gridweb, all is ok.


Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        If Page.IsPostBack Then Exit Sub
        MultiView1.ActiveViewIndex = 0
        Exit Sub
 	End Sub

I have appended the project

any ideas ?

guido

This Topic is created by Amjad_Sahi using the Email to Topic plugin.

Hi,

We recommend you to kindly add business logic for GridWeb when page is loaded:
e.g
Sample code:

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load 
        If Page.IsPostBack Then Exit Sub 
        MultiView1.ActiveViewIndex = 0 
' please add business logic for gridweb for example set activesheet index or import a file 
 GridWeb1.ActiveSheetIndex = 0
        Exit Sub 
 	End Sub 


Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load 
        If Page.IsPostBack Then Exit Sub 
        MultiView1.ActiveViewIndex = 0 
' please add business logic for gridweb for example set activesheet index or import a file 
 GridWeb1.ImportExcelFile(..................................................
        Exit Sub 
 	End Sub 

It would work fine for your needs.

Thank you.