Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

web part is not properly functioning for first time

Avatar of ajay1feb
ajay1feb asked on
JavaScriptASP.NETAJAX
3 Comments1 Solution1481 ViewsLast Modified:
i am using user control as web part in asp.net 3.5 application.whenever i am clicking on verb inside web part for first it is giving object expected error.when i click on verb second time it is working fine.what can be problem ?
aspx page :
 
<%@ Page Language="C#" AutoEventWireup="true"  EnableEventValidation="false" ValidateRequest ="false"   CodeFile="DashBoard.aspx.cs" Theme ="default"  Inherits="Dashboard_TestPage" Buffer ="true" Async ="true" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 
 
<%--<%@ Register Namespace="MarkItUp" TagPrefix="portal" %>--%>
<%@ Register TagPrefix="CustomiseWebpart" Assembly="CustomiseWebpart.Web" Namespace="CustomiseWebpart.Web.UI.WebControls.WebParts"%>
<%@ Register Src="~/Controls/Header.ascx" TagName="Header" TagPrefix="uc1" %>
<%@ Register Src="~/Controls/Footer.ascx" TagName="Footer" TagPrefix="uc2" %>
<%@ Register Src="~/Controls/Forecastgrid.ascx" TagName="Forecastgrid" TagPrefix="uc14" %>
<%@ Register Src="~/Controls/FlowProfileChart.ascx" TagName="FlowProfileChart" TagPrefix="uc6" %>
<%@ Register Src="~/Controls/PressureProfileChart.ascx" TagName="PressureProfileChart" TagPrefix="uc8" %>
<%@ Register Src="~/Controls/HydraulicProfiles.ascx" TagName="HydraulicProfiles" TagPrefix="HydraulicProfiles" %>
<%@ Register Src="~/Controls/Linepack.ascx" TagName ="LinePack" TagPrefix="LinePack" %>
<%@ Register Src="~/Controls/cmoniter.ascx" TagName ="cmoniter" TagPrefix="cmoniter" %>
<%@ Register Src="~/Controls/Trend.ascx" TagName="Trend" TagPrefix="Trend" %>
<%@ Register Src="~/Controls/Gauge.ascx" TagName="Gauge" TagPrefix="uc4" %>
 
<%@ Register Src="~/Controls/LeakDetectionStatus.ascx" TagName ="Leak" TagPrefix="uc5" %>
 
<%--<%@ Register Src="~/Controls/Unaccount3dchart.ascx" TagName="Unaccount3dchart" TagPrefix="UnaccYear" %>
<%@ Register Src="~/Controls/LeakSensitivity.ascx" TagName="LeakSensitivity" TagPrefix="LeakSen" %>
<%@ Register Src="~/Controls/AverageLeaksesitivity3dChart.ascx" TagName="AverageLeaksesitivity3dChart" TagPrefix="AvgLeakSen" %>
<%@ Register Src="~/Controls/Conditionsnow.ascx" TagName="Conditionsnow" TagPrefix="uc4" %>
<%@ Register Src="~/Controls/MyAlerts.ascx" TagName="MyAlerts" TagPrefix="uc9" %>
<%@ Register Src="~/Controls/unaccountedGasToday.ascx" TagName="unaccountedGasToday" TagPrefix="UnaccTody" %>
--%>
<%@ Register src="../Controls/ScheduleImbalance.ascx" tagname="ScheduleImbalance" tagprefix="SchImb" %>
<%@ Register src="../Controls/AllocationImbalance.ascx" tagname="AllocationImbalance" tagprefix="AllImb" %>
<%@ Register src="../Controls/RevenueByShipper.ascx" tagname="RevenueByShipper" tagprefix="Revenue" %>
<%@ Register src="../Controls/NetMargin.ascx" tagname="NetMargin" tagprefix="NetMar" %>
<%@ Register src="../Controls/ActualPosition.ascx" tagname="ActualPosition" tagprefix="ActualPos" %>
<%@ Register src="../Controls/DailyNetMargin.ascx" tagname="DailyNetMargin" tagprefix="DailyNetMar" %>
<%@ Register src="../Controls/ScheduledPosition.ascx" tagname="ScheduledPosition" tagprefix="SchdPos" %>
 
