Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> 

        <script type="text/javascript" >                     

      // This function handles style and display changes for each next button click

            function handleWizardNext() {

                var chkConnType;

                if (document.getElementById('ButtonNext').name == 'Step2')
                {

// Change the button name - we use this to keep track of which step to display on a click
                   // DeviceNameTextBox


                    document.getElementById('ButtonNext').name = 'Step3';

                    document.getElementById('ButtonPrevious').name = 'Step1';
        

                 // Set new step to display and turn off display of current step

                               document.getElementById('Step1').style.display = 'none';

                               document.getElementById('Step2').style.display = '';                              

                      // Change background color on header to highlight new step

                               document.getElementById('HeaderTableStep2').style.backgroundColor = '#EA8511';

                               document.getElementById('HeaderTableStep1').style.backgroundColor = '#8CC63F';

                     document.getElementById('fstep1').style.display = 'none';
                     document.getElementById('ffstep1').style.display = 'none';

                    document.getElementById('fstep2').style.display = 'block';
                    document.getElementById('ffstep2').style.display = 'block';


                           }
                        
       }
</script>

<<div  style=" position:fixed; top:150px; width:600px; height:400px;  left: 488px;">
    <div  id="fstep1" style="position:fixed; top:177px; width:538px; height:25px; background-color:khaki; left: 506px;" >     
           <td id="HeaderTableStep1" style="position:fixed; top:177px; width:500px;height:25px; background-color:khaki; left: 506px;background-color:#EA8511; color:White; font-size:larger; height:60px;">Step 1: Select Location </td>
        </div>
     <div id="ffstep1" style=" position:fixed; top:209px; width:536px; height:301px;  left: 508px;">
        </br>
        </br>
           WEL-COME TO ADD NEW WIZARD!
         </br>
        </br>
        Branch where you want to add new device  <td id="newbranch;"> &nbsp;<asp:DropDownList ID="DropDownList1"  runat="server" DataSourceID="SqlDataSource1" DataTextField="Branch_name"></asp:DropDownList></td><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ems_db1ConnectionString %>" SelectCommand="SELECT [Branch_name] FROM [master]"></asp:SqlDataSource>
         </br>
        </br>
      
        
            </div>


       <div id="fstep2" style="display:none; position:fixed; top:177px; width:538px; height:25px; background-color:khaki; left: 506px;" >     
           <td id="HeaderTableStep2" style="position:fixed; top:177px; width:500px;height:25px; background-color:khaki; left: 506px;background-color:#EA8511; color:White; font-size:larger; height:60px;">Step 2:Select Device Type </td>
           
        </div>
     <div id="ffstep2" style="display:none; position:fixed; top:209px; width:536px; height:301px; left: 508px;">
        </br>
        </br>
         Select Device Type: 
         </br>
        </br>
         <div style=" position:fixed; overflow:scroll;height:301px;width:536px; ">
       <asp:TreeView ID="TreeView1" runat="server"  ImageSet="BulletedList3" Width="439px" Font-Names="Times New Roman" 
                                            HoverNodeStyle-BackColor="#04B14B" HoverNodeStyle-ForeColor="White" 
                                            RootNodeStyle-ForeColor="Black" 
                                            ParentNodeStyle-ForeColor="#A92159"
                                            NodeStyle-ForeColor="Brown" 
                                            LeafNodeStyle-ForeColor="#04B14B"
                                            SelectedNodeStyle-BackColor="DeepSkyBlue" SelectedNodeStyle-ForeColor="White" Font-Size="14px" ExpandDepth="0" >
                                            </asp:TreeView>  

             </div>
        
    </div>
        <input id="ButtonNext" type="button" style="height:40px; width:80px" value="Next" name="Step2" onclick="handleWizardNext()" />
      </div>
Posted
Updated 16-Dec-15 20:24pm
v5
Comments
Kishor-KW 17-Dec-15 1:59am    
I am trying to hide fstep1 and ffstep1 on ButtonNext click event. and want to show fstep2 and ffstep2. above code it does not work. please help
Kishor-KW 17-Dec-15 3:10am    
please answer
Kishor-KW 17-Dec-15 4:56am    
In containtplace holder we can't Hide or show but which are other ways for doing same

The Ids might not be the same which you are using in JavaScript, my 2 cents!!! Check it out.

Just inspect the elements in browser and see what are the Ids.
 
Share this answer
 
Comments
Kishor-KW 17-Dec-15 5:51am    
No it is not case. it is problem of using in contentplaceholder. so please give solution for how to do hiding of div in contentplaceholder
What is the problem in using content place holder?
Kishor-KW 18-Dec-15 0:55am    
on contentplacehoder it is not allowed to run server side control event on client side(javascript). thats what I got from net uptill i searched, same code is working for simple webform which not having master page(i.e contentplaceholder)
I don't understand you clearly. JavaScript would run. Debug more and use browser console to see the errors. Rectify them.
Kishor-KW 18-Dec-15 2:10am    
it is not showing an error
document.getElementById('<%=Page.Master.FindControl("ContentPlaceHolder1").FindControl("fstep1").ClientID %>').style.display='none';
 
Share this answer
 
v2

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