Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Please Help! How to make the refresh TabPanel when clicked

$
0
0

I am having a problem getting this tabContainer working the way I would like it too. I have a TabContainer called SensorsTabContainer that has six tab panels in it. I have 4 buttons at the bottom that make the main textbox hide and shows two textboxs in its place. 

The problem I am having is, once one of the buttons is pressed I have to press a different button to get the panel to go back to the origial state. I would like to be about to press the tab of the active page and have it refresh back to the origanal. I am currently in class for asp.net and still have a lot to learn. Any help would be appreciated. 

ASP.NET/HTML Code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="MAS_APP.index" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title>Monitoring & Alarm System (MAS)</title><link rel="stylesheet" type="text/css" href="StyleSheet.css" /></head><body><form id="form1" runat="server"><div><asp:TabContainer ID="SensorsTabContainer" runat="server" Height="320px" Width="609px" ActiveTabIndex="1"><asp:TabPanel runat="server" HeaderText="Home Panel" ID="SenHomePanel"><HeaderTemplate>
                    Home</HeaderTemplate><ContentTemplate><br /><br /><center><asp:Login ID="Login1" runat="server"></asp:Login></center></ContentTemplate></asp:TabPanel><asp:TabPanel ID="SenFireTabPanel" runat="server" HeaderText="Fire Sensors Panel"><HeaderTemplate>
                    Fire Sensors</HeaderTemplate><ContentTemplate><div class="ContentDiv"><div class="TextAreaDiv"><asp:Label ID="FireConfigLabelLBL" CssClass="TextAreaLabels" runat="server" Text="Configuration Logs" Visible="false"></asp:Label><asp:Label ID="FireEventLabelLBL" CssClass="TextAreaLabels" runat="server" Text="Event Logs" Visible="false"></asp:Label><asp:Label ID="FireSensorListLBL" CssClass="TextAreaLabels" runat="server" Text="List of Sensors" Visible="true"></asp:Label><br /><asp:TextBox ID="FireLogConfigTxtBox" CssClass="LogTextAreas" runat="server" Visible="false"></asp:TextBox><asp:TextBox ID="FireLogEventTxtBox" CssClass="LogTextAreas" runat="server" Visible="false"></asp:TextBox><asp:TextBox ID="FireSenTxtBox" CssClass="TextArea" runat="server" Visible="true"></asp:TextBox><br /></div><br /><br /><br /><div id="FireButDiv" class="ButDiv"><asp:Button ID="FireLogButFireTab" CssClass="LogBut" runat="server" Text="Fire Sensor Log" OnClick="FireLogBut_Click"/><asp:Button ID="HeatLogButFireTab" CssClass="LogBut" runat="server" Text="Heat Sensor Log" OnClick="HeatLogBut_Click" /><asp:Button ID="SmokeLogButFireTab" CssClass="LogBut" runat="server" Text="Smoke Sensor Log" OnClick="SmokeLogBut_Click" />   <asp:Button ID="StaticElecLogButFireTab" CssClass="LogBut" runat="server" Text="Static Electricity Sensor Log" OnClick="StaticElecLogBut_Click" />   </div><br /><br /><br /><br /><br /></div></ContentTemplate></asp:TabPanel><asp:TabPanel ID="SenHeatTabPanel" runat="server" HeaderText="Heat Sensors Panel"><HeaderTemplate>
                    Heat Sensors</HeaderTemplate><ContentTemplate><div class="ContentDiv"><div class="TextAreaDiv"><asp:Label ID="HeatConfigLabelLBL" CssClass="TextAreaLabels" runat="server" Text="Configuration Logs" Visible="false"></asp:Label><asp:Label ID="HeatEventLabelLBL" CssClass="TextAreaLabels" runat="server" Text="Event Logs" Visible="false"></asp:Label><asp:Label ID="HeatSensorListLBL" CssClass="TextAreaLabels" runat="server" Text="List of Sensors" Visible="true"></asp:Label><br /><asp:TextBox ID="HeatLogConfigTxtBox" CssClass="LogTextAreas" runat="server" Visible="false"></asp:TextBox><asp:TextBox ID="HeatLogEventTxtBox" CssClass="LogTextAreas" runat="server" Visible="false"></asp:TextBox><asp:TextBox ID="HeatSenTxtBox" CssClass="TextArea" runat="server" Visible="true"></asp:TextBox><br /></div><br /><br /><br /><div id="HeatButDiv" class="ButDiv"><asp:Button ID="FireLogButHeatTab" runat="server" CssClass="LogBut" Text="Fire Sensor Log" OnClick="FireLogBut_Click" /><asp:Button ID="HeatLogButHeatTab" runat="server" CssClass="LogBut" Text="Heat Sensor Log" OnClick="HeatLogBut_Click" /><asp:Button ID="SmokeLogButHeatTab" runat="server" CssClass="LogBut" Text="Smoke Sensor Log" OnClick="SmokeLogBut_Click" /><asp:Button ID="StaticElecLogButHeatTab" runat="server" CssClass="LogBut" Text="Static Electricity Sensor Log" OnClick="StaticElecLogBut_Click" /></div><br /><br /></div></ContentTemplate></asp:TabPanel><asp:TabPanel ID="SenSmokeTabPanel" runat="server" HeaderText="Smoke Sensors Panel"><HeaderTemplate>
                    Smoke Sensors</HeaderTemplate><ContentTemplate><div class="ContentDiv"><div class="TextAreaDiv"><asp:Label ID="SmokeConfigLabelLBL" CssClass="TextAreaLabels" runat="server" Text="Configuration Logs" Visible="false"></asp:Label><asp:Label ID="SmokeEventLabelLBL" CssClass="TextAreaLabels" runat="server" Text="Event Logs" Visible="false"></asp:Label><asp:Label ID="SmokeSensorListLBL" CssClass="TextAreaLabels" runat="server" Text="List of Sensors" Visible="true"></asp:Label><br /><asp:TextBox ID="SmokeLogConfigTxtBox" CssClass="LogTextAreas" runat="server" Visible="false"></asp:TextBox><asp:TextBox ID="SmokeLogEventTxtBox" CssClass="LogTextAreas" runat="server" Visible="false"></asp:TextBox><asp:TextBox ID="SmokeSenTxtBox" CssClass="TextArea" runat="server" Visible="true"></asp:TextBox><br /></div><br /><br /><br /><div id="SmokeButDiv" class="ButDiv"><asp:Button ID="FireLogButSmokeTab" runat="server" CssClass="LogBut" Text="Fire Sensor Log" OnClick="FireLogBut_Click" /><asp:Button ID="HeatLogButSmokeTab" runat="server" CssClass="LogBut" Text="Heat Sensor Log" OnClick="HeatLogBut_Click" /><asp:Button ID="SmokeLogButSmokeTab" runat="server" CssClass="LogBut" Text="Smoke Sensor Log" OnClick="SmokeLogBut_Click" /><asp:Button ID="StaticElecLogButSmokeTab" runat="server" CssClass="LogBut" Text="Static Electricity Sensor Log" OnClick="StaticElecLogBut_Click" /></div><br /><br /></div></ContentTemplate></asp:TabPanel><asp:TabPanel ID="SenStaticTabPanel" runat="server" HeaderText="Static Electricity Sensors Panel"><HeaderTemplate>
                    Static Electricity Sensors</HeaderTemplate><ContentTemplate><div class="ContentDiv"><div class="TextAreaDiv"><asp:Label ID="StaticConfigLabelLBL" CssClass="TextAreaLabels" runat="server" Text="Configuration Logs" Visible="false"></asp:Label><asp:Label ID="StaticEventLabelLBL" CssClass="TextAreaLabels" runat="server" Text="Event Logs" Visible="false"></asp:Label><asp:Label ID="StaticSensorListLBL" CssClass="TextAreaLabels" runat="server" Text="List of Sensors" Visible="true"></asp:Label><br /><asp:TextBox ID="StaticLogConfigTxtBox" CssClass="LogTextAreas" runat="server" Visible="false"></asp:TextBox><asp:TextBox ID="StaticLogEventTxtBox" CssClass="LogTextAreas" runat="server" Visible="false"></asp:TextBox><asp:TextBox ID="StaticSenTxtBox" CssClass="TextArea" runat="server" Visible="true"></asp:TextBox><br /></div><br /><br /><br /><div id="StaticElecButDiv" class="ButDiv"><asp:Button ID="FireLogButStaticTab" runat="server" CssClass="LogBut" Text="Fire Sensor Log" OnClick="FireLogBut_Click" /><asp:Button ID="HeatLogButStaticTab" runat="server" CssClass="LogBut" Text="Heat Sensor Log" OnClick="HeatLogBut_Click" /><asp:Button ID="SmokeLogButStaticTab" runat="server" CssClass="LogBut" Text="Smoke Sensor Log" OnClick="SmokeLogBut_Click" /><asp:Button ID="StaticElecLogButStaticTab" runat="server" CssClass="LogBut" Text="Static Electricity Sensor Log" OnClick="StaticElecLogBut_Click" /></div><br /><br /></div></ContentTemplate></asp:TabPanel><asp:TabPanel ID="SenTestTabPanel" runat="server" HeaderText="Test Sensors Panel"><HeaderTemplate>
                    Test Sensors</HeaderTemplate><ContentTemplate><div class="ContentDiv"><div class="TextAreaDiv"><asp:Label ID="TestSensorListLBL" CssClass="TextAreaLabels" runat="server" Text="Label"></asp:Label><asp:TextBox ID="TestTxtBox" CssClass="TextArea" runat="server"></asp:TextBox><br /></div><br /><br /><br /><br /><div id="TestButDiv" class="ButDiv"><asp:Button ID="FireLogButTestTab" runat="server" CssClass="LogBut" OnClick="FireLogBut_Click" Text="Fire Sensor Log" /><asp:Button ID="HeatLogButTestTab" runat="server" CssClass="LogBut" OnClick="HeatLogBut_Click" Text="Heat Sensor Log" /><asp:Button ID="SmokeLogButTestTab" runat="server" CssClass="LogBut" OnClick="SmokeLogBut_Click" Text="Smoke Sensor Log" /><asp:Button ID="StaticElecLogButTestTab" runat="server" CssClass="LogBut" OnClick="StaticElecLogBut_Click" Text="Static Electricity Sensor Log" /></div><br /><br /></div></ContentTemplate></asp:TabPanel></asp:TabContainer></div><asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager></form></body></html>