<%@ Register Namespace="InfoSupport.Demos.WebParts"   TagPrefix="CCZ" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>PipeView</title>
    
<script language ='javascript' >
 
function helpScreen()
{
    var Left = (screen.width/2)-100;
    var Top = (screen.height/2)- 100;
    window.open('../Help.aspx',null,'height=120,width=250,status=no,toolbar=no,menubar=no,location=no,top='+Top+',left='+Left);
 
}
 
</script>
    
</head>
<body style="background-image:url(../Images/main_bg.png)"  LINK="#EcEcEc" VLINK="#EcEcEc" ALINK="#EcEcEc"  >
    <form id="form1" runat="server">
      <div>
      <asp:ScriptManager runat="server" ID="ScriptManager2"  EnablePartialRendering="true"     >
      <Scripts >
      <asp:ScriptReference Path="../JavaScript/PageRequestManagerEx.js" />
       </Scripts>
      </asp:ScriptManager>  
      
       <script type="text/javascript">
            PageRequestManagerEx.init();
        </script>
 <asp:UpdatePanel ID="MainUpdatePanel"  runat="server"   UpdateMode="Conditional"  > 
    <ContentTemplate>
                <table  border="0" cellpadding="0" cellspacing="0" align="center"  class ="mainTable"    >
    <!--Header-->
    
    <tr>
    <td >
<table  border="0"  style="width:100%;height:85px;background-image:url(../Images/main_header_bg.png)">
<tr>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Image ImageUrl="~/Images/logo_pipe_view.png"   runat ="server" ID="PipeView"    />
</td>
<td  align="right" valign ="top"     >
<table border="0"  cellpadding ="0" cellspacing ="0" style="height: 100%">
<tr valign="bottom">
<td >
 
<table style="height:100%" border="0" style="font-family: Arial; font-size:10pt; color: #FFFFFF" cellspacing="3" cellpadding="0">
<tr>
<%--<td  ><a href="#"  ><font  color="white"> Profile</font>  </a> </td>
 
<td > | </td>--%>
<td >
<a  href="JavaScript:helpScreen();"  ><font  color="white">Help</font></a> 
</td>
<td > | </td>
<td  ><a href="../login.aspx"><font  color="white">Sign Out</font></a>
<br />
    </td>
</tr>
 </table>
 
</td>
</tr>
<tr>
<td>
<p>&nbsp;</p>
<p>&nbsp;</p>
</td>
</tr>
<tr  style="height:100%"  >
<td   align="right" >
<table  width="100%"  cellpadding="1"   >
<tr><td   >
<asp:DropDownList ID="cmbRegions" runat="server" AutoPostBack="true" 
         BackColor="DarkGray" Font-Bold="true" Font-Names="Arial" ForeColor="White" 
         OnSelectedIndexChanged="cmbRegions_SelectedIndexChanged" Height="20px" Width="150px"   >
</asp:DropDownList>
</td>
<td></td>
<td  >
 <asp:ImageButton ID="ImageButton1" runat="server"  BorderWidth="0" ImageUrl="~/Images/tab_.png" 
       OnClick="btnCustomize_Click"   />
  </td>
</tr>
</table>
</td>
</tr>
 
 
</table>
 </td>
