2013-06-25 5 views
0

В ASP.NET с C# как настроить панель видимой без обратной передачи?
У меня на странице три панели, которые переключаются, нажимая на 3 кнопки ссылок. Когда вы нажимаете одну кнопку, одна панель устанавливается на видимую, а другая на невидимую. В это время мне нужно отобразить только панель выбранной ссылки.Как установить панель видимой без обратной передачи?

Можно ли установить эту видимость панели в java-скрипте, не делая сообщение обратно?

Это мой ASPX код:

<asp:Panel ID="panelTxtImage" runat="server" 

    style="z-index: 1; left: 438px; top: 116px; position: absolute; height: 218px; width: 521px"> 
    <asp:Panel ID="PanelDropQuest" runat="server" 

     <asp:Label ID="LabelQuestGroup" runat="server" 
      style="z-index: 1; left: 15px; top: 13px; position: absolute; height: 24px; width: 131px;" 
      Text="Question Group" Font-Bold="True"></asp:Label> 
     <asp:CheckBox ID="CheckBoxImage" runat="server" 
      style="z-index: 1; left: 107px; top: 101px; position: absolute" /> 
    </asp:Panel> 
    <asp:DropDownList ID="DropQuestions" runat="server" 
    style="z-index: 1; left: 173px; top: 33px; position: absolute; height: 19px; width: 274px"> 
     <asp:ListItem Value="-1">Select</asp:ListItem> 
    </asp:DropDownList> 
    <asp:Label ID="LabelQuestion" runat="server" Font-Bold="True" 
     style="z-index: 1; left: 52px; top: 89px; position: absolute; height: 28px; width: 52px" 
     Text="Question"></asp:Label> 
    <asp:TextBox ID="TxtWriteQuestion" runat="server" 
     style="z-index: 1; left: 173px; top: 85px; position: absolute; height: 24px; width: 325px" 
     TextMode="MultiLine"></asp:TextBox> 
    <asp:Label ID="LabelImage" runat="server" Font-Bold="True" 
     style="z-index: 1; left: 47px; top: 124px; position: absolute; height: 20px; width: 105px" 
     Text="Capture Image"></asp:Label> 
    <asp:Panel ID="Panel2" runat="server" 
     style="z-index: 1; left: 45px; top: 255px; position: absolute; height: 51px; width: 445px"> 
    </asp:Panel> 
    <asp:Label ID="Label1" runat="server" 
     style="z-index: 1; left: 62px; top: 268px; position: absolute; height: 28px; width: 92px" 
     Text="QuestionGroup" Font-Bold="True"></asp:Label> 
    <asp:Button ID="ButtonMultichoice" runat="server" 
     style="z-index: 1; left: 396px; top: 502px; position: absolute; height: 33px; width: 91px" 
     Text="Create" onclick="ButtonMultichoice_Click" /> 
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 

     style="z-index: 1; left: 122px; top: 698px; position: absolute; height: 142px; width: 222px"> 
     <Columns> 
      <asp:TemplateField HeaderText="Column Name"></asp:TemplateField> 
      <asp:TemplateField HeaderText="Type "></asp:TemplateField> 
      <asp:TemplateField HeaderText="Values"></asp:TemplateField> 
     </Columns> 
    </asp:GridView> 
    </asp:Panel> 

ответ

2

Вы можете сделать это, принимая помощь CSS для этого Просто написать класс CSS, который не содержит дисплей: нет; свойство и добавить этот класс к панели с помощью JavaScript, как этого

document.getElementbyID("PanelID").className = CssclassName 
2

Если вы установили настройки Visible="false" то панели не будет оказывать в генерируемом HTML панели. таким образом, вы не сможете сделать это видимым.

Однако, если вы хотите показать/скрыть с помощью JavaScript. использовать свойство display css с его значением «блок» или «нет» по мере необходимости