Click here to Skip to main content
15,888,097 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<div id="Tabs">
            <!-- Nav tabs -->
            <ul class="nav nav-tabs" style="font-size: 12px">
                <li style="width: 110px"><a href="#ScanGuest">Scan Guest</a></li>                <li style="width: 90px"><a href="#Reprint">Reprint</a></li>                <li style="width: 150px"><a href="#FlightWiseReport">Flight Wise Report</a></li>                <li style="width: 160px"><a href="#DateWiseReport">Date Wise Report</a></li>                <li style="width: 160px"><a href="#LoungeAccessReport">Lounge Access Report</a></li>                <li style="width: 120px"><asp:HyperLink runat="server" ID="hp" aria-controls="MainMenu" NavigateUrl="~/scan_demo.aspx" Text="Main Menu"></li>            </ul>



<div class="tab-pane" id="Reprint">
                      <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                        <contenttemplate>                            

                    
                        <table width="100%"><tbody><tr>                            <td valign="top">                                
                                   <table width="100%"><tbody><tr height="40">                                        <td style="padding-left: 30px" valign="top">                                            Report</td>                                    </tr>                                    <tr>                                        <td style="padding-top: 2%">                                            
                                                <table width="100%"><tbody><tr>                                                    <td width="30%" style="padding-left: 30px">                                                        <asp:Label ID="lblddate" runat="server" Font-Bold="True" Text="Date" CssClass="bold"></td>                                                    <td width="30%" style="padding-left: 30px">                                                        <asp:Label ID="lblCust" runat="server" CssClass="bold" Font-Bold="True" Text="Customer"></td>                                                    <td width="40%" style="padding-left: 30px">                                                        <asp:Label ID="lblFlightNo" runat="server" CssClass="bold" Text="Flight No."></td>                                                </tr>                                                <tr>                                                    <td width="30%" style="padding-left: 30px">                                                        <asp:DropDownList ID="DDLddate" Style="height: 40px; width: 80%; padding-left: 10px;" runat="server" CssClass="form-control" AutoPostBack="True" OnSelectedIndexChanged="DDLddate_SelectedIndexChanged">
                                                            <asp:ListItem Text="Select" Value="-1">
                                                        </td>                                                    <td width="30%" style="padding-left: 30px">                                                        <asp:DropDownList ID="DDLCust" Style="height: 40px; width: 80%; padding-left: 10px;" runat="server" CssClass="form-control" AutoPostBack="True" OnSelectedIndexChanged="DDLCust_SelectedIndexChanged">
                                                            <asp:ListItem Text="Select" Value="-1">
                                                        </td>                                                    <td width="40%" style="padding-left: 30px">                                                        <asp:DropDownList ID="ddlFlightNoSG" Style="height: 40px; width: 60%; padding-left: 10px;" runat="server" CssClass="form-control" AutoPostBack="True" OnSelectedIndexChanged="ddlFlightNoSG_SelectedIndexChanged">
                                                            <asp:ListItem Text="Select" Value="-1">
                                                        </td>                                                </tr>                                            </tbody></table>
                                        </td>                                    </tr>                                    <tr>                                        <td style="padding-left: 30px">                                            <div style="height: 310px">
                                                <asp:GridView ID="GRVCust" runat="server" AutoGenerateColumns="False" CellPadding="4" CssClass="form-control"
                                                    ForeColor="#333333" GridLines="Vertical" OnSelectedIndexChanged="GRVCust_SelectedIndexChanged">
                                                    <AlternatingRowStyle BackColor="White" />
                                                    <columns>
                                                        <asp:CommandField ShowSelectButton="True" />
                                                        <asp:BoundField DataField="Name" HeaderText="Name" />
                                                        <asp:BoundField DataField="FFPNo" HeaderText="FFP No." />
                                                        <asp:BoundField DataField="JPCard" HeaderText="JP Card" />
                                                        <asp:BoundField DataField="SeatNo" HeaderText="Seat No." />
                                                        <asp:BoundField DataField="Class" HeaderText="Class" />
                                                        <asp:BoundField DataField="SeqNo" HeaderText="Seq No." />
                                                        <asp:BoundField DataField="Source" HeaderText="Source" />
                                                        <asp:BoundField DataField="Dest" HeaderText="Dest" />
                                                        <asp:BoundField DataField="GuestOf" HeaderText="Guest Of" />
                                                    
                                                    <EditRowStyle BackColor="#2461BF" />
                                                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                                    <RowStyle BackColor="#EFF3FB" />
                                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                                
                                            </div>
                                        </td>                                    </tr>                                    <tr>                                        <td>                                            
                                                <table width="100%"><tbody><tr>                                                    <td width="30%" style="padding-left: 30px"><asp:Label ID="lblcount1" runat="server" Font-Bold="True" Text="Count" Width="63px" CssClass="bold"></td>                                                    <td width="30%" style="padding-left: 30px"><asp:TextBox ID="txtcount1" runat="server" ReadOnly="True" Width="76px"></td>                                                    <td width="40%"></td>                                                </tr>                                                <tr><td align="right" colspan="3"><asp:Button ID="Button3" runat="server" CssClass="button" Font-Bold="True" Height="35px" OnClick="btnPrint1_Click" Text="PRINT" Width="100px" /></td></tr>                                            </tbody></table>
                                         
                                        </td>                                    </tr>                                </tbody></table>

                            </td>                        </tr>                    </tbody></table>
             
                  
                        <triggers>
                            <asp:AsyncPostBackTrigger ControlID="DDLddate" EventName="SelectedIndexChanged" />
                            <asp:AsyncPostBackTrigger ControlID="DDLCust" EventName="SelectedIndexChanged" />
                            <asp:AsyncPostBackTrigger ControlID="ddlFlightNoSG" EventName="SelectedIndexChanged" />
                        
                    
                </div>