C# Code Behind

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MAS_APP
{
    

    public partial class index : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            /*FireTab_Click();
            SmokeTab_Click();
            HeatTab_Click();
            StaticTab_Click();*/
            
        }

        protected void FireLogBut_Click(object sender, EventArgs e)
        {
            SensorsTabContainer.ActiveTab = SenFireTabPanel;

            FireLogConfigTxtBox.Visible = true;
            FireLogEventTxtBox.Visible = true;
            FireSenTxtBox.Visible = false;

            FireConfigLabelLBL.Visible = true;
            FireEventLabelLBL.Visible = true;
            FireSensorListLBL.Visible = false;

            SmokeTab_Click();
            HeatTab_Click();
            StaticTab_Click();
                        
        }

        

        protected void HeatLogBut_Click(object sender, EventArgs e)
        {
            SensorsTabContainer.ActiveTab = SenHeatTabPanel;

            HeatLogConfigTxtBox.Visible = true;
            HeatLogEventTxtBox.Visible = true;
            HeatSenTxtBox.Visible = false;

            HeatConfigLabelLBL.Visible = true;
            HeatEventLabelLBL.Visible = true;
            HeatSensorListLBL.Visible = false;

            FireTab_Click();
            SmokeTab_Click();
            StaticTab_Click();
            
        }

        

        protected void SmokeLogBut_Click(object sender, EventArgs e)
        {
            SensorsTabContainer.ActiveTab = SenSmokeTabPanel;

            SmokeLogConfigTxtBox.Visible = true;
            SmokeLogEventTxtBox.Visible = true;
            SmokeSenTxtBox.Visible = false;

            SmokeConfigLabelLBL.Visible = true;
            SmokeEventLabelLBL.Visible = true;
            SmokeSensorListLBL.Visible = false;

            FireTab_Click();
            HeatTab_Click();
            StaticTab_Click();

        }

        protected void StaticElecLogBut_Click(object sender, EventArgs e)
        {
            SensorsTabContainer.ActiveTab = SenStaticTabPanel;

            StaticLogConfigTxtBox.Visible = true;
            StaticLogEventTxtBox.Visible = true;
            StaticSenTxtBox.Visible = false;

            StaticConfigLabelLBL.Visible = true;
            StaticEventLabelLBL.Visible = true;
            StaticSensorListLBL.Visible = false;

            FireTab_Click();
            HeatTab_Click();
            SmokeTab_Click();
             
        }
        
        private void FireTab_Click()
        {
            FireLogConfigTxtBox.Visible = false;
            FireLogEventTxtBox.Visible = false;
            FireSenTxtBox.Visible = true;

            FireConfigLabelLBL.Visible = false;
            FireEventLabelLBL.Visible = false;
            FireSensorListLBL.Visible = true;
        }
        
        private void HeatTab_Click()
        {
            HeatLogConfigTxtBox.Visible = false;
            HeatLogEventTxtBox.Visible = false;
            HeatSenTxtBox.Visible = true;

            HeatConfigLabelLBL.Visible = false;
            HeatEventLabelLBL.Visible = false;
            HeatSensorListLBL.Visible = true;
        }

        private void SmokeTab_Click()
        {
            SmokeLogConfigTxtBox.Visible = false;
            SmokeLogEventTxtBox.Visible = false;
            SmokeSenTxtBox.Visible = true;

            SmokeConfigLabelLBL.Visible = false;
            SmokeEventLabelLBL.Visible = false;
            SmokeSensorListLBL.Visible = true;
        }
        
        private void StaticTab_Click()
        {
            StaticLogConfigTxtBox.Visible = false;
            StaticLogEventTxtBox.Visible = false;
            StaticSenTxtBox.Visible = true;

            StaticConfigLabelLBL.Visible = false;
            StaticEventLabelLBL.Visible = false;
            StaticSensorListLBL.Visible = true;
        }
        

    }
}