</tr>
<%--<tr>
<td align ="right" valign =bottom >
</td>
</tr>--%>
</table>
    </td>
    </tr>
    
     <!--End Header-->
  
 <asp:WebPartManager    EnableClientScript="true"  ID="wpManager" runat="server"  OnWebPartClosed="OnWebpart_Closed"   >
 
 </asp:WebPartManager >
  <asp:Timer ID="Timer1" runat="server" Enabled="true"  >
        </asp:Timer>
    <!-- Catalog-->
     <tr>
     <td  style="background-color:Gray"   valign =baseline  >
     
     <table border="0" style="width:100% "  >
     <tr>
     <td  align ="left"  >
         <CCZ:DropDownCatalogZone  ID="wpCatalog"     width="100%" runat="server" BorderColor="Gray"  BackColor="gray"
                BorderWidth="1px" Font-Names="Arial" Padding="6" ForeColor="White"  HeaderText ="Click on Pipview widget to add it " >                                                                                                            
                <HeaderVerbStyle  Font-Bold="False" Font-Size="10pt" Font-Underline="False" ForeColor="#333333" />
                <PartTitleStyle BackColor="#898989" Font-Bold="True" Font-Size="10pt" ForeColor="White" />
                <PartChromeStyle BackColor ="Gray"   BorderColor= "Gray" BorderStyle="Solid" BorderWidth="0px"  />
                <InstructionTextStyle Font-Size="10pt" ForeColor="#333333" />
                <PartLinkStyle Font-Size="10pt" />
                <EmptyZoneTextStyle Font-Size="10pt" ForeColor="#333333" />
                <LabelStyle Font-Size="10pt" ForeColor="White" />
                <VerbStyle Font-Names="Arial" Font-Size="10pt" ForeColor="#333333" />
                <ZoneTemplate   >       
            <%--       <asp:PageCatalogPart   ID="PageCatalogPart1" runat="server"  Title="Click on any PipeView widget to add it "  />  --%>
            
                     <asp:DeclarativeCatalogPart   ID="DeclarativeCatalogPart2" runat ="server" Title="Grid Widgets">
                     <WebPartsTemplate>
                         <AllImb:AllocationImbalance Title="Allocation Imbalance"    ID="Table_AllocationImbalance" runat="server" />
                        <SchImb:ScheduleImbalance Title="Scheduled Imbalance"     ID="Table_ScheduledImbalance" runat="server" />
                        <Revenue:RevenueByShipper Title="Revenue By Shipper"    ID="Table_RevenueByShipper" runat="server" />
                        <NetMar:NetMargin  Title="Net Sales Margin"   ID="Table_NetSalesMargin" runat="server" />
                        <ActualPos:ActualPosition  Title="Actual Sales Position"   ID="Table_ActualSalesPosition" runat="server" />
                        <DailyNetMar:DailyNetMargin  Title="DailyNet Sales Margin"   ID="Table_DailyNetSalesMargin" runat="server" />
                        <SchdPos:ScheduledPosition  Title="Scheduled Sales Position"   ID="Table_ScheduledSalesPosition" runat="server" />
                        
                       <uc4:Gauge Title="Conditions Now" ID="Gauge_ConditionsNow" runat="server" />
                       <uc5:Leak   Title="Leak Detection Status"  ID="Gauge_LeakDetectionStatus"  runat="server" />
                       <cmoniter:cmoniter Title="Commercial Monitoring"    ID="Gauge_CommercialMonitoring"  runat="server"/>
                       <uc14:Forecastgrid   Title="Forecast"   ID="Gauge_Forecast"  runat="server"/>
                         
                      <uc6:FlowProfileChart      Title="Flow Only"  ID="Chart_FlowOnly"  runat="server"/>
                      <uc8:PressureProfileChart  Title="Pressure Only"    ID="Chart_PressureOnly"  runat="server"/>
                      <Trend:Trend   Title="Trend Widget" ID="Chart_TrendWidget"  runat="server"/>
                      <Linepack:LinePack Title="Line pack Forecast"  ID="Chart_LinepackForecast" runat="server" />
                      <HydraulicProfiles:HydraulicProfiles Title="Hydraulic Profiles"  ID="Chart_HydraulicProfiles"  runat="server"/>
                      </WebPartsTemplate  >
                    </asp:DeclarativeCatalogPart>
               
                </ZoneTemplate>
                <PartStyle BorderColor="gray" BorderWidth="5px"  />
                <SelectedPartLinkStyle Font-Size="10pt" />
                <FooterStyle BackColor="gray" HorizontalAlign="Right" ForeColor="White" />
                <HeaderStyle BackColor="gray" Font-Bold="True" Font-Size="10pt" ForeColor="#333333" />
                <EditUIStyle Font-Names="Arial" Font-Size="10pt" ForeColor="#333333" />
                <CloseVerb ImageUrl="~/images/widget/icon_close_16x16_a.png" Visible="true"    />
                <HeaderCloseVerb ImageUrl="~/images/widget/icon_close_16x16_a.png"  />
                
                 
            </CCZ:DropDownCatalogZone>
     </td>
     </tr>
     </table>
      
     
     </td>
    </tr>
    <!--End Catalog-->
    
     <!--Top Zone-->
     <tr>
     <td  align ="center"   >
     
 <%--  <asp:UpdateProgress ID="MainProgress" runat="server"  AssociatedUpdatePanelID="MainUpdatePanel" >
        <ProgressTemplate   >
        
          <asp:Image ID="Image1" runat="server"  ImageUrl ="~/images/circling-squares-with-trail.gif"  AlternateText="Updating">
                                                                                          </asp:Image>
              Processing........
        
        </ProgressTemplate>
        </asp:UpdateProgress>--%>
     
     
     <table width="950px" Id="topZone" border="0" >
     <tr>
     <td align=center>
     
     
       <CustomiseWebpart:TemplatedWebPartZone ChromeTemplateFile="~/Chrome_templates/WebPartTemplate2.chrome" 
        HeaderText="Top Zone"  Width="950px" 
        WebPartVerbRenderMode="TitleBar" LayoutOrientation="Vertical"  ID="TopZone" runat="server"
        HeaderStyle-BorderWidth="0px" HeaderStyle-BorderColor="White">
        
         
            <ZoneTemplate>
              
            </ZoneTemplate>
            <PartTitleStyle BorderWidth="0px" BorderColor="White"   />
            <PartStyle BorderWidth="0px" BorderColor="White"   />
           
         <CloseVerb ImageUrl="~/images/widget/icon_close_16x16_a.png" />                                                                                                            
         <MinimizeVerb ImageUrl="~/images/flat_minimize.gif"  Visible="true"  Enabled="true"    />                                                                                                            
         <RestoreVerb ImageUrl="~/images/flat_restore.gif" Visible="true"  Enabled ="true" />
         <EditVerb Visible ="false" />
         <DeleteVerb Visible ="false" /> 
        </CustomiseWebpart:TemplatedWebPartZone>
        
     </td>
     </tr>
     </table>
     
     
     </td>
    </tr>
     
      <!--End TopZone-->
      
      
      <!--Main Body-->
     <tr>
     <td>
     <table border="0"  width="950px" Id="MainBody">
     <tr>
     <td>
        <table  border="0"  width="950px" cellspacing="0" border="0" align="center"  height="100%">
                    <tbody>
                        <tr>
                            <td  valign="top" >
                            
                            
        <CustomiseWebpart:TemplatedWebPartZone ChromeTemplateFile="~/Chrome_templates/WebPartTemplate.chrome"
        HeaderText="Left Zone" Width="315px"  
        WebPartVerbRenderMode="TitleBar" LayoutOrientation="Vertical" ID="LeftZone" runat="server"
        HeaderStyle-BorderWidth="0px" HeaderStyle-BorderColor="White"  
         
        >
        
         
            <ZoneTemplate>
              
            </ZoneTemplate>
            <PartTitleStyle BorderWidth="0px" BorderColor="White"   />
            <PartStyle BorderWidth="0px" BorderColor="White"   />
           
         <CloseVerb ImageUrl="~/images/widget/icon_close_16x16_a.png" />                                                                                                            
         <MinimizeVerb ImageUrl="~/images/flat_minimize.gif"  Visible="true"  Enabled="true"    />                                                                                                            
         <RestoreVerb ImageUrl="~/images/flat_restore.gif" Visible="true"  Enabled ="true" />
         <EditVerb Visible ="false" />
         <DeleteVerb Visible ="false" /> 
        </CustomiseWebpart:TemplatedWebPartZone>
                            
                            
                            
                            
                               
                                 
                            
                            </td>
                            <td>&nbsp;</td>
                            <td  valign="top">
                            
                            
                            
                            
                            
                            
                             <CustomiseWebpart:TemplatedWebPartZone ChromeTemplateFile="~/Chrome_templates/WebPartTemplate.chrome" 
        WebPartVerbRenderMode="TitleBar" LayoutOrientation="Vertical" ID="MiddleZone" runat="server"
        HeaderStyle-BorderWidth="0px" HeaderStyle-BorderColor="White"  Width="315px" 
        HeaderText="Middle Zone"
         
        >
        
         
            <ZoneTemplate>
              
            </ZoneTemplate>
            <PartTitleStyle BorderWidth="0px" BorderColor="White"   />
            <PartStyle BorderWidth="0px" BorderColor="White"   />
           
         <CloseVerb ImageUrl="~/images/widget/icon_close_16x16_a.png" />                                                                                                            
         <MinimizeVerb ImageUrl="~/images/flat_minimize.gif"  Visible="true"  Enabled="true"    />                                                                                                            
         <RestoreVerb ImageUrl="~/images/flat_restore.gif" Visible="true"  Enabled ="true" />
         <EditVerb Visible ="false" />
         <DeleteVerb Visible ="false" /> 
        </CustomiseWebpart:TemplatedWebPartZone>
                            
       
        </td>
        <td>&nbsp;</td>
        <td valign="top" >
        
                            
                            
        <CustomiseWebpart:TemplatedWebPartZone ChromeTemplateFile="~/Chrome_templates/WebPartTemplate.chrome" 
        WebPartVerbRenderMode="TitleBar" LayoutOrientation="Vertical" ID="RightZone" runat="server"
        HeaderStyle-BorderWidth="0px" HeaderStyle-BorderColor="White"  HeaderText="Right Zone" Width="315px">
        
         
            <ZoneTemplate>
              
            </ZoneTemplate>
            <PartTitleStyle BorderWidth="0px" BorderColor="White"   />
            <PartStyle BorderWidth="0px" BorderColor="White"   />
         <%--   <TitleBarVerbStyle Font-Size="0.6em" Font-Underline="False"  Height="25px" />
           --%>
         <CloseVerb ImageUrl="~/images/widget/icon_close_16x16_a.png" />                                                                                                            
         <MinimizeVerb ImageUrl="~/images/flat_minimize.gif"  Visible="true"  Enabled="true"    />                                                                                                            
         <RestoreVerb ImageUrl="~/images/flat_restore.gif" Visible="true"  Enabled ="true" />
         <EditVerb Visible ="false" />
         <DeleteVerb Visible ="false" /> 
        </CustomiseWebpart:TemplatedWebPartZone>
                            
                        
                                
                                
                              
                             
                            </td>
                            <td>&nbsp;</td>
                        </tr>
                    </tbody>
                </table>  
     
     
     
     </td>
     </tr>
     </table>
     
     
     </td>
    </tr>
     
      <!--End Main Body-->
      
      
      
       
      
     <!--Footer -->
    
    <tr>
    <td style ="background-color:#e1e1e1"  >
    <table width="950px" id="Footer" border="0"  >
    <tr style ="background-color:#e1e1e1">
    <td  align="right" >
    <asp:Image ImageUrl="~/Images/logo_pipe_view_footer.png"  runat ="server" ID="ImgFooter"   />
    </td>
    </tr>
    </table>
    
    </td>
    </tr>
    
      <!--End Footer-->
    
    </table>
