<asp:DropDownList ID="ddlReportType" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddlReportType_SelectedIndexChanged" > <asp:ListItem Selected="True">-- Select which data you want to enter --</asp:ListItem> <asp:ListItem Value="Salse" Text="Salse">Salse Reports</asp:ListItem> <asp:ListItem Value="Inventory" Text="Inventory">Inventory Reports</asp:ListItem> <asp:ListItem Value="Finance" Text="Finance">Financial Reports</asp:ListItem> </asp:DropDownList> <br /> <asp:Label ID="Label1" runat="server" Text=""></asp:Label> <br /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Panel ID="pnlProductSale" runat="server"> <asp:Label ID="lblCaptionSales" runat="server" Text="Total Product based sale"></asp:Label> <table> <tr> <td> Select Product </td> <td> <asp:DropDownList ID="ddlProduct" runat="server"></asp:DropDownList> </td> </tr> </table> </asp:Panel> <asp:Panel ID="pnlInventory" runat="server"> <asp:Label ID="lblInventory" runat="server" Text="Inventory"></asp:Label> <table> <tr> <td> Select Product </td> <td> <asp:DropDownList ID="ddlProductPnl2" runat="server"></asp:DropDownList> </td> </tr> </table> </asp:Panel> <asp:Panel ID="pnlCashFlow" runat="server"> <asp:Label ID="lblCaption" runat="server" Text="Cashflow"></asp:Label> <table> <tr> <td> Deposit at start up </td> <td> Cash on hand : <asp:TextBox ID="txtStartAmt" Text="0" AutoPostBack="true" runat="server" ></asp:TextBox> Credit : <asp:TextBox ID="txtStartCredit" Text="0" AutoPostBack="true" runat="server" ></asp:TextBox> Debit : <asp:TextBox ID="txtstartDebit" Text="0" AutoPostBack="true" runat="server" ></asp:TextBox> </td> </tr> <tr> <td> <asp:ImageButton ID="imgSave" runat="server" /> </td> <td> <asp:ImageButton ID="imgCancel" runat="server" /> </td> </tr> </table> </asp:Panel> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddlReportType" /> </Triggers> </asp:UpdatePanel>
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { pnlCashFlow.Visible = false; pnlProductSale.Visible = false; pnlInventory.Visible = false; } } protected void ddlReportType_SelectedIndexChanged(object sender, EventArgs e) { if (ddlProduct.SelectedIndex == 0) { Label1.Text = ddlProduct.SelectedValue; pnlCashFlow.Visible = false; pnlProductSale.Visible = false; pnlInventory.Visible = true; } else if (ddlProduct.SelectedIndex ==1) { Label1.Text = ddlProduct.SelectedValue; pnlCashFlow.Visible = false; pnlProductSale.Visible = true; pnlInventory.Visible = false; } else if (ddlProduct.SelectedIndex==2) { Label1.Text = ddlProduct.SelectedValue; pnlCashFlow.Visible = true; pnlProductSale.Visible = false; pnlInventory.Visible = false; } else { Label1.Text = ddlProduct.SelectedValue; pnlCashFlow.Visible = true; pnlProductSale.Visible = false; pnlInventory.Visible = false; } }
ddlReportType_SelectedIndexChanged
ddlProduct.SelectedIndex
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)