CSS if needed

body {
}
.TextAreaDiv{
    width:100%;
    text-align:center;
    padding-bottom:15px;
    height: 245px;
    float:left;
}
#ContentDiv {
    width:100%;
    text-align:center;
    padding-bottom:15px;
}
.ContentDiv {
    height: 260px;
    width: 587px;
}
#form1 {
    width: 613px;
        }
.TextArea {
    display:block;
    margin-top:5px;
    margin-left:0px;
    margin-right:11px;
    width:95%;
    height:150px;
    margin-left:17px;
    overflow:auto;

}
.ButDiv{
    height:50px;
    margin:auto;
    padding-left:10.5px;
    padding-right:10.5px;
}
.LogBut {
    height:50px;
    width:120px;
    text-align:center;
    white-space:normal;
    display:inline-block;
    float:left;
    margin:0px 10.5px 0px 10.5px;
}

.LogTextAreas{
    float:left;
    margin-top:5px;
    margin-left:15px;
    margin-right:11px;
    margin-bottom:97px;
    width:44.5%;
    height:150px;
    overflow:auto;
}
.TextAreaLabels{
    float:left;
    margin-left:18px;
    width:auto;
    margin-right:150px;
}
.LPButDiv{
    height:1px;
    margin:auto;
    padding-left:10.5px;
    padding-right:10.5px;
}

Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>