</ContentTemplate>
</asp:UpdatePanel>
      </div>
 
    </form>
</body>
 
<script type="text/javascript"> 
   Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function (sender, args)
    { 
        if (args.get_error() && args.get_error().name === 'Sys.WebForms.PageRequestManagerTimeoutException')
         { 
            //alert('Caught a timeout!');
            // remember to set errorHandled = true to keep from getting a popup from the AJAX library itself 
            args.set_errorHandled(true);
        } 
        if (args.get_error() && args.get_error().name === 'sys.webforms.PageRequestManagerParserErrorException')
         { 
            //alert('Caught a timeout!');
            // remember to set errorHandled = true to keep from getting a popup from the AJAX library itself 
            args.set_errorHandled(true);
        } 
         if (args.get_error() && args.get_error().name === 'sys.webforms.PageRequestManagerServerErrorException')
         { 
            //alert('Caught a timeout!');
            // remember to set errorHandled = true to keep from getting a popup from the AJAX library itself 
            args.set_errorHandled(true);
        } 
   }); 
</script>
</html>
 
 
.cs (code behind page ):
 
 
#region   NameSpaces Declaration
 
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Drawing;
using System.Threading;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Infragistics.WebUI.UltraWebGrid;
using Infragistics.WebUI.UltraWebGrid.ExcelExport;
using System.Reflection;
using PLMDataAccess;
using InfoSoftGlobal;
using Bewise.Web.UI.WebControls;
 