</div>


-------------------------------------------------------------
Cs code-------------------------------------------
on page load-----
 Page.Title = "Report";
                DDLDate.Attributes["onchange"] = "return IsDropDownIndexZero('" + DDLDate.ClientID + "')";
                ddlFlightNo.Attributes["onchange"] = "return IsDropDownIndexZero('" + ddlFlightNo.ClientID + "')";
                DDLddate.Attributes["onchange"] = "return IsDropDownIndexZero('" + DDLddate.ClientID + "')";
                DDLCust.Attributes["onchange"] = "return IsDropDownIndexZero('" + DDLCust.ClientID + "')";
                DDLDate1.Attributes["onchange"] = "return IsDropDownIndexZero('" + DDLDate1.ClientID + "')";
                DDLFlt.Attributes["onchange"] = "return IsDropDownIndexZero('" + DDLFlt.ClientID + "')";
                ddlByDate.Attributes["onchange"] = "return IsDropDownIndexZero('" + ddlByDate.ClientID + "')";

 protected void DDLddate_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (DDLddate.SelectedIndex > 0)
                {
                    GRVCust.DataSource = null;
                    GRVCust.DataBind();
                    ddlFlightNoSG.Items.Clear();
                    txtcount2.Text = "";
                    DDLCust.Items.Clear();
                    DDLCust.Items.Add("Select");
                    DDLCust.Items.Add("Self");
                    DDLCust.Items.Add("Guest");
                  
                }
                else
                {
                  
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), "alertScript", "alert('" + ex.Message + "');", true);
            }
           
        }


 protected void DDLCust_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (DDLddate.SelectedIndex > 0)
                {
                    ddlFlightNoSG.Items.Clear();
                    GRVCust.DataSource = null;
                    GRVCust.DataBind();
                    txtcount2.Text = "";
                    string URL1 = "http://" + serverIP + "/loungejppl/fltinfo.aspx?flightdate=" + DDLddate.SelectedItem.ToString() + "&loc=" + Session["Location"].ToString();
                    //string URL1 = "http://" + serverIP + "/loungejppl/fltinfo.aspx?flightdate=" + DDLddate.SelectedItem.ToString() + "&loc=" + Session["Location"].ToString();
                    WebRequest request1 = WebRequest.Create(URL1);
                    WebResponse response1 = request1.GetResponse();
                    StreamReader reader1 = new StreamReader(response1.GetResponseStream());
                    string str1 = reader1.ReadLine();
                    response1.Close();
                    if (!String.IsNullOrEmpty(str1) && str1 != "No" && str1 != "SE")
                    {
                        str1 = str1.Trim();

                        string[] loc1 = str1.Split(new char[] { Convert.ToChar(3) }, StringSplitOptions.RemoveEmptyEntries);
                        ddlFlightNoSG.Items.Add("Select");
                        for (int i = 0; i < loc1.Length; i++)
                        {
                            ddlFlightNoSG.Items.Add(loc1[i].ToString());
                        }
                    }
                    else if (String.Compare(str1, "No", false) == 0)
                    {
                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(string), "alertScript", "alert('No Info');", true);
                    }
                    else if (String.Compare(str1, "SE", false) == 0)
                    {
                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(string), "alertScript", "alert('Server Connection Error..');", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(string), "alertScript", "alert('" + ex.Message + "');", true);
            }
        }

What I have tried:

above i post my code update panel is not working when i change dropdown value then page refresh and goes on first panel in ScanGuest so how to fix issues after refresh page should not be change

i am using javascript in master page when i remove javascript from master page then i works fine otherwise they not working fine


js function which is call on master page-

function DisableBackButton() {
    history.go(1);

}
function ScanClear(val1, val2, val3, val4, val5, val6, val7, val8, val9, val10, val11, val12, val13) {
    val1.value = ""; val2.value = ""; val3.value = ""; val4.value = ""; val5.value = ""; val6.value = ""; val7.value = ""; val8.value = ""; val9.value = ""; val10.value = ""; val11.value = ""; val12.value = ""; val13.value = "";
}
function UnScanClear(val1, val2, val3, val4, val5, val6, val7, val8, val9) {
    val1.value = ""; val2.value = ""; val3.value = ""; val4.value = ""; val5.value = ""; val6.value = ""; val7.value = ""; val8.value = ""; val9.value = "";
}
function Clear(val1, val2, val3, val4, val5, val6) {
    val1.value = ""; val2.value = ""; val3.value = ""; val4.value = "";
}
function ClearMessage(val1) {
    val1.innerText = "";
    //document.forms[0].submit();
}
function ClearComment(val1) {
    val1.innerText = "";
    return false;
}
function IsDropDownIndexZero(val1) {
    debugger;
    if (document.getElementById(val1).selectedIndex == 0) {
        return false;
    }
    document.forms[0].submit();
}

please help
Posted
Updated 2-Oct-18 19:54pm
v2
Comments
F-ES Sitecore 3-Oct-18 4:31am    
Check the error console to see if there are any javascript errors.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900