Click here to Skip to main content
15,908,166 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Friends

I am developing a web application to hold my friend list in asp.net using C#. i want to make multiple Panel in single page and show/hide panel in click event in same position for input my master settings like city master, state master, country master etc.

please help me.

thanks in advance


<asp:Panel ID="pnlCity" runat="server" Visible="False">
<table border="0" id="tblCity">
<tr>
<th scope="col" align="left">
<asp:Label ID="Label1" runat="server" Font-Names="Verdana"
Font-Size="Small" Text="City Name :"></asp:Label> </th>
<th scope="col" class="style2" align="right">
<asp:TextBox ID="txtCity" runat="server"
Font-Names="Verdana" Font-Size="Small" Width="175px"></asp:TextBox> </th>
</tr>
<tr>
<th scope="col" colspan="2" align="left">
<asp:Label ID="lblMSG" runat="server" Font-Names="Verdana" Font-Size="Small"
Text="Label" Visible="False"></asp:Label> </th>
</tr>
<tr>
<th scope="col">&nbsp; </th>
<th scope="col" align="right" class="style2">
<asp:Button ID="btnCitySave" runat="server"
Font-Names="Verdana" Font-Size="Small" Text="Save" Width="100px"
onclick="btnCitySave_Click" /> </th>
</tr>
</table>
</asp:Panel>



An other panel is:

<asp:Panel ID="pnlState" runat="server" Visible="False">
<table border="0" id="tblState">
<tr>
<th scope="col" align="left">
<asp:Label ID="Label1" runat="server" Font-Names="Verdana"
Font-Size="Small" Text="State Name :"></asp:Label> </th>
<th scope="col" class="style2" align="right">
<asp:TextBox ID="txtState" runat="server"
Font-Names="Verdana" Font-Size="Small" Width="175px"></asp:TextBox> </th>
</tr>
<tr>
<th scope="col" colspan="2" align="left">
<asp:Label ID="lblMSG" runat="server" Font-Names="Verdana" Font-Size="Small"
Text="Label" Visible="False"></asp:Label> </th>
</tr>
<tr>
<th scope="col">&nbsp; </th>
<th scope="col" align="right" class="style2">
<asp:Button ID="btnStateSave" runat="server"
Font-Names="Verdana" Font-Size="Small" Text="Save" Width="100px"
onclick="btnStateSave_Click" /> </th>
</tr>
</table>

</asp:Panel>

i want to show single panel in same position at a time when i click in a add city button or add State button
Posted
Updated 11-Nov-11 20:19pm
v2

<a href="http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CollapsiblePanel/CollapsiblePanel.aspx">http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CollapsiblePanel/CollapsiblePanel.aspx</a>[<a href="http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CollapsiblePanel/CollapsiblePanel.aspx" target="_blank" title="New Window">^</a>]

this will help u
 
Share this answer
 
you can use the collapsable panel of AJAX control, AJAX control tool kit is free.
 
Share this answer
 
In page load both be invisible..

Click add city button
C#
pnlCity.visible=true;
  pnlState.visible=false;


Click State city button
C#
pnlCity.visible=false;
 pnlState.visible=true;
 
Share this answer
 
Comments
saad.raza 12-Nov-11 2:25am    
Nice Logic but need to use javascript or updatepanal to stop postback your logic is batter because AJAX sometime throw exception on FireFox because of our code Logic.
Tiwari A K 12-Nov-11 2:48am    
thanks for your help. but i have different type of situation. i want to multiple panel in same position.
 
Share this answer
 
v2
Comments
Tiwari A K 12-Nov-11 2:48am    
thanks for your help. but i have different type of situation. i want to multiple panel in same position.
Better u use this link
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CollapsiblePanel/CollapsiblePanel.aspx
 
Share this answer
 
v2
Comments
Tiwari A K 12-Nov-11 2:48am    
thanks for your help. but i have different type of situation. i want to multiple panel in same position.

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