using System.Text;
 
#endregion
 
public partial class Dashboard_TestPage : System.Web.UI.Page, IWebPart
 
{
 
    #region Variable Declaration
    SqlConnection sqlConnection1;
    private string strRegion = string.Empty;
    string sessionId = string.Empty;
    string[] groups = null;
    string[] appContext = null;
    string[] configs = null;
    string[] cases = null;
 
    PLMDataAccess.PLMDataAccess m_pda = new PLMDataAccess.PLMDataAccess();
    #endregion
 
    #region "Region of IWebPart Interface properties"
 
    public string catalogIconImageUrl, description, subtitle, titleIconImageUrl, titleUrl;
    public string title = "Energy Solutions";
 
    [Personalizable]
    string IWebPart.Title
    {
        get
        {
            return title;
        }
        set
        {
            title = value;
        }
    }
    [Personalizable]
    string IWebPart.CatalogIconImageUrl
    {
        get
        {
            return catalogIconImageUrl;
        }
        set
        {
            catalogIconImageUrl = value;
        }
    }
    [Personalizable]
    string IWebPart.Description
    {
        get
        {
            return description;
        }
        set
        {
            description = value;
        }
    }
    [Personalizable]
    string IWebPart.Subtitle
    {
        get
        {
            return subtitle;
        }
    }
    [Personalizable]
    string IWebPart.TitleIconImageUrl
    {
        get
        {
            return titleIconImageUrl;
        }
        set
        {
            titleIconImageUrl = value;
        }
    }
    [Personalizable]
    string IWebPart.TitleUrl
    {
        get
        {
            return titleUrl;
        }
        set
        {
            titleUrl = value;
        }
    }
 
   
 
