0

I'm working on Asp .net WCF i'm having 3 dropdownlists and a click button for table and chart in a page(based on the dropdownlist selection table/chart will load).There is an image for two views when click on chartview it have to show chart when click on table view it have to show table.

following is the function for changing the grid/chart view,

 function ViewChange()
 {
    $('#ChartImage').toggleClass("selectView2");
    $('#MainGrid').toggle();
    $('#Chartview').toggle();
 }

Following is the button click function,

  function Dispalymaingrid () {       
    var errorflag;
    var Geo=$('#ddlGeo').val();
    var Vertical=$('#ddlVertical option:selected').val();    
    var Year=$('#ddlYear').val();
    var Month=null;
    var Type="";
    document.getElementById('lblGeo').innerText = "";
    document.getElementById('lblVertical').innerText = "";
    document.getElementById('lblYear').innerText = "";
    if (Geo == "" || Geo == null) {            
        document.getElementById('lblGeo').innerText = " *";
        document.getElementById('lblGeoMsg').innerText = " Select Geo";
        errorflag=1;
    }  
    else
    {
        document.getElementById('lblGeoMsg').innerText = "";
    }
    if (Vertical == "" || Vertical == 0 || Vertical=="--Select Vertical--") {            
        document.getElementById('lblVertical').innerText = " *";
        document.getElementById('MainGrid').style.display="none";
        document.getElementById('Exports').style.display="none";
        document.getElementById('lblVerticalMsg').innerText = "Select Vertical";
        errorflag=1;
    }
    else
    {
        document.getElementById('lblVerticalMsg').innerText = "";
    }        
    if(Year==""||Year==0)
    {
        document.getElementById('lblYear').innerText="*";
        document.getElementById('MainGrid').style.display="none";
        document.getElementById('Exports').style.display="none";
        document.getElementById('lblYearMsg').innerText = "Select Year";
        errorflag=1;
    }
    else
    {
        document.getElementById('lblYearMsg').innerText = "";
    }
    if(errorflag!=1)
    {
      if(Vertical=="All")
      {
        var Flag=1;
      } else {
      var Flag=2;
    }
    debugger;      
    window.location.href ="@Url.Action("ReportTRFulfillment", "TravelReady")" +"?strGeo="+Geo+'&strVertical='+escape(Vertical)+'&intFlag='+Flag+'&intYear='+Year+'&intMonth='+Month+'&varType='+Type ;         
    }
 }     

if i have chosen chartview,if i change the value in dropdownlist and if i click button the corresponding chart should get loaded.But the problem here is grid is getting loaded when i click submit..How can i fix this issue?

4

0 回答 0