Unable to access the gridview present inside the RadMultiPage

1 posts, 0 answers
  1. Rajesh
    Rajesh avatar
    1 posts
    Member since:
    Jan 2013

    Posted 10 Jan 2013 Link to this post

    Hi There,
    I am unable to access the gridview present inside the RadMultiPage control in my C# code.I am having this issue in PageIndexChanging event.I have attached my code for your reference.

    ASPX:

     

    <div>
            <div class="text">
                <img alt="Dashboard" class="text" src="images/module/iReport.png" width="30" height="30" />Special
                Reports
            </div>
            <telerik:RadWindowManager ID="RadWindowManager1" Modal="true" runat="server" Behaviors="Close,Maximize"
                Skin="Vista" IconUrl="./images/module/PopUp_iCon.png" Height="500px" Width="600px">
            </telerik:RadWindowManager>
            <div class="pageContent">
                <table border="0" cellpadding="0" cellspacing="5" width="100%">
                    <tr>
                        <td align="left" valign="middle">
                            <div>
                                <uc1:SpecialReportsMenu ID="SpecialReportsMenu1" runat="server" />
                            </div>
                            <table width="80%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="13%" style="height:20px;">
                                    </td>
                                    <td width="50%">
                                    </td>
                                    <td width="17%">
                                    </td>
                                </tr>
                                <tr>
                                    <td class="formLeft" style="height:20px;">
                                        Choose project :
                                    </td>
                                    <td class="formLeft">
                                        <asp:DropDownList ID="ddlProjectID" runat="server" OnSelectedIndexChanged="ddlProjectID_SelectedIndexChanged"
                                            CssClass="selectboxsize" AutoPostBack="True" class="selectboxsize" Width="250px">
                                        </asp:DropDownList>
                                    </td>
                                    <td class="formRight">
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlProjectID"
                                            SetFocusOnError="true" ErrorMessage="Please select Project ID" InitialValue="0"
                                            ValidationGroup="VGRespondentData"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="formLeft" style="height:20px;">
                                        Choose question :
                                    </td>
                                    <td class="formLeft">
                                        <asp:DropDownList ID="ddlQuestion" runat="server" Width="250px" AutoPostBack="true"
                                            OnSelectedIndexChanged="ddlQuestion_SelectedIndexChanged" CssClass="selectboxsize">
                                            <asp:ListItem Value="-1">Choose</asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="formLeft" style="height:20px;">
                                        Selected question :
                                    </td>
                                    <td class="formLeft">
                                        <asp:Label runat="server" ID="lblFulltxtquest" Text="" Width="100%"></asp:Label>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="formLeft" style="height:20px;">
                                        No.of responses :
                                    </td>
                                    <td class="formLeft">
                                        <asp:Label runat="server" ID="lblResponse"></asp:Label>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr id="tr1" runat="server">
                                    <td>
                                    </td>
                                    <td align="center" style="padding-top: 5px">
                                        <asp:Label ID="lblerror" runat="server" ForeColor="Red" CssClass="labeltext" Font-Bold="True"></asp:Label>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table id="tblRespData" runat="server" width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td align="center">
                                        <asp:Label ID="lblMsgResData" runat="server" CssClass="labeltext" Text="Label" Visible="false"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                            <tr id="trComFilter" runat="server">
                                                <td align="left">
                                                    <table width="100%" id="tblMapView" runat="server">
                                                        <tr>
                                                            <td align="right">
                                                                <asp:UpdateProgress ID="updProgress" AssociatedUpdatePanelID="" runat="server">
                                                                    <ProgressTemplate>
                                                                        <table>
                                                                            <tr>
                                                                                <td style="width: 50px; background-color: Red;">
                                                                                    <asp:Label ID="lblProcessResp" ForeColor="White" BorderColor="red" Text="Loading..."
                                                                                        runat="server"></asp:Label>
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </ProgressTemplate>
                                                                </asp:UpdateProgress>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                                    <tr style="width: 40px">
                                                                        <td>
                                                                            <telerik:RadTabStrip ID="rtabstripChart" runat="server" MultiPageID="radMultiPg"
                                                                                SelectedIndex="0" Width="227px">
                                                                                <Tabs>
                                                                                    <telerik:RadTab Text="Heat Map" CssClass="labeltext">
                                                                                    </telerik:RadTab>
                                                                                    <telerik:RadTab Text="Individual Images" CssClass="labeltext">
                                                                                    </telerik:RadTab>
                                                                                </Tabs>
                                                                            </telerik:RadTabStrip>
                                                                            <telerik:RadMultiPage ID="radMultiPg" runat="server" SelectedIndex="0">
                                                                                <telerik:RadPageView ID="radHeatMap" runat="server">
                                                                                    <div>
                                                                                        <table width="100%" border="0">
                                                                                            <tr>
                                                                                                <td width="50%" align="left" class="formLeft" style="padding-left: 100px; padding-top: 10px">
                                                                                                    Heat map of Green selection
                                                                                                </td>
                                                                                                <td width="50%" align="left" class="formLeft" style="padding-left: 100px; padding-top: 10px">
                                                                                                    Heat map of Red selection
                                                                                                </td>
                                                                                            </tr>
                                                                                            <tr style="height: 100px;">
                                                                                                <td align="left" runat="server" id="tdDispArea" valign="top" width="60%">
                                                                                                 <table><tr><td  class="ImageFix">
                                                                                                    <div id="divBackCombinedfront" runat="server" class="Redtransparent">
                                                                                                    </div>
                                                                                                    <asp:Image runat="server" ID="divBackCombinedbottom" class="Redtransparent" />
                                                                                                    <div id="divBackCombinedtop" runat="server" class="OriginalImage">
                                                                                                    </div>
                                                                                                     </td></tr></table>   
                                                                                                </td>
                                                                                                <td align="left" runat="server" id="tdDispArea_Red" valign="top" width="40%">
                                                                                                <table><tr><td  class="ImageFix">
                                                                                                    <div id="divBackCombinedtop_Red" runat="server" class="Redtransparent">
                                                                                                    </div>
                                                                                                    <asp:Image runat="server" ID="divBackCombinedbottom_Red" class="Redtransparent" />
                                                                                                    <div id="divBackCombinedfront_Red" runat="server" class="OriginalImage">
                                                                                                    </div>
                                                                                                    </td></tr></table>
                                                                                                </td>
                                                                                            </tr>
                                                                                            <tr>
                                                                                                <td style="height: 5px;">
                                                                                                </td>
                                                                                            </tr>
                                                                                            <tr>
                                                                                                <td colspan="2" valign="bottom">
                                                                                                    <div style="width: 280px; height: 38px; text-align: center; vertical-align: middle;
                                                                                                        padding-left: 13px;">
                                                                                                        <div style="width: 280px; float: left" runat="server" id="divCommonPalete">
                                                                                                            <div style="width: 280px; padding-top: 3px">
                                                                                                                <span style="width: 85px; display: block; float: left; text-align: left" class="formLeft">
                                                                                                                    high</span> <span style="width: 85px; display: block; float: left; text-align: center;
                                                                                                                        font-family: Arial, Helvetica, sans-serif; font-size: 12px" class="formCenter">medium</span>
                                                                                                                <span style="width: 80px; display: block; float: left; text-align: right" class="formRight">
                                                                                                                    low</span>
                                                                                                            </div>
                                                                                                            <div style="height: 20px">
                                                                                                            </div>
                                                                                                            <div style="width: 256px">
                                                                                                                <asp:Image ID="imgPallete3" runat="server" ImageUrl="~/images/module/pallete.bmp" Height="5px"
                                                                                                                    Width="256px" />
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                </td>
                                                                                            </tr>
                                                                                        </table>
                                                                                    </div>
                                                                                </telerik:RadPageView>
                                                                                <telerik:RadPageView ID="radIndividuals" runat="server">
                                                                                    <div>
                                                                                        <asp:Panel ID="pnlGV" runat="server" ScrollBars="Auto">
                                                                                            <asp:Repeater ID="rptrQuestion" runat="server" OnItemDataBound="rptrQuestion_ItemDataBound">
                                                                                                <ItemTemplate>
                                                                                                    <table width="100%" border="0">
                                                                                                        <tr>
                                                                                                            <td class="formLeft">
                                                                                                                <asp:Label ID="lblQuesttxt" runat="server" Visible="false"></asp:Label>
                                                                                                            </td>
                                                                                                            <td align="right" style="width: 80px; padding-right: 15px" valign="top" class="labeltext">
                                                                                                                <asp:LinkButton ID="lnkBtnViewFile" Text="View file" CssClass="labeltext" runat="server"
                                                                                                                    Visible="false" CommandArgument='<%#Eval("Path")%>' CommandName="View file"></asp:LinkButton>
                                                                                                            </td>
                                                                                                        </tr>
                                                                                                        <tr>
                                                                                                            <td colspan="2">
                                                                                                                   
                                                                                                            </td>
                                                                                                        </tr>
                                                                                                        <tr>
                                                                                                            <td colspan="2" align="left">
                                                                                                                <table width="390px" border="0" cellpadding="0" cellspacing="0" class="tablebg">
                                                                                                                    <tr>
                                                                                                                        <td align="center">
                                                                                                                            <table width="390px" cellpadding="0" cellspacing="0" border="0" class="tablemain">
                                                                                                                                <td>
                                                                                                                                    <asp:GridView ID="GVRespondentData" runat="server" EnableViewState="true" Width="390px"
                                                                                                                                        AutoGenerateColumns="False" GridLines="None" OnRowDataBound="GVRespondentData_RowDataBound" AllowPaging="True" PageSize="2" OnPageIndexChanging="GVRespondentData_PageIndexChanging" >
                                                                                                                                        <Columns>
                                                                                                                                            <asp:BoundField DataField="PaM_Id" HeaderText="RespondentID" HeaderStyle-Width="130px"
                                                                                                                                                ItemStyle-Width="120px">
                                                                                                                                                <ItemStyle Font-Bold="True" Font-Size="8pt" HorizontalAlign="Center" />
                                                                                                                                            </asp:BoundField>
                                                                                                                                            <asp:BoundField DataField="Response_ID" HeaderText="ResponseID" HeaderStyle-Width="130px"
                                                                                                                                                ItemStyle-Width="120px">
                                                                                                                                                <ItemStyle Font-Bold="True" Font-Size="8pt" HorizontalAlign="Center" />
                                                                                                                                            </asp:BoundField>
                                                                                                                                            <asp:BoundField DataField="WebApp_Id" HeaderText="WebAppID" Visible="false">
                                                                                                                                                <ItemStyle Font-Bold="True" Font-Size="8pt" HorizontalAlign="Center" />
                                                                                                                                            </asp:BoundField>
                                                                                                                                            <asp:TemplateField HeaderText="View map" HeaderStyle-Width="130px" ItemStyle-Width="130px">
                                                                                                                                                <ItemTemplate>
                                                                                                                                                    <asp:LinkButton ID="lnkBtnViewMap" CssClass="labeltext" Text="View map" runat="server"
                                                                                                                                                        CommandArgument='<%#Eval("Ans_Id")%>' ></asp:LinkButton>
                                                                                                                                                </ItemTemplate>
                                                                                                                                                <ItemStyle HorizontalAlign="Center" />
                                                                                                                                            </asp:TemplateField>
                                                                                                                                            <asp:BoundField DataField="Ans_Id" />
                                                                                                                                        </Columns>
                                                                                                                                        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                                                                                                                                        <SelectedRowStyle />
                                                                                                                                        <HeaderStyle CssClass="tdheader" HorizontalAlign="Center" Height="30px" />
                                                                                                                                        <RowStyle CssClass="tdfirst" />
                                                                                                                                        <AlternatingRowStyle CssClass="tdsecond" />
                                                                                                                                        <EmptyDataTemplate>
                                                                                                                                            No response found.
                                                                                                                                        </EmptyDataTemplate>
                                                                                                                                    </asp:GridView>
                                                                                                                                </td>
                                                                                                                            </table>
                                                                                                                        </td>
                                                                                                                    </tr>
                                                                                                                </table>
                                                                                                            </td>
                                                                                                        </tr>
                                                                                                    </table>
                                                                                                </ItemTemplate>
                                                                                            </asp:Repeater>
                                                                                        </asp:Panel>
                                                                                        <asp:Label ID="lblNoData" Text="No data found." runat="server" Visible="False" Font-Size="9pt"
                                                                                            ForeColor="#FF3300"></asp:Label></div>
                                                                                </telerik:RadPageView>
                                                                            </telerik:RadMultiPage>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                                    <tr style="width: 40px">
                                                                        <td>
                                                                        </td>
                                                                    </tr>
                                                                    <tr id="trRespData" runat="server">
                                                                        <td align="center" style="padding-top: 20px">
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="height: 5px">
                                           
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>
            <div runat="server" id="divContainer" style="position: absolute; display: none;">
                <div style="color: Red; float: right; font-size: 9pt; cursor: hand;" onclick="hideViewFile();">
                    [X]</div>
                <img runat="server" id="imgViewFile" src="" alt="Background Image" />
            </div>
        </div>

    CS:

    protected void GVRespondentData_PageIndexChanging(object sender, GridViewPageEventArgs e)
      
    {
      
    GridView GVRespondentData = radMultiPg.FindControl("radIndividuals").FindControl("pnlGV").FindControl("rptrQuestion").FindControl("GVRespondentData") as GridView;
      
    //GridView GVRespondentData = pnlGV.FindControl("ctl00_ContentPlaceHolder1_rptrQuestion_ctl00_GVRespondentData") as GridView;
      
      
      
    GVRespondentData.PageIndex = e.NewPageIndex;
      
    GVRespondentData.DataBind();
      
    }
    i am unable to access the gridview "GVRespondentData" directly and also using find control.I am getting the issue when i click on the page number of the grid.I am getting null when i did quick watch for the variable GVRespondentData.

    Error Message:
    "Object reference not set to an instance of an object."
    Stack Trace:

    "   at iPinion.ControlPanel.Web.iPi_HeatMapRespondentData.GVRespondentData_PageIndexChanging(Object sender, GridViewPageEventArgs e) in E:\\WorkArea.Rajesh\\Projects\\Source\\Ipinion_New\\Source\\iPinion\\Ipinion_IAIntegration_Final\\iPinion.ControlPanel.Web\\iPi_HeatMapRespondentData.aspx.cs:line 229\r\n   at System.Web.UI.WebControls.GridView.OnPageIndexChanging(GridViewPageEventArgs e)\r\n   at System.Web.UI.WebControls.GridView.HandlePage(Int32 newPage)\r\n   at System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup)\r\n   at System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument)\r\n   at System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)\r\n   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)\r\n   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)\r\n   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)"

    Please reply me ASAP.
    Regards,
    Rajesh D

     

Back to Top