    #endregion "Region of IWebPart interface properties"
    protected void Page_Load(object sender, EventArgs e)
    {
 
 
        try
        {
            
            sessionId = Session["SessionId"].ToString();
            groups = m_pda.GetGroups(sessionId);
            appContext = m_pda.GetAppContextsForGroup(sessionId, groups[0]);
            configs = m_pda.GetConfigs(sessionId, groups[0], appContext[5]);
            cases = m_pda.GetCases(sessionId, groups[0], appContext[5], configs[1]);
                    
       
 
            HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
            if (authCookie == null)
            {
                string MyCookieName = "Reminder";
                System.Web.HttpCookie MyCookie = Request.Cookies[MyCookieName];
                string UserId;
                if (Request.Cookies[MyCookieName] == null)
                {
                    UserId = System.Guid.NewGuid().ToString().Replace("-", "");
                    MyCookie = new System.Web.HttpCookie(MyCookieName, UserId);
                    MyCookie.Expires = DateTime.Now.AddYears(1);
                    Response.Cookies.Add(MyCookie);
                }
                else
                {
                    UserId = MyCookie.Value;
                }
                FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, UserId, DateTime.Now, DateTime.Now.AddSeconds(60), false, "roles");
                string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
                authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                Response.Cookies.Add(authCookie);
                Response.Redirect(Request.Url.ToString());
            }
        }
        //}
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        finally
        {
 
        }
 
        Timer1.Interval = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TimeInterval"]);
 
        if (!IsPostBack)
        {
 
            wpManager.DisplayMode = WebPartManager.DesignDisplayMode;
           
            PopulateRegionsCombo();
            LeftZone.BorderStyle = BorderStyle.None;
            MiddleZone.BorderStyle = BorderStyle.None;
            RightZone.BorderStyle = BorderStyle.None;
            TopZone.BorderStyle = BorderStyle.None;
         }
 
 
        //if (HttpContext.Current.Session["Region"] == null)
        //{
        //    HttpContext.Current.Session["Region"] = "D_Full";
        //}
        if (cmbRegions.SelectedIndex != -1)
        {
            HttpContext.Current.Session["Region"] = cmbRegions.SelectedItem.Text;
        }
 
        //if (HttpContext.Current.Session["Region"].Equals("SELECT PIPELINE REGION"))
        //{
        //    HttpContext.Current.Session["Region"] = "D_Full";
        //}
 
        //}
     
        
    }
 
    protected void Page_PreRender(Object sender, EventArgs e)
    {
        
        
 
    }
 
    #region "Region of Webcombo methods"
 
    protected void cmbRegions_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            strRegion = cmbRegions.SelectedItem.Text;
 
            if (HttpContext.Current.Session["Region"] == null || HttpContext.Current.Session["Region"].ToString().Equals((string.Empty)))
            {
                cmbRegions.SelectedIndex = 0;
            }
            else
            {
                cmbRegions.SelectedIndex = cmbRegions.Items.IndexOf(cmbRegions.Items.FindByText(HttpContext.Current.Session["Region"].ToString()));
            }
 
 
            //if (cmbRegions.SelectedItem.Text.Equals("SELECT PIPELINE REGION") )
            //{
            //    HttpContext.Current.Session["Region"] = "D_Full";
            //   // cmbRegions.SelectedIndex = 1;
            //}
            //else
            //{
 
            HttpContext.Current.Session["Region"] = cmbRegions.SelectedItem.Text;
            //  }
 
 
 
 
        }
        catch (Exception ex)
        {
            string str = ex.Message.ToString();
        }
 
 
    }
    private void PopulateRegionsCombo()
    {
        try
        {
            // cmbRegions.Items.Clear();
            string[] astrRegions = m_pda.GetInstanceIDsForObjectType(sessionId, groups[0], appContext[5],
                configs[1], cases[0], "SYS.Region");
 
            if (astrRegions != null)
            {
                //              cmbRegions.DataSource = astrRegions;
                //                cmbRegions.DataBind();
                for (int i = 0; i < astrRegions.Length; i++)
                {
                    cmbRegions.Items.Add(new ListItem(astrRegions[i].ToString(), i.ToString()));
 
                }
 
 
 
                if (HttpContext.Current.Session["Region"] == null || HttpContext.Current.Session["Region"].ToString().Equals((string.Empty)))
                {
                    cmbRegions.SelectedIndex = 0;
                }
                else
                {
                    cmbRegions.SelectedIndex = cmbRegions.Items.IndexOf(cmbRegions.Items.FindByText(HttpContext.Current.Session["Region"].ToString()));
 
                }
                //if (HydraulicProfiles != null)
                //{
 
                //    ((GenericWebPart)HydraulicProfiles.Parent).Title = "Hydraulic Profiles - " + cmbRegions.SelectedItem.Text;
                //}
                //if (LinePackChart != null)
                //{
 
                //    ((GenericWebPart)LinePackChart.Parent).Title = "Line Pack Forecast - " + cmbRegions.SelectedItem.Text;
                //}
                //if (PressureProfileChart != null)
                //{
                //    ((GenericWebPart)PressureProfileChart.Parent).Title = "Pressure Profile - " + cmbRegions.SelectedItem.Text;
                //}
 
                //if (FlowProfileChart != null)
                //{
                //    ((GenericWebPart)FlowProfileChart.Parent).Title = "Flow Profile - " + cmbRegions.SelectedItem.Text;
                //}
 
                //if (Trend1 != null)
                //{
                //    ((GenericWebPart)Trend1.Parent).Title = "Trend - " + cmbRegions.SelectedItem.Text;
                //}
 
 
                HttpContext.Current.Session["Region"] = "D_Full";//cmbRegions.SelectedItem.Text.ToString();
                //HttpContext.Current.Session.Add("Region", strRegion);                
            }
 
 
 
        }
        catch (Exception ex)
        {
 
            string str = ex.ToString();
        }
    }
 
    #endregion "Region of Webcombo methods"
 
    protected void btnCustomize_Click(object sender, EventArgs e)
    {
        wpManager.DisplayMode = WebPartManager.CatalogDisplayMode;
        
 
    }
    protected void OnWebpart_Closed(object sender, WebPartEventArgs e)
    {
        wpManager.DeleteWebPart(e.WebPart);
 
    }
 
    //protected void lnkHelp_click(object sender, EventArgs e)
    //{
    //    string jScript = "<script language='JavaScript'>" +
    //    "Alert('suresh');"+
    //     //"var Left = (screen.width/2)-100;" +
    //     //"var Top = (screen.height/2)- 100;" +
    //     //"window.open('../Help.aspx',null,'height=100,width=250,status=no,toolbar=no,menubar=no,location=no,top='+Top+',left='+Left);" +
 
    //     "</script>";
 
    //    //ScriptManager.RegisterStartupScript(this, this.GetType(), "OpenWindowScript", javaScript, false);
 
    //    ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), jScript, true  );
    //}
 
}
ASKER CERTIFIED SOLUTION
Avatar of GoofyDawg
GoofyDawgFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answers